| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 void OnRequestCancelled(); | 63 void OnRequestCancelled(); |
| 64 | 64 |
| 65 // Implements the NotificationObserver interface. | 65 // Implements the NotificationObserver interface. |
| 66 // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other | 66 // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other |
| 67 // LoginHandlers so that this LoginHandler has the chance to dismiss itself | 67 // LoginHandlers so that this LoginHandler has the chance to dismiss itself |
| 68 // if it was waiting for the same authentication. | 68 // if it was waiting for the same authentication. |
| 69 virtual void Observe(NotificationType type, | 69 virtual void Observe(NotificationType type, |
| 70 const NotificationSource& source, | 70 const NotificationSource& source, |
| 71 const NotificationDetails& details); | 71 const NotificationDetails& details); |
| 72 | 72 |
| 73 // Who/where/what asked for the authentication. |
| 74 const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); } |
| 75 |
| 76 // Returns whether authentication had been handled (SetAuth or CancelAuth). |
| 77 bool WasAuthHandled() const; |
| 78 |
| 73 protected: | 79 protected: |
| 74 void SetModel(LoginModel* model); | 80 void SetModel(LoginModel* model); |
| 75 | 81 |
| 76 void SetDialog(ConstrainedWindow* dialog); | 82 void SetDialog(ConstrainedWindow* dialog); |
| 77 | 83 |
| 78 // Notify observers that authentication is needed. | 84 // Notify observers that authentication is needed. |
| 79 void NotifyAuthNeeded(); | 85 void NotifyAuthNeeded(); |
| 80 | 86 |
| 81 // Performs necessary cleanup before deletion. | 87 // Performs necessary cleanup before deletion. |
| 82 void ReleaseSoon(); | 88 void ReleaseSoon(); |
| 83 | 89 |
| 84 // Who/where/what asked for the authentication. | |
| 85 net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); } | |
| 86 | |
| 87 private: | 90 private: |
| 88 // Starts observing notifications from other LoginHandlers. | 91 // Starts observing notifications from other LoginHandlers. |
| 89 void AddObservers(); | 92 void AddObservers(); |
| 90 | 93 |
| 91 // Stops observing notifications from other LoginHandlers. | 94 // Stops observing notifications from other LoginHandlers. |
| 92 void RemoveObservers(); | 95 void RemoveObservers(); |
| 93 | 96 |
| 94 // Notify observers that authentication is supplied. | 97 // Notify observers that authentication is supplied. |
| 95 void NotifyAuthSupplied(const std::wstring& username, | 98 void NotifyAuthSupplied(const std::wstring& username, |
| 96 const std::wstring& password); | 99 const std::wstring& password); |
| 97 | 100 |
| 98 // Notify observers that authentication is cancelled. | 101 // Notify observers that authentication is cancelled. |
| 99 void NotifyAuthCancelled(); | 102 void NotifyAuthCancelled(); |
| 100 | 103 |
| 101 // Returns whether authentication had been handled (SetAuth or CancelAuth). | 104 // Marks authentication as handled and returns the previous handled |
| 102 // If |set_handled| is true, it will mark authentication as handled. | 105 // state. |
| 103 bool WasAuthHandled(bool set_handled); | 106 bool TestAndSetAuthHandled(); |
| 104 | 107 |
| 105 // Calls SetAuth from the IO loop. | 108 // Calls SetAuth from the IO loop. |
| 106 void SetAuthDeferred(const std::wstring& username, | 109 void SetAuthDeferred(const std::wstring& username, |
| 107 const std::wstring& password); | 110 const std::wstring& password); |
| 108 | 111 |
| 109 // Calls CancelAuth from the IO loop. | 112 // Calls CancelAuth from the IO loop. |
| 110 void CancelAuthDeferred(); | 113 void CancelAuthDeferred(); |
| 111 | 114 |
| 112 // Closes the view_contents from the UI loop. | 115 // Closes the view_contents from the UI loop. |
| 113 void CloseContentsDeferred(); | 116 void CloseContentsDeferred(); |
| 114 | 117 |
| 115 // True if we've handled auth (SetAuth or CancelAuth has been called). | 118 // True if we've handled auth (SetAuth or CancelAuth has been called). |
| 116 bool handled_auth_; | 119 bool handled_auth_; |
| 117 Lock handled_auth_lock_; | 120 mutable Lock handled_auth_lock_; |
| 118 | 121 |
| 119 // The ConstrainedWindow that is hosting our LoginView. | 122 // The ConstrainedWindow that is hosting our LoginView. |
| 120 // This should only be accessed on the UI loop. | 123 // This should only be accessed on the UI loop. |
| 121 ConstrainedWindow* dialog_; | 124 ConstrainedWindow* dialog_; |
| 122 | 125 |
| 123 // Who/where/what asked for the authentication. | 126 // Who/where/what asked for the authentication. |
| 124 scoped_refptr<net::AuthChallengeInfo> auth_info_; | 127 scoped_refptr<net::AuthChallengeInfo> auth_info_; |
| 125 | 128 |
| 126 // The request that wants login data. | 129 // The request that wants login data. |
| 127 // This should only be accessed on the IO loop. | 130 // This should only be accessed on the IO loop. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // Helper to remove the ref from an net::URLRequest to the LoginHandler. | 208 // Helper to remove the ref from an net::URLRequest to the LoginHandler. |
| 206 // Should only be called from the IO thread, since it accesses an | 209 // Should only be called from the IO thread, since it accesses an |
| 207 // net::URLRequest. | 210 // net::URLRequest. |
| 208 void ResetLoginHandlerForRequest(net::URLRequest* request); | 211 void ResetLoginHandlerForRequest(net::URLRequest* request); |
| 209 | 212 |
| 210 // Get the signon_realm under which the identity should be saved. | 213 // Get the signon_realm under which the identity should be saved. |
| 211 std::string GetSignonRealm(const GURL& url, | 214 std::string GetSignonRealm(const GURL& url, |
| 212 const net::AuthChallengeInfo& auth_info); | 215 const net::AuthChallengeInfo& auth_info); |
| 213 | 216 |
| 214 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ | 217 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ |
| OLD | NEW |