]> khamidou — GitHub mirrors - electron.git/commitdiff
Add dummy LoginHandler
authorCheng Zhao <zcbenz@gmail.com>
Wed, 28 Oct 2015 07:34:41 +0000 (15:34 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 28 Oct 2015 11:54:59 +0000 (19:54 +0800)
atom/browser/atom_resource_dispatcher_host_delegate.cc
atom/browser/atom_resource_dispatcher_host_delegate.h
atom/browser/login_handler.cc [new file with mode: 0644]
atom/browser/login_handler.h [new file with mode: 0644]
filenames.gypi

index 46904d2ff99d11d2111b563c0a4b43555b5c8897..aaba1f31045bde8531492445c26d44dfcb029a7f 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "atom/browser/atom_resource_dispatcher_host_delegate.h"
 
+#include "atom/browser/login_handler.h"
 #include "atom/common/platform_util.h"
 #include "content/public/browser/browser_thread.h"
 #include "net/base/escape.h"
@@ -29,4 +30,11 @@ bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol(
   return true;
 }
 
+content::ResourceDispatcherHostLoginDelegate*
+AtomResourceDispatcherHostDelegate::CreateLoginDelegate(
+    net::AuthChallengeInfo* auth_info,
+    net::URLRequest* request) {
+  return new LoginHandler(auth_info, request);
+}
+
 }  // namespace atom
index 876554f0f9642074d787038b61690fc208710c7e..a90b366bc75bbf8db952b98810229b3eb16497ea 100644 (file)
@@ -21,6 +21,9 @@ class AtomResourceDispatcherHostDelegate
                               bool is_main_frame,
                               ui::PageTransition transition,
                               bool has_user_gesture) override;
+  content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(
+      net::AuthChallengeInfo* auth_info,
+      net::URLRequest* request) override;
 };
 
 }  // namespace atom
diff --git a/atom/browser/login_handler.cc b/atom/browser/login_handler.cc
new file mode 100644 (file)
index 0000000..1980cc1
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright (c) 2015 GitHub, Inc.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#include "atom/browser/login_handler.h"
+
+#include "net/base/auth.h"
+
+namespace atom {
+
+LoginHandler::LoginHandler(net::AuthChallengeInfo* auth_info,
+                           net::URLRequest* request)
+    : auth_info_(auth_info), request_(request), weak_factory_(this) {
+}
+
+LoginHandler::~LoginHandler() {
+}
+
+void LoginHandler::OnRequestCancelled() {
+}
+
+}  // namespace atom
diff --git a/atom/browser/login_handler.h b/atom/browser/login_handler.h
new file mode 100644 (file)
index 0000000..421e2e4
--- /dev/null
@@ -0,0 +1,43 @@
+// Copyright (c) 2015 GitHub, Inc.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#ifndef ATOM_BROWSER_LOGIN_HANDLER_H_
+#define ATOM_BROWSER_LOGIN_HANDLER_H_
+
+#include "base/memory/weak_ptr.h"
+#include "content/public/browser/resource_dispatcher_host_login_delegate.h"
+
+namespace net {
+class AuthChallengeInfo;
+class URLRequest;
+}
+
+namespace atom {
+
+class LoginHandler : public content::ResourceDispatcherHostLoginDelegate {
+ public:
+  LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request);
+
+ protected:
+  ~LoginHandler() override;
+
+  // content::ResourceDispatcherHostLoginDelegate:
+  void OnRequestCancelled() override;
+
+ private:
+  // Who/where/what asked for the authentication.
+  scoped_refptr<net::AuthChallengeInfo> auth_info_;
+
+  // The request that wants login data.
+  // This should only be accessed on the IO loop.
+  net::URLRequest* request_;
+
+  base::WeakPtrFactory<LoginHandler> weak_factory_;
+
+  DISALLOW_COPY_AND_ASSIGN(LoginHandler);
+};
+
+}  // namespace atom
+
+#endif  // ATOM_BROWSER_LOGIN_HANDLER_H_
index e6d180d652e1049fd1b1d5e6fb0312928b3cc659..a294a1e8083f7aa31338e270a263dc2b2154a50a 100644 (file)
       'atom/browser/common_web_contents_delegate.h',
       'atom/browser/javascript_environment.cc',
       'atom/browser/javascript_environment.h',
+      'atom/browser/login_handler.cc',
+      'atom/browser/login_handler.h',
       'atom/browser/mac/atom_application.h',
       'atom/browser/mac/atom_application.mm',
       'atom/browser/mac/atom_application_delegate.h',