OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/webui/options/password_manager_handler.h" | 5 #include "chrome/browser/ui/webui/options/password_manager_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #if defined(OS_WIN) && defined(USE_ASH) | 16 #if defined(OS_WIN) && defined(USE_ASH) |
17 #include "chrome/browser/ui/ash/ash_util.h" | 17 #include "chrome/browser/ui/ash/ash_util.h" |
18 #endif | 18 #endif |
19 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" | 19 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" |
20 #include "chrome/browser/ui/passwords/password_bubble_experiment.h" | |
20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
21 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
22 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
23 #include "components/autofill/core/common/password_form.h" | 24 #include "components/autofill/core/common/password_form.h" |
24 #include "components/password_manager/core/common/experiments.h" | 25 #include "components/password_manager/core/common/experiments.h" |
25 #include "content/public/browser/notification_details.h" | 26 #include "content/public/browser/notification_details.h" |
26 #include "content/public/browser/notification_source.h" | 27 #include "content/public/browser/notification_source.h" |
27 #include "content/public/browser/user_metrics.h" | 28 #include "content/public/browser/user_metrics.h" |
28 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
29 #include "content/public/browser/web_ui.h" | 30 #include "content/public/browser/web_ui.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON }, | 68 IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON }, |
68 { "passwordHideButton", | 69 { "passwordHideButton", |
69 IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON }, | 70 IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON }, |
70 { "passwordsNoPasswordsDescription", | 71 { "passwordsNoPasswordsDescription", |
71 IDS_PASSWORDS_PAGE_VIEW_NO_PASSWORDS_DESCRIPTION }, | 72 IDS_PASSWORDS_PAGE_VIEW_NO_PASSWORDS_DESCRIPTION }, |
72 { "passwordsNoExceptionsDescription", | 73 { "passwordsNoExceptionsDescription", |
73 IDS_PASSWORDS_PAGE_VIEW_NO_EXCEPTIONS_DESCRIPTION }, | 74 IDS_PASSWORDS_PAGE_VIEW_NO_EXCEPTIONS_DESCRIPTION }, |
74 }; | 75 }; |
75 | 76 |
76 RegisterStrings(localized_strings, resources, arraysize(resources)); | 77 RegisterStrings(localized_strings, resources, arraysize(resources)); |
77 RegisterTitle(localized_strings, "passwordsPage", | 78 |
78 IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE); | 79 int title_id = IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE; |
Evan Stade
2015/05/15 18:55:02
nit: prefer ternary
Garrett Casto
2015/05/15 20:43:00
Done.
| |
80 if (password_bubble_experiment::IsSmartLockBrandingEnabled(GetProfile())) | |
81 title_id = IDS_PASSWORDS_EXCEPTIONS_SMART_LOCK_WINDOW_TITLE; | |
82 RegisterTitle(localized_strings, "passwordsPage", title_id); | |
79 | 83 |
80 localized_strings->SetString("passwordManagerLearnMoreURL", | 84 localized_strings->SetString("passwordManagerLearnMoreURL", |
81 chrome::kPasswordManagerLearnMoreURL); | 85 chrome::kPasswordManagerLearnMoreURL); |
82 localized_strings->SetString("passwordsManagePasswordsLink", | 86 localized_strings->SetString("passwordsManagePasswordsLink", |
83 chrome::kPasswordManagerAccountDashboardURL); | 87 chrome::kPasswordManagerAccountDashboardURL); |
84 | 88 |
85 std::vector<base::string16> pieces; | 89 std::string management_hostname = |
86 base::SplitStringDontTrim( | 90 GURL(chrome::kPasswordManagerAccountDashboardURL).host(); |
87 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_REMOTE_TEXT), | 91 base::string16 link_text = base::UTF8ToUTF16(management_hostname); |
88 '|', // separator | 92 size_t offset; |
89 &pieces); | 93 base::string16 full_text = l10n_util::GetStringFUTF16( |
90 DCHECK_EQ(3U, pieces.size()); | 94 IDS_MANAGE_PASSWORDS_REMOTE_TEXT, link_text, &offset); |
95 | |
91 localized_strings->SetString("passwordsManagePasswordsBeforeLinkText", | 96 localized_strings->SetString("passwordsManagePasswordsBeforeLinkText", |
92 pieces[0]); | 97 full_text.substr(0, offset)); |
93 localized_strings->SetString("passwordsManagePasswordsLinkText", pieces[1]); | 98 localized_strings->SetString("passwordsManagePasswordsLinkText", |
99 full_text.substr(offset, | |
100 offset + link_text.size())); | |
94 localized_strings->SetString("passwordsManagePasswordsAfterLinkText", | 101 localized_strings->SetString("passwordsManagePasswordsAfterLinkText", |
95 pieces[2]); | 102 full_text.substr(offset + link_text.size())); |
96 | 103 |
97 bool disable_show_passwords = false; | 104 bool disable_show_passwords = false; |
98 | 105 |
99 #if defined(OS_WIN) && defined(USE_ASH) | 106 #if defined(OS_WIN) && defined(USE_ASH) |
100 // We disable the ability to show passwords when running in Windows Metro | 107 // We disable the ability to show passwords when running in Windows Metro |
101 // interface. This is because we cannot pop native Win32 dialogs from the | 108 // interface. This is because we cannot pop native Win32 dialogs from the |
102 // Metro process. | 109 // Metro process. |
103 // TODO(wfh): Revisit this if Metro usage grows. | 110 // TODO(wfh): Revisit this if Metro usage grows. |
104 if (chrome::IsNativeWindowInAsh(GetNativeWindow())) | 111 if (chrome::IsNativeWindowInAsh(GetNativeWindow())) |
105 disable_show_passwords = true; | 112 disable_show_passwords = true; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 for (size_t i = 0; i < password_exception_list.size(); ++i) { | 228 for (size_t i = 0; i < password_exception_list.size(); ++i) { |
222 entries.AppendString( | 229 entries.AppendString( |
223 GetHumanReadableOrigin(*password_exception_list[i], languages_)); | 230 GetHumanReadableOrigin(*password_exception_list[i], languages_)); |
224 } | 231 } |
225 | 232 |
226 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", | 233 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", |
227 entries); | 234 entries); |
228 } | 235 } |
229 | 236 |
230 } // namespace options | 237 } // namespace options |
OLD | NEW |