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_handler.h" | 5 #include "chrome/browser/ui/login/login_handler.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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 16 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
17 #include "chrome/browser/prerender/prerender_contents.h" | 17 #include "chrome/browser/prerender/prerender_contents.h" |
18 #include "chrome/browser/profiles/profile.h" | |
19 #include "chrome/browser/tab_contents/tab_util.h" | 18 #include "chrome/browser/tab_contents/tab_util.h" |
20 #include "chrome/browser/ui/login/login_interstitial_delegate.h" | 19 #include "chrome/browser/ui/login/login_interstitial_delegate.h" |
21 #include "chrome/common/pref_names.h" | |
22 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
23 #include "components/password_manager/core/browser/browser_save_password_progres
s_logger.h" | 21 #include "components/password_manager/core/browser/browser_save_password_progres
s_logger.h" |
24 #include "components/password_manager/core/browser/log_manager.h" | 22 #include "components/password_manager/core/browser/log_manager.h" |
25 #include "components/password_manager/core/browser/password_manager.h" | 23 #include "components/password_manager/core/browser/password_manager.h" |
26 #include "components/prefs/pref_service.h" | |
27 #include "components/strings/grit/components_strings.h" | 24 #include "components/strings/grit/components_strings.h" |
28 #include "components/url_formatter/elide_url.h" | 25 #include "components/url_formatter/elide_url.h" |
29 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
30 #include "content/public/browser/notification_registrar.h" | 27 #include "content/public/browser/notification_registrar.h" |
31 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
32 #include "content/public/browser/render_frame_host.h" | 29 #include "content/public/browser/render_frame_host.h" |
33 #include "content/public/browser/resource_dispatcher_host.h" | 30 #include "content/public/browser/resource_dispatcher_host.h" |
34 #include "content/public/browser/resource_request_info.h" | 31 #include "content/public/browser/resource_request_info.h" |
35 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
36 #include "content/public/common/origin_util.h" | 33 #include "content/public/common/origin_util.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 WebContents* parent_contents = handler->GetWebContentsForLogin(); | 103 WebContents* parent_contents = handler->GetWebContentsForLogin(); |
107 if (!parent_contents) | 104 if (!parent_contents) |
108 return; | 105 return; |
109 prerender::PrerenderContents* prerender_contents = | 106 prerender::PrerenderContents* prerender_contents = |
110 prerender::PrerenderContents::FromWebContents(parent_contents); | 107 prerender::PrerenderContents::FromWebContents(parent_contents); |
111 if (prerender_contents) { | 108 if (prerender_contents) { |
112 prerender_contents->Destroy(prerender::FINAL_STATUS_AUTH_NEEDED); | 109 prerender_contents->Destroy(prerender::FINAL_STATUS_AUTH_NEEDED); |
113 return; | 110 return; |
114 } | 111 } |
115 | 112 |
116 std::string languages; | |
117 content::WebContents* web_contents = handler->GetWebContentsForLogin(); | |
118 if (web_contents) { | |
119 Profile* profile = | |
120 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | |
121 if (profile) | |
122 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); | |
123 } | |
124 | |
125 base::string16 authority = l10n_util::GetStringFUTF16( | 113 base::string16 authority = l10n_util::GetStringFUTF16( |
126 auth_info->is_proxy ? IDS_LOGIN_DIALOG_PROXY_AUTHORITY | 114 auth_info->is_proxy ? IDS_LOGIN_DIALOG_PROXY_AUTHORITY |
127 : IDS_LOGIN_DIALOG_AUTHORITY, | 115 : IDS_LOGIN_DIALOG_AUTHORITY, |
128 url_formatter::FormatUrlForSecurityDisplay(request_url, languages)); | 116 url_formatter::FormatUrlForSecurityDisplay(request_url)); |
129 base::string16 explanation; | 117 base::string16 explanation; |
130 if (!content::IsOriginSecure(request_url)) { | 118 if (!content::IsOriginSecure(request_url)) { |
131 explanation = | 119 explanation = |
132 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT); | 120 l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_NON_SECURE_TRANSPORT); |
133 } | 121 } |
134 | 122 |
135 password_manager::PasswordManager* password_manager = | 123 password_manager::PasswordManager* password_manager = |
136 handler->GetPasswordManagerForLogin(); | 124 handler->GetPasswordManagerForLogin(); |
137 | 125 |
138 if (!password_manager) { | 126 if (!password_manager) { |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 signon_realm = auth_info.challenger.ToString(); | 597 signon_realm = auth_info.challenger.ToString(); |
610 signon_realm.append("/"); | 598 signon_realm.append("/"); |
611 } else { | 599 } else { |
612 // Take scheme, host, and port from the url. | 600 // Take scheme, host, and port from the url. |
613 signon_realm = url.GetOrigin().spec(); | 601 signon_realm = url.GetOrigin().spec(); |
614 // This ends with a "/". | 602 // This ends with a "/". |
615 } | 603 } |
616 signon_realm.append(auth_info.realm); | 604 signon_realm.append(auth_info.realm); |
617 return signon_realm; | 605 return signon_realm; |
618 } | 606 } |
OLD | NEW |