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