Chromium Code Reviews| Index: chrome/browser/ui/webui/options/password_manager_handler.cc |
| diff --git a/chrome/browser/ui/webui/options/password_manager_handler.cc b/chrome/browser/ui/webui/options/password_manager_handler.cc |
| index 43198c1ba3b0cc34ff268e69cf3e08e678ef6a57..1c04fd9f2f2347f5864c32975d05a52f71c3f561 100644 |
| --- a/chrome/browser/ui/webui/options/password_manager_handler.cc |
| +++ b/chrome/browser/ui/webui/options/password_manager_handler.cc |
| @@ -25,12 +25,14 @@ |
| #include "components/password_manager/core/browser/affiliation_utils.h" |
| #include "components/password_manager/core/browser/password_bubble_experiment.h" |
| #include "components/password_manager/core/common/experiments.h" |
| +#include "components/url_formatter/url_formatter.h" |
| #include "content/public/browser/notification_details.h" |
| #include "content/public/browser/notification_source.h" |
| #include "content/public/browser/user_metrics.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_ui.h" |
| #include "content/public/common/content_switches.h" |
| +#include "content/public/common/origin_util.h" |
| #include "net/base/net_util.h" |
| #include "ui/base/l10n/l10n_util.h" |
| @@ -56,24 +58,17 @@ void PasswordManagerHandler::GetLocalizedValues( |
| DCHECK(localized_strings); |
| static const OptionsStringResource resources[] = { |
| - { "autoSigninTitle", |
| - IDS_PASSWORDS_AUTO_SIGNIN_TITLE }, |
| - { "autoSigninDescription", |
| - IDS_PASSWORDS_AUTO_SIGNIN_DESCRIPTION }, |
| - { "savedPasswordsTitle", |
| - IDS_PASSWORDS_SHOW_PASSWORDS_TAB_TITLE }, |
| - { "passwordExceptionsTitle", |
| - IDS_PASSWORDS_EXCEPTIONS_TAB_TITLE }, |
| - { "passwordSearchPlaceholder", |
| - IDS_PASSWORDS_PAGE_SEARCH_PASSWORDS }, |
| - { "passwordShowButton", |
| - IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON }, |
| - { "passwordHideButton", |
| - IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON }, |
| - { "passwordsNoPasswordsDescription", |
| - IDS_PASSWORDS_PAGE_VIEW_NO_PASSWORDS_DESCRIPTION }, |
| - { "passwordsNoExceptionsDescription", |
| - IDS_PASSWORDS_PAGE_VIEW_NO_EXCEPTIONS_DESCRIPTION }, |
| + {"autoSigninTitle", IDS_PASSWORDS_AUTO_SIGNIN_TITLE}, |
| + {"autoSigninDescription", IDS_PASSWORDS_AUTO_SIGNIN_DESCRIPTION}, |
| + {"savedPasswordsTitle", IDS_PASSWORDS_SHOW_PASSWORDS_TAB_TITLE}, |
| + {"passwordExceptionsTitle", IDS_PASSWORDS_EXCEPTIONS_TAB_TITLE}, |
| + {"passwordSearchPlaceholder", IDS_PASSWORDS_PAGE_SEARCH_PASSWORDS}, |
| + {"passwordShowButton", IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON}, |
| + {"passwordHideButton", IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON}, |
| + {"passwordsNoPasswordsDescription", |
| + IDS_PASSWORDS_PAGE_VIEW_NO_PASSWORDS_DESCRIPTION}, |
| + {"passwordsNoExceptionsDescription", |
| + IDS_PASSWORDS_PAGE_VIEW_NO_EXCEPTIONS_DESCRIPTION}, |
| }; |
| RegisterStrings(localized_strings, resources, arraysize(resources)); |
| @@ -81,9 +76,9 @@ void PasswordManagerHandler::GetLocalizedValues( |
| const ProfileSyncService* sync_service = |
| ProfileSyncServiceFactory::GetForProfile(GetProfile()); |
| int title_id = |
| - password_bubble_experiment::IsSmartLockBrandingEnabled(sync_service) ? |
| - IDS_PASSWORD_MANAGER_SMART_LOCK_FOR_PASSWORDS : |
| - IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE; |
| + password_bubble_experiment::IsSmartLockBrandingEnabled(sync_service) |
| + ? IDS_PASSWORD_MANAGER_SMART_LOCK_FOR_PASSWORDS |
| + : IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE; |
| RegisterTitle(localized_strings, "passwordsPage", title_id); |
| localized_strings->SetString("passwordManagerLearnMoreURL", |
| @@ -207,8 +202,13 @@ void PasswordManagerHandler::SetPasswordList( |
| base::string16 placeholder(base::ASCIIToUTF16(" ")); |
| for (size_t i = 0; i < password_list.size(); ++i) { |
| base::ListValue* entry = new base::ListValue(); |
| - entry->AppendString(password_manager::GetHumanReadableOrigin( |
| - *password_list[i], languages_)); |
| + entry->AppendString(url_formatter::FormatUrl( |
| + password_list[i]->origin, languages_, |
| + url_formatter::kFormatUrlOmitNothing, net::UnescapeRule::SPACES, |
| + nullptr, nullptr, nullptr)); |
| + entry->AppendString( |
| + password_manager::GetShownOrigin(password_list[i]->origin, languages_)); |
| + entry->AppendBoolean(content::IsOriginSecure(password_list[i]->origin)); |
| entry->AppendString(password_list[i]->username_value); |
| if (show_passwords) { |
| entry->AppendString(password_list[i]->password_value); |
| @@ -219,10 +219,11 @@ void PasswordManagerHandler::SetPasswordList( |
| } |
| const GURL& federation_url = password_list[i]->federation_url; |
| if (!federation_url.is_empty()) { |
| - entry->AppendString(l10n_util::GetStringFUTF16( |
| - IDS_PASSWORDS_VIA_FEDERATION, |
| - base::UTF8ToUTF16(federation_url.host()))); |
| + entry->AppendString( |
| + l10n_util::GetStringFUTF16(IDS_PASSWORDS_VIA_FEDERATION, |
| + base::UTF8ToUTF16(federation_url.host()))); |
| } |
| + |
| entries.Append(entry); |
| } |
| @@ -234,8 +235,17 @@ void PasswordManagerHandler::SetPasswordExceptionList( |
| const ScopedVector<autofill::PasswordForm>& password_exception_list) { |
| base::ListValue entries; |
| for (size_t i = 0; i < password_exception_list.size(); ++i) { |
| - entries.AppendString(password_manager::GetHumanReadableOrigin( |
| - *password_exception_list[i], languages_)); |
| + base::ListValue* entry = new base::ListValue(); |
|
Evan Stade
2015/10/05 18:59:41
it makes more sense for this to be a dictionary, s
kolos1
2015/10/06 18:52:33
Done.
|
| + entry->AppendString(url_formatter::FormatUrl( |
| + password_exception_list[i]->origin, languages_, |
| + url_formatter::kFormatUrlOmitNothing, net::UnescapeRule::SPACES, |
| + nullptr, nullptr, nullptr)); |
| + entry->AppendString(password_manager::GetShownOrigin( |
| + password_exception_list[i]->origin, languages_)); |
| + entry->AppendBoolean( |
| + content::IsOriginSecure(password_exception_list[i]->origin)); |
| + |
| + entries.Append(entry); |
|
Evan Stade
2015/10/05 18:59:41
this version of ListValue::Append is deprecated
kolos1
2015/10/06 18:52:33
Done.
|
| } |
| web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", |