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 ConstrainedWindow; | 16 class WebContentsModalDialog; |
17 class GURL; | 17 class GURL; |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 class RenderViewHostDelegate; | 20 class RenderViewHostDelegate; |
21 class NotificationRegistrar; | 21 class NotificationRegistrar; |
22 } // namespace content | 22 } // namespace content |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 class AuthChallengeInfo; | 25 class AuthChallengeInfo; |
26 class HttpNetworkSession; | 26 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(); } | 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 |
84 void SetModel(LoginModel* model); | 84 void SetModel(LoginModel* model); |
85 | 85 |
86 void SetDialog(ConstrainedWindow* dialog); | 86 void SetDialog(WebContentsModalDialog* dialog); |
87 | 87 |
88 // Notify observers that authentication is needed. | 88 // Notify observers that authentication is needed. |
89 void NotifyAuthNeeded(); | 89 void NotifyAuthNeeded(); |
90 | 90 |
91 // Performs necessary cleanup before deletion. | 91 // Performs necessary cleanup before deletion. |
92 void ReleaseSoon(); | 92 void ReleaseSoon(); |
93 | 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(); |
(...skipping 19 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 ConstrainedWindow that is hosting our LoginView. | 126 // The WebContentsModalDialog that is hosting our LoginView. |
127 // This should only be accessed on the UI loop. | 127 // This should only be accessed on the UI loop. |
128 ConstrainedWindow* dialog_; | 128 WebContentsModalDialog* dialog_; |
129 | 129 |
130 // Who/where/what asked for the authentication. | 130 // Who/where/what asked for the authentication. |
131 scoped_refptr<net::AuthChallengeInfo> auth_info_; | 131 scoped_refptr<net::AuthChallengeInfo> auth_info_; |
132 | 132 |
133 // The request that wants login data. | 133 // The request that wants login data. |
134 // This should only be accessed on the IO loop. | 134 // This should only be accessed on the IO loop. |
135 net::URLRequest* request_; | 135 net::URLRequest* request_; |
136 | 136 |
137 // The HttpNetworkSession |request_| is associated with. | 137 // The HttpNetworkSession |request_| is associated with. |
138 const net::HttpNetworkSession* http_network_session_; | 138 const net::HttpNetworkSession* http_network_session_; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // Helper to remove the ref from an net::URLRequest to the LoginHandler. | 215 // 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 | 216 // Should only be called from the IO thread, since it accesses an |
217 // net::URLRequest. | 217 // net::URLRequest. |
218 void ResetLoginHandlerForRequest(net::URLRequest* request); | 218 void ResetLoginHandlerForRequest(net::URLRequest* request); |
219 | 219 |
220 // Get the signon_realm under which the identity should be saved. | 220 // Get the signon_realm under which the identity should be saved. |
221 std::string GetSignonRealm(const GURL& url, | 221 std::string GetSignonRealm(const GURL& url, |
222 const net::AuthChallengeInfo& auth_info); | 222 const net::AuthChallengeInfo& auth_info); |
223 | 223 |
224 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ | 224 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ |
OLD | NEW |