| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 public: | 33 public: |
| 34 LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request); | 34 LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request); |
| 35 virtual ~LoginHandler(); | 35 virtual ~LoginHandler(); |
| 36 | 36 |
| 37 // Builds the platform specific LoginHandler. Used from within | 37 // Builds the platform specific LoginHandler. Used from within |
| 38 // CreateLoginPrompt() which creates tasks. | 38 // CreateLoginPrompt() which creates tasks. |
| 39 static LoginHandler* Create(net::AuthChallengeInfo* auth_info, | 39 static LoginHandler* Create(net::AuthChallengeInfo* auth_info, |
| 40 net::URLRequest* request); | 40 net::URLRequest* request); |
| 41 | 41 |
| 42 // ResourceDispatcherHostLoginDelegate implementation: | 42 // ResourceDispatcherHostLoginDelegate implementation: |
| 43 virtual void OnRequestCancelled(); | 43 virtual void OnRequestCancelled() OVERRIDE; |
| 44 | 44 |
| 45 // Initializes the underlying platform specific view. | 45 // Initializes the underlying platform specific view. |
| 46 virtual void BuildViewForPasswordManager(PasswordManager* manager, | 46 virtual void BuildViewForPasswordManager(PasswordManager* manager, |
| 47 const string16& explanation) = 0; | 47 const string16& explanation) = 0; |
| 48 | 48 |
| 49 // Sets information about the authentication type (|form|) and the | 49 // Sets information about the authentication type (|form|) and the |
| 50 // |password_manager| for this profile. | 50 // |password_manager| for this profile. |
| 51 void SetPasswordForm(const webkit_glue::PasswordForm& form); | 51 void SetPasswordForm(const webkit_glue::PasswordForm& form); |
| 52 void SetPasswordManager(PasswordManager* password_manager); | 52 void SetPasswordManager(PasswordManager* password_manager); |
| 53 | 53 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 64 // Display the error page without asking for credentials again. | 64 // Display the error page without asking for credentials again. |
| 65 // This function can be called from either thread. | 65 // This function can be called from either thread. |
| 66 void CancelAuth(); | 66 void CancelAuth(); |
| 67 | 67 |
| 68 // Implements the content::NotificationObserver interface. | 68 // Implements the content::NotificationObserver interface. |
| 69 // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other | 69 // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other |
| 70 // LoginHandlers so that this LoginHandler has the chance to dismiss itself | 70 // LoginHandlers so that this LoginHandler has the chance to dismiss itself |
| 71 // if it was waiting for the same authentication. | 71 // if it was waiting for the same authentication. |
| 72 virtual void Observe(int type, | 72 virtual void Observe(int type, |
| 73 const content::NotificationSource& source, | 73 const content::NotificationSource& source, |
| 74 const content::NotificationDetails& details); | 74 const content::NotificationDetails& details) OVERRIDE; |
| 75 | 75 |
| 76 // Who/where/what asked for the authentication. | 76 // Who/where/what asked for the authentication. |
| 77 const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); } | 77 const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); } |
| 78 | 78 |
| 79 // Returns whether authentication had been handled (SetAuth or CancelAuth). | 79 // Returns whether authentication had been handled (SetAuth or CancelAuth). |
| 80 bool WasAuthHandled() const; | 80 bool WasAuthHandled() const; |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 void SetModel(LoginModel* model); | 83 void SetModel(LoginModel* model); |
| 84 | 84 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 // If not null, points to a model we need to notify of our own destruction | 151 // If not null, points to a model we need to notify of our own destruction |
| 152 // so it doesn't try and access this when its too late. | 152 // so it doesn't try and access this when its too late. |
| 153 LoginModel* login_model_; | 153 LoginModel* login_model_; |
| 154 | 154 |
| 155 // Observes other login handlers so this login handler can respond. | 155 // Observes other login handlers so this login handler can respond. |
| 156 content::NotificationRegistrar registrar_; | 156 content::NotificationRegistrar registrar_; |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 // Details to provide the content::NotificationObserver. Used by the automation | 159 // Details to provide the content::NotificationObserver. Used by the automation |
| 160 //proxy for testing. | 160 // proxy for testing. |
| 161 class LoginNotificationDetails { | 161 class LoginNotificationDetails { |
| 162 public: | 162 public: |
| 163 explicit LoginNotificationDetails(LoginHandler* handler) | 163 explicit LoginNotificationDetails(LoginHandler* handler) |
| 164 : handler_(handler) {} | 164 : handler_(handler) {} |
| 165 LoginHandler* handler() const { return handler_; } | 165 LoginHandler* handler() const { return handler_; } |
| 166 | 166 |
| 167 private: | 167 private: |
| 168 LoginNotificationDetails() {} | 168 LoginNotificationDetails() {} |
| 169 | 169 |
| 170 LoginHandler* handler_; // Where to send the response. | 170 LoginHandler* handler_; // Where to send the response. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // Helper to remove the ref from an net::URLRequest to the LoginHandler. | 211 // Helper to remove the ref from an net::URLRequest to the LoginHandler. |
| 212 // Should only be called from the IO thread, since it accesses an | 212 // Should only be called from the IO thread, since it accesses an |
| 213 // net::URLRequest. | 213 // net::URLRequest. |
| 214 void ResetLoginHandlerForRequest(net::URLRequest* request); | 214 void ResetLoginHandlerForRequest(net::URLRequest* request); |
| 215 | 215 |
| 216 // Get the signon_realm under which the identity should be saved. | 216 // Get the signon_realm under which the identity should be saved. |
| 217 std::string GetSignonRealm(const GURL& url, | 217 std::string GetSignonRealm(const GURL& url, |
| 218 const net::AuthChallengeInfo& auth_info); | 218 const net::AuthChallengeInfo& auth_info); |
| 219 | 219 |
| 220 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ | 220 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ |
| OLD | NEW |