Chromium Code Reviews| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 content::WebContents* web_contents = handler->GetWebContentsForLogin(); | 118 content::WebContents* web_contents = handler->GetWebContentsForLogin(); |
| 119 if (web_contents) { | 119 if (web_contents) { |
| 120 Profile* profile = | 120 Profile* profile = |
| 121 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 121 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 122 if (profile) | 122 if (profile) |
| 123 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); | 123 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); |
| 124 } | 124 } |
| 125 | 125 |
| 126 base::string16 authority = | 126 base::string16 authority = |
| 127 url_formatter::FormatUrlForSecurityDisplay(request_url, languages); | 127 url_formatter::FormatUrlForSecurityDisplay(request_url, languages); |
| 128 base::string16 explanation = | 128 base::string16 explanation; |
| 129 elided_realm.empty() | 129 if (auth_info->is_proxy) { |
| 130 ? l10n_util::GetStringFUTF16(IDS_LOGIN_DIALOG_DESCRIPTION_NO_REALM, | 130 explanation = elided_realm.empty() |
| 131 authority) | 131 ? l10n_util::GetStringFUTF16( |
| 132 : l10n_util::GetStringFUTF16(IDS_LOGIN_DIALOG_DESCRIPTION, authority, | 132 IDS_LOGIN_DIALOG_DESCRIPTION_PROXY_NO_REALM, authority) |
| 133 elided_realm); | 133 : l10n_util::GetStringFUTF16(IDS_LOGIN_DIALOG_DESCRIPTION_PROXY, |
| 134 authority, elided_realm); | |
|
asanka
2016/06/14 15:00:30
The |authority| here is based on the request URL,
| |
| 135 } else { | |
| 136 explanation = elided_realm.empty() | |
| 137 ? l10n_util::GetStringFUTF16(IDS_LOGIN_DIALOG_DESCRIPTION_NO_REALM, | |
| 138 authority) | |
| 139 : l10n_util::GetStringFUTF16(IDS_LOGIN_DIALOG_DESCRIPTION, authority, | |
| 140 elided_realm); | |
| 141 } | |
| 134 | 142 |
| 135 password_manager::PasswordManager* password_manager = | 143 password_manager::PasswordManager* password_manager = |
| 136 handler->GetPasswordManagerForLogin(); | 144 handler->GetPasswordManagerForLogin(); |
| 137 | 145 |
| 138 if (!password_manager) { | 146 if (!password_manager) { |
| 139 #if defined(ENABLE_EXTENSIONS) | 147 #if defined(ENABLE_EXTENSIONS) |
| 140 // A WebContents in a <webview> (a GuestView type) does not have a password | 148 // A WebContents in a <webview> (a GuestView type) does not have a password |
| 141 // manager, but still needs to be able to show login prompts. | 149 // manager, but still needs to be able to show login prompts. |
| 142 if (guest_view::GuestViewBase::FromWebContents(parent_contents)) { | 150 if (guest_view::GuestViewBase::FromWebContents(parent_contents)) { |
| 143 handler->BuildViewWithoutPasswordManager(explanation); | 151 handler->BuildViewWithoutPasswordManager(explanation); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 607 signon_realm = auth_info.challenger.ToString(); | 615 signon_realm = auth_info.challenger.ToString(); |
| 608 signon_realm.append("/"); | 616 signon_realm.append("/"); |
| 609 } else { | 617 } else { |
| 610 // Take scheme, host, and port from the url. | 618 // Take scheme, host, and port from the url. |
| 611 signon_realm = url.GetOrigin().spec(); | 619 signon_realm = url.GetOrigin().spec(); |
| 612 // This ends with a "/". | 620 // This ends with a "/". |
| 613 } | 621 } |
| 614 signon_realm.append(auth_info.realm); | 622 signon_realm.append(auth_info.realm); |
| 615 return signon_realm; | 623 return signon_realm; |
| 616 } | 624 } |
| OLD | NEW |