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 #include "chrome/browser/sync/profile_sync_service_factory.h" | 16 #include "chrome/browser/sync/profile_sync_service_factory.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
19 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
20 #include "components/autofill/core/common/password_form.h" | 20 #include "components/autofill/core/common/password_form.h" |
21 #include "components/browser_sync/browser/profile_sync_service.h" | 21 #include "components/browser_sync/browser/profile_sync_service.h" |
22 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 22 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
| 23 #include "components/password_manager/core/browser/password_manager_constants.h" |
23 #include "components/password_manager/core/browser/password_ui_utils.h" | 24 #include "components/password_manager/core/browser/password_ui_utils.h" |
24 #include "components/password_manager/core/common/experiments.h" | 25 #include "components/password_manager/core/common/experiments.h" |
25 #include "components/url_formatter/url_formatter.h" | 26 #include "components/url_formatter/url_formatter.h" |
26 #include "content/public/browser/notification_details.h" | 27 #include "content/public/browser/notification_details.h" |
27 #include "content/public/browser/notification_source.h" | 28 #include "content/public/browser/notification_source.h" |
28 #include "content/public/browser/user_metrics.h" | 29 #include "content/public/browser/user_metrics.h" |
29 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
30 #include "content/public/browser/web_ui.h" | 31 #include "content/public/browser/web_ui.h" |
31 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
32 #include "content/public/common/origin_util.h" | 33 #include "content/public/common/origin_util.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 const ProfileSyncService* sync_service = | 105 const ProfileSyncService* sync_service = |
105 ProfileSyncServiceFactory::GetForProfile(GetProfile()); | 106 ProfileSyncServiceFactory::GetForProfile(GetProfile()); |
106 int title_id = | 107 int title_id = |
107 password_bubble_experiment::IsSmartLockBrandingEnabled(sync_service) | 108 password_bubble_experiment::IsSmartLockBrandingEnabled(sync_service) |
108 ? IDS_PASSWORD_MANAGER_SMART_LOCK_FOR_PASSWORDS | 109 ? IDS_PASSWORD_MANAGER_SMART_LOCK_FOR_PASSWORDS |
109 : IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE; | 110 : IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE; |
110 RegisterTitle(localized_strings, "passwordsPage", title_id); | 111 RegisterTitle(localized_strings, "passwordsPage", title_id); |
111 | 112 |
112 localized_strings->SetString("passwordManagerLearnMoreURL", | 113 localized_strings->SetString("passwordManagerLearnMoreURL", |
113 chrome::kPasswordManagerLearnMoreURL); | 114 chrome::kPasswordManagerLearnMoreURL); |
114 localized_strings->SetString("passwordsManagePasswordsLink", | 115 localized_strings->SetString( |
115 chrome::kPasswordManagerAccountDashboardURL); | 116 "passwordsManagePasswordsLink", |
| 117 password_manager::kPasswordManagerAccountDashboardURL); |
116 | 118 |
117 std::string management_hostname = | 119 std::string management_hostname = |
118 GURL(chrome::kPasswordManagerAccountDashboardURL).host(); | 120 GURL(password_manager::kPasswordManagerAccountDashboardURL).host(); |
119 base::string16 link_text = base::UTF8ToUTF16(management_hostname); | 121 base::string16 link_text = base::UTF8ToUTF16(management_hostname); |
120 size_t offset; | 122 size_t offset; |
121 base::string16 full_text = l10n_util::GetStringFUTF16( | 123 base::string16 full_text = l10n_util::GetStringFUTF16( |
122 IDS_MANAGE_PASSWORDS_REMOTE_TEXT, link_text, &offset); | 124 IDS_MANAGE_PASSWORDS_REMOTE_TEXT, link_text, &offset); |
123 | 125 |
124 localized_strings->SetString("passwordsManagePasswordsBeforeLinkText", | 126 localized_strings->SetString("passwordsManagePasswordsBeforeLinkText", |
125 full_text.substr(0, offset)); | 127 full_text.substr(0, offset)); |
126 localized_strings->SetString("passwordsManagePasswordsLinkText", | 128 localized_strings->SetString("passwordsManagePasswordsLinkText", |
127 full_text.substr(offset, | 129 full_text.substr(offset, |
128 link_text.size())); | 130 link_text.size())); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); | 259 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); |
258 CopyOriginInfoOfPasswordForm(*exception, languages_, entry.get()); | 260 CopyOriginInfoOfPasswordForm(*exception, languages_, entry.get()); |
259 entries.Append(entry.release()); | 261 entries.Append(entry.release()); |
260 } | 262 } |
261 | 263 |
262 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", | 264 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", |
263 entries); | 265 entries); |
264 } | 266 } |
265 | 267 |
266 } // namespace options | 268 } // namespace options |
OLD | NEW |