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 17 matching lines...) Expand all Loading... |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/notification_registrar.h" | 29 #include "content/public/browser/notification_registrar.h" |
30 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
31 #include "content/public/browser/render_frame_host.h" | 31 #include "content/public/browser/render_frame_host.h" |
32 #include "content/public/browser/resource_dispatcher_host.h" | 32 #include "content/public/browser/resource_dispatcher_host.h" |
33 #include "content/public/browser/resource_request_info.h" | 33 #include "content/public/browser/resource_request_info.h" |
34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
35 #include "net/base/auth.h" | 35 #include "net/base/auth.h" |
36 #include "net/base/load_flags.h" | 36 #include "net/base/load_flags.h" |
37 #include "net/base/net_util.h" | 37 #include "net/base/net_util.h" |
| 38 #include "net/http/http_auth_scheme.h" |
38 #include "net/http/http_transaction_factory.h" | 39 #include "net/http/http_transaction_factory.h" |
39 #include "net/url_request/url_request.h" | 40 #include "net/url_request/url_request.h" |
40 #include "net/url_request/url_request_context.h" | 41 #include "net/url_request/url_request_context.h" |
41 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
42 #include "ui/gfx/text_elider.h" | 43 #include "ui/gfx/text_elider.h" |
43 | 44 |
44 #if defined(ENABLE_EXTENSIONS) | 45 #if defined(ENABLE_EXTENSIONS) |
45 #include "components/guest_view/browser/guest_view_base.h" | 46 #include "components/guest_view/browser/guest_view_base.h" |
46 #endif | 47 #endif |
47 | 48 |
(...skipping 15 matching lines...) Expand all Loading... |
63 // net::URLRequest. | 64 // net::URLRequest. |
64 void ResetLoginHandlerForRequest(net::URLRequest* request) { | 65 void ResetLoginHandlerForRequest(net::URLRequest* request) { |
65 ResourceDispatcherHost::Get()->ClearLoginDelegateForRequest(request); | 66 ResourceDispatcherHost::Get()->ClearLoginDelegateForRequest(request); |
66 } | 67 } |
67 | 68 |
68 // Helper to create a PasswordForm for PasswordManager to start looking for | 69 // Helper to create a PasswordForm for PasswordManager to start looking for |
69 // saved credentials. | 70 // saved credentials. |
70 PasswordForm MakeInputForPasswordManager(const GURL& request_url, | 71 PasswordForm MakeInputForPasswordManager(const GURL& request_url, |
71 net::AuthChallengeInfo* auth_info) { | 72 net::AuthChallengeInfo* auth_info) { |
72 PasswordForm dialog_form; | 73 PasswordForm dialog_form; |
73 if (base::LowerCaseEqualsASCII(auth_info->scheme, "basic")) { | 74 if (base::LowerCaseEqualsASCII(auth_info->scheme, net::kBasicAuthScheme)) { |
74 dialog_form.scheme = PasswordForm::SCHEME_BASIC; | 75 dialog_form.scheme = PasswordForm::SCHEME_BASIC; |
75 } else if (base::LowerCaseEqualsASCII(auth_info->scheme, "digest")) { | 76 } else if (base::LowerCaseEqualsASCII(auth_info->scheme, |
| 77 net::kDigestAuthScheme)) { |
76 dialog_form.scheme = PasswordForm::SCHEME_DIGEST; | 78 dialog_form.scheme = PasswordForm::SCHEME_DIGEST; |
77 } else { | 79 } else { |
78 dialog_form.scheme = PasswordForm::SCHEME_OTHER; | 80 dialog_form.scheme = PasswordForm::SCHEME_OTHER; |
79 } | 81 } |
80 std::string host_and_port(auth_info->challenger.ToString()); | 82 std::string host_and_port(auth_info->challenger.ToString()); |
81 if (auth_info->is_proxy) { | 83 if (auth_info->is_proxy) { |
82 std::string origin = host_and_port; | 84 std::string origin = host_and_port; |
83 // We don't expect this to already start with http:// or https://. | 85 // We don't expect this to already start with http:// or https://. |
84 DCHECK(origin.find("http://") != 0 && origin.find("https://") != 0); | 86 DCHECK(origin.find("http://") != 0 && origin.find("https://") != 0); |
85 origin = std::string("http://") + origin; | 87 origin = std::string("http://") + origin; |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 signon_realm = auth_info.challenger.ToString(); | 617 signon_realm = auth_info.challenger.ToString(); |
616 signon_realm.append("/"); | 618 signon_realm.append("/"); |
617 } else { | 619 } else { |
618 // Take scheme, host, and port from the url. | 620 // Take scheme, host, and port from the url. |
619 signon_realm = url.GetOrigin().spec(); | 621 signon_realm = url.GetOrigin().spec(); |
620 // This ends with a "/". | 622 // This ends with a "/". |
621 } | 623 } |
622 signon_realm.append(auth_info.realm); | 624 signon_realm.append(auth_info.realm); |
623 return signon_realm; | 625 return signon_realm; |
624 } | 626 } |
OLD | NEW |