| 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 "chrome/browser/password_manager/password_manager.h" | 12 #include "chrome/browser/password_manager/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 WebContentsModalDialog; | |
| 17 class GURL; | 16 class GURL; |
| 18 | 17 |
| 19 namespace content { | 18 namespace content { |
| 20 class RenderViewHostDelegate; | 19 class RenderViewHostDelegate; |
| 21 class NotificationRegistrar; | 20 class NotificationRegistrar; |
| 22 } // namespace content | 21 } // namespace content |
| 23 | 22 |
| 24 namespace net { | 23 namespace net { |
| 25 class AuthChallengeInfo; | 24 class AuthChallengeInfo; |
| 26 class HttpNetworkSession; | 25 class HttpNetworkSession; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); } | 75 const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); } |
| 77 | 76 |
| 78 // Returns whether authentication had been handled (SetAuth or CancelAuth). | 77 // Returns whether authentication had been handled (SetAuth or CancelAuth). |
| 79 bool WasAuthHandled() const; | 78 bool WasAuthHandled() const; |
| 80 | 79 |
| 81 protected: | 80 protected: |
| 82 virtual ~LoginHandler(); | 81 virtual ~LoginHandler(); |
| 83 | 82 |
| 84 void SetModel(LoginModel* model); | 83 void SetModel(LoginModel* model); |
| 85 | 84 |
| 86 void SetDialog(WebContentsModalDialog* dialog); | |
| 87 | |
| 88 // Notify observers that authentication is needed. | 85 // Notify observers that authentication is needed. |
| 89 void NotifyAuthNeeded(); | 86 void NotifyAuthNeeded(); |
| 90 | 87 |
| 91 // Performs necessary cleanup before deletion. | 88 // Performs necessary cleanup before deletion. |
| 92 void ReleaseSoon(); | 89 void ReleaseSoon(); |
| 93 | 90 |
| 91 // Closes the native dialog. |
| 92 virtual void CloseDialog() = 0; |
| 93 |
| 94 private: | 94 private: |
| 95 // Starts observing notifications from other LoginHandlers. | 95 // Starts observing notifications from other LoginHandlers. |
| 96 void AddObservers(); | 96 void AddObservers(); |
| 97 | 97 |
| 98 // Stops observing notifications from other LoginHandlers. | 98 // Stops observing notifications from other LoginHandlers. |
| 99 void RemoveObservers(); | 99 void RemoveObservers(); |
| 100 | 100 |
| 101 // Notify observers that authentication is supplied. | 101 // Notify observers that authentication is supplied. |
| 102 void NotifyAuthSupplied(const string16& username, | 102 void NotifyAuthSupplied(const string16& username, |
| 103 const string16& password); | 103 const string16& password); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 116 // Calls CancelAuth from the IO loop. | 116 // Calls CancelAuth from the IO loop. |
| 117 void CancelAuthDeferred(); | 117 void CancelAuthDeferred(); |
| 118 | 118 |
| 119 // Closes the view_contents from the UI loop. | 119 // Closes the view_contents from the UI loop. |
| 120 void CloseContentsDeferred(); | 120 void CloseContentsDeferred(); |
| 121 | 121 |
| 122 // True if we've handled auth (SetAuth or CancelAuth has been called). | 122 // True if we've handled auth (SetAuth or CancelAuth has been called). |
| 123 bool handled_auth_; | 123 bool handled_auth_; |
| 124 mutable base::Lock handled_auth_lock_; | 124 mutable base::Lock handled_auth_lock_; |
| 125 | 125 |
| 126 // The WebContentsModalDialog that is hosting our LoginView. | |
| 127 // This should only be accessed on the UI loop. | |
| 128 WebContentsModalDialog* dialog_; | |
| 129 | |
| 130 // Who/where/what asked for the authentication. | 126 // Who/where/what asked for the authentication. |
| 131 scoped_refptr<net::AuthChallengeInfo> auth_info_; | 127 scoped_refptr<net::AuthChallengeInfo> auth_info_; |
| 132 | 128 |
| 133 // The request that wants login data. | 129 // The request that wants login data. |
| 134 // This should only be accessed on the IO loop. | 130 // This should only be accessed on the IO loop. |
| 135 net::URLRequest* request_; | 131 net::URLRequest* request_; |
| 136 | 132 |
| 137 // The HttpNetworkSession |request_| is associated with. | 133 // The HttpNetworkSession |request_| is associated with. |
| 138 const net::HttpNetworkSession* http_network_session_; | 134 const net::HttpNetworkSession* http_network_session_; |
| 139 | 135 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // 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. |
| 216 // 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 |
| 217 // net::URLRequest. | 213 // net::URLRequest. |
| 218 void ResetLoginHandlerForRequest(net::URLRequest* request); | 214 void ResetLoginHandlerForRequest(net::URLRequest* request); |
| 219 | 215 |
| 220 // Get the signon_realm under which the identity should be saved. | 216 // Get the signon_realm under which the identity should be saved. |
| 221 std::string GetSignonRealm(const GURL& url, | 217 std::string GetSignonRealm(const GURL& url, |
| 222 const net::AuthChallengeInfo& auth_info); | 218 const net::AuthChallengeInfo& auth_info); |
| 223 | 219 |
| 224 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ | 220 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ |
| OLD | NEW |