| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ | 5 #ifndef CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ |
| 6 #define CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ | 6 #define CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
| 12 #include "components/password_manager/core/browser/password_manager.h" | 12 #include "components/password_manager/core/browser/password_manager.h" |
| 13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" | 14 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" |
| 15 | 15 |
| 16 class GURL; | 16 class GURL; |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 class RenderViewHostDelegate; | 19 class RenderViewHostDelegate; |
| 20 class NotificationRegistrar; | 20 class NotificationRegistrar; |
| 21 class WebContents; | 21 class WebContents; |
| 22 } // namespace content | 22 } // namespace content |
| 23 | 23 |
| 24 namespace net { | 24 namespace net { |
| 25 class AuthChallengeInfo; | 25 class AuthChallengeInfo; |
| 26 class HttpNetworkSession; | 26 class HttpNetworkSession; |
| 27 class URLRequest; | 27 class URLRequest; |
| 28 } // namespace net | 28 } // namespace net |
| 29 | 29 |
| 30 namespace password_manager { |
| 31 class ContentPasswordManagerDriver; |
| 32 } // namespace password_manager |
| 33 |
| 30 // This is the base implementation for the OS-specific classes that route | 34 // This is the base implementation for the OS-specific classes that route |
| 31 // authentication info to the net::URLRequest that needs it. These functions | 35 // authentication info to the net::URLRequest that needs it. These functions |
| 32 // must be implemented in a thread safe manner. | 36 // must be implemented in a thread safe manner. |
| 33 class LoginHandler : public content::ResourceDispatcherHostLoginDelegate, | 37 class LoginHandler : public content::ResourceDispatcherHostLoginDelegate, |
| 34 public password_manager::LoginModelObserver, | 38 public password_manager::LoginModelObserver, |
| 35 public content::NotificationObserver { | 39 public content::NotificationObserver { |
| 36 public: | 40 public: |
| 37 LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request); | 41 LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request); |
| 38 | 42 |
| 39 // Builds the platform specific LoginHandler. Used from within | 43 // Builds the platform specific LoginHandler. Used from within |
| (...skipping 10 matching lines...) Expand all Loading... |
| 50 const base::string16& explanation) = 0; | 54 const base::string16& explanation) = 0; |
| 51 | 55 |
| 52 // Sets information about the authentication type (|form|) and the | 56 // Sets information about the authentication type (|form|) and the |
| 53 // |password_manager| for this profile. | 57 // |password_manager| for this profile. |
| 54 void SetPasswordForm(const autofill::PasswordForm& form); | 58 void SetPasswordForm(const autofill::PasswordForm& form); |
| 55 void SetPasswordManager(password_manager::PasswordManager* password_manager); | 59 void SetPasswordManager(password_manager::PasswordManager* password_manager); |
| 56 | 60 |
| 57 // Returns the WebContents that needs authentication. | 61 // Returns the WebContents that needs authentication. |
| 58 content::WebContents* GetWebContentsForLogin() const; | 62 content::WebContents* GetWebContentsForLogin() const; |
| 59 | 63 |
| 64 // Returns the PasswordManager for the render frame that needs login. |
| 65 password_manager::ContentPasswordManagerDriver* |
| 66 GetPasswordManagerDriverForLogin(); |
| 67 |
| 60 // Resend the request with authentication credentials. | 68 // Resend the request with authentication credentials. |
| 61 // This function can be called from either thread. | 69 // This function can be called from either thread. |
| 62 void SetAuth(const base::string16& username, const base::string16& password); | 70 void SetAuth(const base::string16& username, const base::string16& password); |
| 63 | 71 |
| 64 // Display the error page without asking for credentials again. | 72 // Display the error page without asking for credentials again. |
| 65 // This function can be called from either thread. | 73 // This function can be called from either thread. |
| 66 void CancelAuth(); | 74 void CancelAuth(); |
| 67 | 75 |
| 68 // Implements the content::NotificationObserver interface. | 76 // Implements the content::NotificationObserver interface. |
| 69 // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other | 77 // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // Helper to remove the ref from an net::URLRequest to the LoginHandler. | 221 // Helper to remove the ref from an net::URLRequest to the LoginHandler. |
| 214 // Should only be called from the IO thread, since it accesses an | 222 // Should only be called from the IO thread, since it accesses an |
| 215 // net::URLRequest. | 223 // net::URLRequest. |
| 216 void ResetLoginHandlerForRequest(net::URLRequest* request); | 224 void ResetLoginHandlerForRequest(net::URLRequest* request); |
| 217 | 225 |
| 218 // Get the signon_realm under which the identity should be saved. | 226 // Get the signon_realm under which the identity should be saved. |
| 219 std::string GetSignonRealm(const GURL& url, | 227 std::string GetSignonRealm(const GURL& url, |
| 220 const net::AuthChallengeInfo& auth_info); | 228 const net::AuthChallengeInfo& auth_info); |
| 221 | 229 |
| 222 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ | 230 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ |
| OLD | NEW |