Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: chrome/browser/ui/login/login_prompt.h

Issue 1384283003: Do not involve PasswordManagerDriver in filling HTTP-auth forms; also check realm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Complete with new tests Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request); 41 LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request);
42 42
43 // Builds the platform specific LoginHandler. Used from within 43 // Builds the platform specific LoginHandler. Used from within
44 // CreateLoginPrompt() which creates tasks. 44 // CreateLoginPrompt() which creates tasks.
45 static LoginHandler* Create(net::AuthChallengeInfo* auth_info, 45 static LoginHandler* Create(net::AuthChallengeInfo* auth_info,
46 net::URLRequest* request); 46 net::URLRequest* request);
47 47
48 // ResourceDispatcherHostLoginDelegate implementation: 48 // ResourceDispatcherHostLoginDelegate implementation:
49 void OnRequestCancelled() override; 49 void OnRequestCancelled() override;
50 50
51 // Initializes the underlying platform specific view. 51 // Initializes the underlying platform specific view. If |manager| is not
52 // null, then also |observed_form| must not be null; in that case |manager| is
53 // used to retrieve stored credentials matching |observed_form| and fill them
54 // in the login prompt.
52 virtual void BuildViewForPasswordManager( 55 virtual void BuildViewForPasswordManager(
53 password_manager::PasswordManager* manager, 56 password_manager::PasswordManager* manager,
54 const base::string16& explanation) = 0; 57 const base::string16& explanation,
58 const autofill::PasswordForm* observed_form) = 0;
Peter Kasting 2015/10/06 22:14:49 I can't say I love the pervasive DCHECK_EQ(mana
vabr (Chromium) 2015/10/07 10:29:22 You raise a good point. I attempted to solve this
55 59
56 // Sets information about the authentication type (|form|) and the 60 // Sets information about the authentication type (|form|) and the
57 // |password_manager| for this profile. 61 // |password_manager| for this profile.
58 void SetPasswordForm(const autofill::PasswordForm& form); 62 void SetPasswordForm(const autofill::PasswordForm& form);
59 void SetPasswordManager(password_manager::PasswordManager* password_manager); 63 void SetPasswordManager(password_manager::PasswordManager* password_manager);
60 64
61 // Returns the WebContents that needs authentication. 65 // Returns the WebContents that needs authentication.
62 content::WebContents* GetWebContentsForLogin() const; 66 content::WebContents* GetWebContentsForLogin() const;
63 67
64 // Returns the PasswordManager for the render frame that needs login. 68 // Returns the PasswordManager for the web contents that needs login.
65 password_manager::ContentPasswordManagerDriver* 69 password_manager::PasswordManager* GetPasswordManagerForLogin();
66 GetPasswordManagerDriverForLogin();
67 70
68 // Resend the request with authentication credentials. 71 // Resend the request with authentication credentials.
69 // This function can be called from either thread. 72 // This function can be called from either thread.
70 void SetAuth(const base::string16& username, const base::string16& password); 73 void SetAuth(const base::string16& username, const base::string16& password);
71 74
72 // Display the error page without asking for credentials again. 75 // Display the error page without asking for credentials again.
73 // This function can be called from either thread. 76 // This function can be called from either thread.
74 void CancelAuth(); 77 void CancelAuth();
75 78
76 // Implements the content::NotificationObserver interface. 79 // Implements the content::NotificationObserver interface.
77 // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other 80 // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other
78 // LoginHandlers so that this LoginHandler has the chance to dismiss itself 81 // LoginHandlers so that this LoginHandler has the chance to dismiss itself
79 // if it was waiting for the same authentication. 82 // if it was waiting for the same authentication.
80 void Observe(int type, 83 void Observe(int type,
81 const content::NotificationSource& source, 84 const content::NotificationSource& source,
82 const content::NotificationDetails& details) override; 85 const content::NotificationDetails& details) override;
83 86
84 // Who/where/what asked for the authentication. 87 // Who/where/what asked for the authentication.
85 const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); } 88 const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); }
86 89
87 // Returns whether authentication had been handled (SetAuth or CancelAuth). 90 // Returns whether authentication had been handled (SetAuth or CancelAuth).
88 bool WasAuthHandled() const; 91 bool WasAuthHandled() const;
89 92
90 protected: 93 protected:
91 ~LoginHandler() override; 94 ~LoginHandler() override;
92 95
93 void SetModel(password_manager::LoginModel* model); 96 void SetModel(password_manager::LoginModel* model,
97 const autofill::PasswordForm* observed_form);
94 98
95 // Notify observers that authentication is needed. 99 // Notify observers that authentication is needed.
96 void NotifyAuthNeeded(); 100 void NotifyAuthNeeded();
97 101
98 // Performs necessary cleanup before deletion. 102 // Performs necessary cleanup before deletion.
99 void ReleaseSoon(); 103 void ReleaseSoon();
100 104
101 // Closes the native dialog. 105 // Closes the native dialog.
102 virtual void CloseDialog() = 0; 106 virtual void CloseDialog() = 0;
103 107
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // Helper to remove the ref from an net::URLRequest to the LoginHandler. 225 // Helper to remove the ref from an net::URLRequest to the LoginHandler.
222 // Should only be called from the IO thread, since it accesses an 226 // Should only be called from the IO thread, since it accesses an
223 // net::URLRequest. 227 // net::URLRequest.
224 void ResetLoginHandlerForRequest(net::URLRequest* request); 228 void ResetLoginHandlerForRequest(net::URLRequest* request);
225 229
226 // Get the signon_realm under which the identity should be saved. 230 // Get the signon_realm under which the identity should be saved.
227 std::string GetSignonRealm(const GURL& url, 231 std::string GetSignonRealm(const GURL& url,
228 const net::AuthChallengeInfo& auth_info); 232 const net::AuthChallengeInfo& auth_info);
229 233
230 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_ 234 #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_PROMPT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698