| 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 #include "chrome/browser/ui/login/login_prompt.h" | 5 #include "chrome/browser/ui/login/login_prompt.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // net::URLRequest. | 62 // net::URLRequest. |
| 63 void ResetLoginHandlerForRequest(net::URLRequest* request) { | 63 void ResetLoginHandlerForRequest(net::URLRequest* request) { |
| 64 ResourceDispatcherHost::Get()->ClearLoginDelegateForRequest(request); | 64 ResourceDispatcherHost::Get()->ClearLoginDelegateForRequest(request); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Helper to create a PasswordForm for PasswordManager to start looking for | 67 // Helper to create a PasswordForm for PasswordManager to start looking for |
| 68 // saved credentials. | 68 // saved credentials. |
| 69 PasswordForm MakeInputForPasswordManager(const GURL& request_url, | 69 PasswordForm MakeInputForPasswordManager(const GURL& request_url, |
| 70 net::AuthChallengeInfo* auth_info) { | 70 net::AuthChallengeInfo* auth_info) { |
| 71 PasswordForm dialog_form; | 71 PasswordForm dialog_form; |
| 72 if (base::LowerCaseEqualsASCII(auth_info->scheme, "basic")) { | 72 if (base::LowerCaseEqualsASCII(auth_info->scheme, net::kBasicAuthScheme)) { |
| 73 dialog_form.scheme = PasswordForm::SCHEME_BASIC; | 73 dialog_form.scheme = PasswordForm::SCHEME_BASIC; |
| 74 } else if (base::LowerCaseEqualsASCII(auth_info->scheme, "digest")) { | 74 } else if (base::LowerCaseEqualsASCII(auth_info->scheme, |
| 75 net::kDigestAuthScheme)) { |
| 75 dialog_form.scheme = PasswordForm::SCHEME_DIGEST; | 76 dialog_form.scheme = PasswordForm::SCHEME_DIGEST; |
| 76 } else { | 77 } else { |
| 77 dialog_form.scheme = PasswordForm::SCHEME_OTHER; | 78 dialog_form.scheme = PasswordForm::SCHEME_OTHER; |
| 78 } | 79 } |
| 79 std::string host_and_port(auth_info->challenger.ToString()); | 80 std::string host_and_port(auth_info->challenger.ToString()); |
| 80 if (auth_info->is_proxy) { | 81 if (auth_info->is_proxy) { |
| 81 std::string origin = host_and_port; | 82 std::string origin = host_and_port; |
| 82 // We don't expect this to already start with http:// or https://. | 83 // We don't expect this to already start with http:// or https://. |
| 83 DCHECK(origin.find("http://") != 0 && origin.find("https://") != 0); | 84 DCHECK(origin.find("http://") != 0 && origin.find("https://") != 0); |
| 84 origin = std::string("http://") + origin; | 85 origin = std::string("http://") + origin; |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 signon_realm = auth_info.challenger.ToString(); | 621 signon_realm = auth_info.challenger.ToString(); |
| 621 signon_realm.append("/"); | 622 signon_realm.append("/"); |
| 622 } else { | 623 } else { |
| 623 // Take scheme, host, and port from the url. | 624 // Take scheme, host, and port from the url. |
| 624 signon_realm = url.GetOrigin().spec(); | 625 signon_realm = url.GetOrigin().spec(); |
| 625 // This ends with a "/". | 626 // This ends with a "/". |
| 626 } | 627 } |
| 627 signon_realm.append(auth_info.realm); | 628 signon_realm.append(auth_info.realm); |
| 628 return signon_realm; | 629 return signon_realm; |
| 629 } | 630 } |
| OLD | NEW |