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" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // CreateLoginPrompt() which creates tasks. | 55 // CreateLoginPrompt() which creates tasks. |
56 static LoginHandler* Create(net::AuthChallengeInfo* auth_info, | 56 static LoginHandler* Create(net::AuthChallengeInfo* auth_info, |
57 net::URLRequest* request); | 57 net::URLRequest* request); |
58 | 58 |
59 // ResourceDispatcherHostLoginDelegate implementation: | 59 // ResourceDispatcherHostLoginDelegate implementation: |
60 void OnRequestCancelled() override; | 60 void OnRequestCancelled() override; |
61 | 61 |
62 // Use this to build a view with password manager support. |password_manager| | 62 // Use this to build a view with password manager support. |password_manager| |
63 // must not be null. | 63 // must not be null. |
64 void BuildViewWithPasswordManager( | 64 void BuildViewWithPasswordManager( |
| 65 const base::string16& authority, |
65 const base::string16& explanation, | 66 const base::string16& explanation, |
66 password_manager::PasswordManager* password_manager, | 67 password_manager::PasswordManager* password_manager, |
67 const autofill::PasswordForm& observed_form); | 68 const autofill::PasswordForm& observed_form); |
68 | 69 |
69 // Use this to build a view without password manager support. | 70 // Use this to build a view without password manager support. |
70 void BuildViewWithoutPasswordManager(const base::string16& explanation); | 71 void BuildViewWithoutPasswordManager(const base::string16& authority, |
| 72 const base::string16& explanation); |
71 | 73 |
72 // Returns the WebContents that needs authentication. | 74 // Returns the WebContents that needs authentication. |
73 content::WebContents* GetWebContentsForLogin() const; | 75 content::WebContents* GetWebContentsForLogin() const; |
74 | 76 |
75 // Returns the PasswordManager for the web contents that needs login. | 77 // Returns the PasswordManager for the web contents that needs login. |
76 password_manager::PasswordManager* GetPasswordManagerForLogin(); | 78 password_manager::PasswordManager* GetPasswordManagerForLogin(); |
77 | 79 |
78 // Resend the request with authentication credentials. | 80 // Resend the request with authentication credentials. |
79 // This function can be called from either thread. | 81 // This function can be called from either thread. |
80 void SetAuth(const base::string16& username, const base::string16& password); | 82 void SetAuth(const base::string16& username, const base::string16& password); |
(...skipping 15 matching lines...) Expand all Loading... |
96 | 98 |
97 // Returns whether authentication had been handled (SetAuth or CancelAuth). | 99 // Returns whether authentication had been handled (SetAuth or CancelAuth). |
98 bool WasAuthHandled() const; | 100 bool WasAuthHandled() const; |
99 | 101 |
100 protected: | 102 protected: |
101 ~LoginHandler() override; | 103 ~LoginHandler() override; |
102 | 104 |
103 // Implement this to initialize the underlying platform specific view. If | 105 // Implement this to initialize the underlying platform specific view. If |
104 // |login_model_data| is not null, the contained LoginModel and PasswordForm | 106 // |login_model_data| is not null, the contained LoginModel and PasswordForm |
105 // can be used to register the view. | 107 // can be used to register the view. |
106 virtual void BuildViewImpl(const base::string16& explanation, | 108 virtual void BuildViewImpl(const base::string16& authority, |
| 109 const base::string16& explanation, |
107 LoginModelData* login_model_data) = 0; | 110 LoginModelData* login_model_data) = 0; |
108 | 111 |
109 // Sets |model_data.model| as |login_model_| and registers |this| as an | 112 // Sets |model_data.model| as |login_model_| and registers |this| as an |
110 // observer for |model_data.form|-related events. | 113 // observer for |model_data.form|-related events. |
111 void SetModel(LoginModelData model_data); | 114 void SetModel(LoginModelData model_data); |
112 | 115 |
113 // Clears |login_model_| and removes |this| as an observer. | 116 // Clears |login_model_| and removes |this| as an observer. |
114 void ResetModel(); | 117 void ResetModel(); |
115 | 118 |
116 // Notify observers that authentication is needed. | 119 // Notify observers that authentication is needed. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // caller must invoke OnRequestCancelled() on this LoginHandler before | 240 // caller must invoke OnRequestCancelled() on this LoginHandler before |
238 // destroying the net::URLRequest. | 241 // destroying the net::URLRequest. |
239 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, | 242 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, |
240 net::URLRequest* request); | 243 net::URLRequest* request); |
241 | 244 |
242 // Get the signon_realm under which the identity should be saved. | 245 // Get the signon_realm under which the identity should be saved. |
243 std::string GetSignonRealm(const GURL& url, | 246 std::string GetSignonRealm(const GURL& url, |
244 const net::AuthChallengeInfo& auth_info); | 247 const net::AuthChallengeInfo& auth_info); |
245 | 248 |
246 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ | 249 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ |
OLD | NEW |