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" |
(...skipping 23 matching lines...) Expand all Loading... |
34 public content::NotificationObserver { | 34 public content::NotificationObserver { |
35 public: | 35 public: |
36 LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request); | 36 LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request); |
37 | 37 |
38 // Builds the platform specific LoginHandler. Used from within | 38 // Builds the platform specific LoginHandler. Used from within |
39 // CreateLoginPrompt() which creates tasks. | 39 // CreateLoginPrompt() which creates tasks. |
40 static LoginHandler* Create(net::AuthChallengeInfo* auth_info, | 40 static LoginHandler* Create(net::AuthChallengeInfo* auth_info, |
41 net::URLRequest* request); | 41 net::URLRequest* request); |
42 | 42 |
43 // ResourceDispatcherHostLoginDelegate implementation: | 43 // ResourceDispatcherHostLoginDelegate implementation: |
44 virtual void OnRequestCancelled() OVERRIDE; | 44 virtual void OnRequestCancelled() override; |
45 | 45 |
46 // Initializes the underlying platform specific view. | 46 // Initializes the underlying platform specific view. |
47 virtual void BuildViewForPasswordManager( | 47 virtual void BuildViewForPasswordManager( |
48 password_manager::PasswordManager* manager, | 48 password_manager::PasswordManager* manager, |
49 const base::string16& explanation) = 0; | 49 const base::string16& explanation) = 0; |
50 | 50 |
51 // Sets information about the authentication type (|form|) and the | 51 // Sets information about the authentication type (|form|) and the |
52 // |password_manager| for this profile. | 52 // |password_manager| for this profile. |
53 void SetPasswordForm(const autofill::PasswordForm& form); | 53 void SetPasswordForm(const autofill::PasswordForm& form); |
54 void SetPasswordManager(password_manager::PasswordManager* password_manager); | 54 void SetPasswordManager(password_manager::PasswordManager* password_manager); |
55 | 55 |
56 // Returns the WebContents that needs authentication. | 56 // Returns the WebContents that needs authentication. |
57 content::WebContents* GetWebContentsForLogin() const; | 57 content::WebContents* GetWebContentsForLogin() const; |
58 | 58 |
59 // Resend the request with authentication credentials. | 59 // Resend the request with authentication credentials. |
60 // This function can be called from either thread. | 60 // This function can be called from either thread. |
61 void SetAuth(const base::string16& username, const base::string16& password); | 61 void SetAuth(const base::string16& username, const base::string16& password); |
62 | 62 |
63 // Display the error page without asking for credentials again. | 63 // Display the error page without asking for credentials again. |
64 // This function can be called from either thread. | 64 // This function can be called from either thread. |
65 void CancelAuth(); | 65 void CancelAuth(); |
66 | 66 |
67 // Implements the content::NotificationObserver interface. | 67 // Implements the content::NotificationObserver interface. |
68 // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other | 68 // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other |
69 // LoginHandlers so that this LoginHandler has the chance to dismiss itself | 69 // LoginHandlers so that this LoginHandler has the chance to dismiss itself |
70 // if it was waiting for the same authentication. | 70 // if it was waiting for the same authentication. |
71 virtual void Observe(int type, | 71 virtual void Observe(int type, |
72 const content::NotificationSource& source, | 72 const content::NotificationSource& source, |
73 const content::NotificationDetails& details) OVERRIDE; | 73 const content::NotificationDetails& details) override; |
74 | 74 |
75 // Who/where/what asked for the authentication. | 75 // Who/where/what asked for the authentication. |
76 const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); } | 76 const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); } |
77 | 77 |
78 // Returns whether authentication had been handled (SetAuth or CancelAuth). | 78 // Returns whether authentication had been handled (SetAuth or CancelAuth). |
79 bool WasAuthHandled() const; | 79 bool WasAuthHandled() const; |
80 | 80 |
81 protected: | 81 protected: |
82 virtual ~LoginHandler(); | 82 virtual ~LoginHandler(); |
83 | 83 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // Helper to remove the ref from an net::URLRequest to the LoginHandler. | 212 // 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 | 213 // Should only be called from the IO thread, since it accesses an |
214 // net::URLRequest. | 214 // net::URLRequest. |
215 void ResetLoginHandlerForRequest(net::URLRequest* request); | 215 void ResetLoginHandlerForRequest(net::URLRequest* request); |
216 | 216 |
217 // Get the signon_realm under which the identity should be saved. | 217 // Get the signon_realm under which the identity should be saved. |
218 std::string GetSignonRealm(const GURL& url, | 218 std::string GetSignonRealm(const GURL& url, |
219 const net::AuthChallengeInfo& auth_info); | 219 const net::AuthChallengeInfo& auth_info); |
220 | 220 |
221 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ | 221 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ |
OLD | NEW |