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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 } // namespace net | 29 } // namespace net |
30 | 30 |
31 // This is the base implementation for the OS-specific classes that route | 31 // This is the base implementation for the OS-specific classes that route |
32 // authentication info to the net::URLRequest that needs it. These functions | 32 // authentication info to the net::URLRequest that needs it. These functions |
33 // must be implemented in a thread safe manner. | 33 // must be implemented in a thread safe manner. |
34 class LoginHandler : public content::ResourceDispatcherHostLoginDelegate, | 34 class LoginHandler : public content::ResourceDispatcherHostLoginDelegate, |
35 public LoginModelObserver, | 35 public LoginModelObserver, |
36 public content::NotificationObserver { | 36 public content::NotificationObserver { |
37 public: | 37 public: |
38 LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request); | 38 LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request); |
39 virtual ~LoginHandler(); | |
40 | 39 |
41 // Builds the platform specific LoginHandler. Used from within | 40 // Builds the platform specific LoginHandler. Used from within |
42 // CreateLoginPrompt() which creates tasks. | 41 // CreateLoginPrompt() which creates tasks. |
43 static LoginHandler* Create(net::AuthChallengeInfo* auth_info, | 42 static LoginHandler* Create(net::AuthChallengeInfo* auth_info, |
44 net::URLRequest* request); | 43 net::URLRequest* request); |
45 | 44 |
46 // ResourceDispatcherHostLoginDelegate implementation: | 45 // ResourceDispatcherHostLoginDelegate implementation: |
47 virtual void OnRequestCancelled() OVERRIDE; | 46 virtual void OnRequestCancelled() OVERRIDE; |
48 | 47 |
49 // Initializes the underlying platform specific view. | 48 // Initializes the underlying platform specific view. |
(...skipping 27 matching lines...) Expand all Loading... |
77 const content::NotificationSource& source, | 76 const content::NotificationSource& source, |
78 const content::NotificationDetails& details) OVERRIDE; | 77 const content::NotificationDetails& details) OVERRIDE; |
79 | 78 |
80 // Who/where/what asked for the authentication. | 79 // Who/where/what asked for the authentication. |
81 const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); } | 80 const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); } |
82 | 81 |
83 // Returns whether authentication had been handled (SetAuth or CancelAuth). | 82 // Returns whether authentication had been handled (SetAuth or CancelAuth). |
84 bool WasAuthHandled() const; | 83 bool WasAuthHandled() const; |
85 | 84 |
86 protected: | 85 protected: |
| 86 virtual ~LoginHandler(); |
| 87 |
87 void SetModel(LoginModel* model); | 88 void SetModel(LoginModel* model); |
88 | 89 |
89 void SetDialog(ConstrainedWindow* dialog); | 90 void SetDialog(ConstrainedWindow* dialog); |
90 | 91 |
91 // Notify observers that authentication is needed. | 92 // Notify observers that authentication is needed. |
92 void NotifyAuthNeeded(); | 93 void NotifyAuthNeeded(); |
93 | 94 |
94 // Performs necessary cleanup before deletion. | 95 // Performs necessary cleanup before deletion. |
95 void ReleaseSoon(); | 96 void ReleaseSoon(); |
96 | 97 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // Helper to remove the ref from an net::URLRequest to the LoginHandler. | 219 // Helper to remove the ref from an net::URLRequest to the LoginHandler. |
219 // Should only be called from the IO thread, since it accesses an | 220 // Should only be called from the IO thread, since it accesses an |
220 // net::URLRequest. | 221 // net::URLRequest. |
221 void ResetLoginHandlerForRequest(net::URLRequest* request); | 222 void ResetLoginHandlerForRequest(net::URLRequest* request); |
222 | 223 |
223 // Get the signon_realm under which the identity should be saved. | 224 // Get the signon_realm under which the identity should be saved. |
224 std::string GetSignonRealm(const GURL& url, | 225 std::string GetSignonRealm(const GURL& url, |
225 const net::AuthChallengeInfo& auth_info); | 226 const net::AuthChallengeInfo& auth_info); |
226 | 227 |
227 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ | 228 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ |
OLD | NEW |