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 } // namespace content | 21 } // namespace content |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 class AuthChallengeInfo; | 24 class AuthChallengeInfo; |
25 class HttpNetworkSession; | 25 class HttpNetworkSession; |
26 class URLRequest; | 26 class URLRequest; |
27 } // namespace net | 27 } // namespace net |
28 | 28 |
| 29 namespace password_manager { |
| 30 class ContentPasswordManagerDriver; |
| 31 } // namespace password_manager |
| 32 |
29 // This is the base implementation for the OS-specific classes that route | 33 // This is the base implementation for the OS-specific classes that route |
30 // authentication info to the net::URLRequest that needs it. These functions | 34 // authentication info to the net::URLRequest that needs it. These functions |
31 // must be implemented in a thread safe manner. | 35 // must be implemented in a thread safe manner. |
32 class LoginHandler : public content::ResourceDispatcherHostLoginDelegate, | 36 class LoginHandler : public content::ResourceDispatcherHostLoginDelegate, |
33 public password_manager::LoginModelObserver, | 37 public password_manager::LoginModelObserver, |
34 public content::NotificationObserver { | 38 public content::NotificationObserver { |
35 public: | 39 public: |
36 LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request); | 40 LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request); |
37 | 41 |
38 // Builds the platform specific LoginHandler. Used from within | 42 // Builds the platform specific LoginHandler. Used from within |
(...skipping 10 matching lines...) Expand all Loading... |
49 const base::string16& explanation) = 0; | 53 const base::string16& explanation) = 0; |
50 | 54 |
51 // Sets information about the authentication type (|form|) and the | 55 // Sets information about the authentication type (|form|) and the |
52 // |password_manager| for this profile. | 56 // |password_manager| for this profile. |
53 void SetPasswordForm(const autofill::PasswordForm& form); | 57 void SetPasswordForm(const autofill::PasswordForm& form); |
54 void SetPasswordManager(password_manager::PasswordManager* password_manager); | 58 void SetPasswordManager(password_manager::PasswordManager* password_manager); |
55 | 59 |
56 // Returns the WebContents that needs authentication. | 60 // Returns the WebContents that needs authentication. |
57 content::WebContents* GetWebContentsForLogin() const; | 61 content::WebContents* GetWebContentsForLogin() const; |
58 | 62 |
| 63 // Returns the PasswordManager for the render frame that needs login. |
| 64 password_manager::ContentPasswordManagerDriver* |
| 65 GetPasswordManagerDriverForLogin(); |
| 66 |
59 // Resend the request with authentication credentials. | 67 // Resend the request with authentication credentials. |
60 // This function can be called from either thread. | 68 // This function can be called from either thread. |
61 void SetAuth(const base::string16& username, const base::string16& password); | 69 void SetAuth(const base::string16& username, const base::string16& password); |
62 | 70 |
63 // Display the error page without asking for credentials again. | 71 // Display the error page without asking for credentials again. |
64 // This function can be called from either thread. | 72 // This function can be called from either thread. |
65 void CancelAuth(); | 73 void CancelAuth(); |
66 | 74 |
67 // Implements the content::NotificationObserver interface. | 75 // Implements the content::NotificationObserver interface. |
68 // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other | 76 // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // Helper to remove the ref from an net::URLRequest to the LoginHandler. | 220 // Helper to remove the ref from an net::URLRequest to the LoginHandler. |
213 // Should only be called from the IO thread, since it accesses an | 221 // Should only be called from the IO thread, since it accesses an |
214 // net::URLRequest. | 222 // net::URLRequest. |
215 void ResetLoginHandlerForRequest(net::URLRequest* request); | 223 void ResetLoginHandlerForRequest(net::URLRequest* request); |
216 | 224 |
217 // Get the signon_realm under which the identity should be saved. | 225 // Get the signon_realm under which the identity should be saved. |
218 std::string GetSignonRealm(const GURL& url, | 226 std::string GetSignonRealm(const GURL& url, |
219 const net::AuthChallengeInfo& auth_info); | 227 const net::AuthChallengeInfo& auth_info); |
220 | 228 |
221 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ | 229 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ |
OLD | NEW |