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

Unified Diff: chrome/browser/ui/login/login_handler.h

Issue 2067933002: Use correct origin when prompting for proxy authentication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/login/login_handler.cc » ('j') | chrome/browser/ui/login/login_handler.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/login/login_handler.h
diff --git a/chrome/browser/ui/login/login_handler.h b/chrome/browser/ui/login/login_handler.h
index 9e66547bd99179298af24b3f91b64d4b68f6113e..fb058fcf0d310e4ef2cb96c46487642524d48f6b 100644
--- a/chrome/browser/ui/login/login_handler.h
+++ b/chrome/browser/ui/login/login_handler.h
@@ -8,6 +8,7 @@
#include <memory>
#include <string>
+#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/synchronization/lock.h"
@@ -135,6 +136,10 @@ class LoginHandler : public content::ResourceDispatcherHostLoginDelegate,
virtual void CloseDialog() = 0;
private:
+ friend LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info,
+ net::URLRequest* request);
+ FRIEND_TEST_ALL_PREFIXES(LoginHandlerTest, Outputs);
+
// Starts observing notifications from other LoginHandlers.
void AddObservers();
@@ -166,6 +171,45 @@ class LoginHandler : public content::ResourceDispatcherHostLoginDelegate,
// Closes the view_contents from the UI loop.
void CloseContentsDeferred();
+ // Get the signon_realm under which this auth info should be stored.
+ //
+ // The format of the signon_realm for proxy auth is:
+ // proxy-host:proxy-port/auth-realm
+ // The format of the signon_realm for server auth is:
+ // url-scheme://url-host[:url-port]/auth-realm
+ //
+ // Be careful when changing this function, since you could make existing
+ // saved logins un-retrievable.
+ static std::string GetSignonRealm(const GURL& url,
+ const net::AuthChallengeInfo& auth_info);
+
+ // Helper to create a PasswordForm for PasswordManager to start looking for
+ // saved credentials.
+ static autofill::PasswordForm MakeInputForPasswordManager(
+ const GURL& url,
+ const net::AuthChallengeInfo& auth_info);
+
+ static void GetDialogStrings(const GURL& request_url,
+ const net::AuthChallengeInfo& auth_info,
+ base::string16* authority,
+ base::string16* explanation);
+
+ static void ShowLoginPrompt(const GURL& request_url,
+ net::AuthChallengeInfo* auth_info,
+ LoginHandler* handler);
+
+ // This callback is run on the UI thread and creates a constrained window with
+ // a LoginView to prompt the user. If the prompt is triggered because of a
+ // cross origin navigation in the main frame, a blank interstitial is first
+ // created which in turn creates the LoginView. Otherwise, a LoginView is
+ // directly in this callback. In both cases, the response will be sent to
meacer 2016/06/16 01:12:15 directly -> created directly
asanka 2016/06/16 16:25:47 Done.
+ // LoginHandler, which then routes it to the net::URLRequest on the I/O
+ // thread.
+ static void LoginDialogCallback(const GURL& request_url,
+ net::AuthChallengeInfo* auth_info,
+ LoginHandler* handler,
+ bool is_main_frame);
+
// True if we've handled auth (SetAuth or CancelAuth has been called).
bool handled_auth_;
mutable base::Lock handled_auth_lock_;
@@ -180,8 +224,10 @@ class LoginHandler : public content::ResourceDispatcherHostLoginDelegate,
// The HttpNetworkSession |request_| is associated with.
const net::HttpNetworkSession* http_network_session_;
- // The PasswordForm sent to the PasswordManager. This is so we can refer to it
- // when later notifying the password manager if the credentials were accepted
+ // The PasswordForm sent to the PasswordManager. This is so we can refer to
vabr (Chromium) 2016/06/15 08:50:06 nit: Seems like these two lines could have stayed
asanka 2016/06/16 16:25:47 Reformatted.
+ // it
+ // when later notifying the password manager if the credentials were
+ // accepted
// or rejected.
// This should only be accessed on the UI loop.
autofill::PasswordForm password_form_;
@@ -256,8 +302,4 @@ class AuthSuppliedLoginNotificationDetails : public LoginNotificationDetails {
LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info,
net::URLRequest* request);
-// Get the signon_realm under which the identity should be saved.
-std::string GetSignonRealm(const GURL& url,
- const net::AuthChallengeInfo& auth_info);
-
#endif // CHROME_BROWSER_UI_LOGIN_LOGIN_HANDLER_H_
« no previous file with comments | « no previous file | chrome/browser/ui/login/login_handler.cc » ('j') | chrome/browser/ui/login/login_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698