OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/passwords/manage_passwords_view_utils.h" | 5 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 // Check whether the registry controlled domains for user-visible URL (i.e. | 97 // Check whether the registry controlled domains for user-visible URL (i.e. |
98 // the one seen in the omnibox) and the password form post-submit navigation | 98 // the one seen in the omnibox) and the password form post-submit navigation |
99 // URL differs or not. | 99 // URL differs or not. |
100 if (!SameDomainOrHost(user_visible_url, form_origin_url)) { | 100 if (!SameDomainOrHost(user_visible_url, form_origin_url)) { |
101 title_id = dialog_type == PasswordTittleType::UPDATE_PASSWORD | 101 title_id = dialog_type == PasswordTittleType::UPDATE_PASSWORD |
102 ? IDS_UPDATE_PASSWORD_DIFFERENT_DOMAINS_TITLE | 102 ? IDS_UPDATE_PASSWORD_DIFFERENT_DOMAINS_TITLE |
103 : IDS_SAVE_PASSWORD_DIFFERENT_DOMAINS_TITLE; | 103 : IDS_SAVE_PASSWORD_DIFFERENT_DOMAINS_TITLE; |
104 // TODO(palmer): Look into passing real language prefs here, not "". | 104 // TODO(palmer): Look into passing real language prefs here, not "". |
105 // crbug.com/498069. | 105 // crbug.com/498069. |
106 replacements.push_back(url_formatter::FormatUrlForSecurityDisplay( | 106 replacements.push_back( |
107 form_origin_url, std::string())); | 107 url_formatter::FormatUrlForSecurityDisplay(form_origin_url)); |
108 } | 108 } |
109 | 109 |
110 if (is_smartlock_branding_enabled) { | 110 if (is_smartlock_branding_enabled) { |
111 // "Google Smart Lock" should be a hyperlink. | 111 // "Google Smart Lock" should be a hyperlink. |
112 base::string16 title_link = | 112 base::string16 title_link = |
113 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); | 113 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); |
114 replacements.insert(replacements.begin(), title_link); | 114 replacements.insert(replacements.begin(), title_link); |
115 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); | 115 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); |
116 *title_link_range = | 116 *title_link_range = |
117 gfx::Range(offsets[0], offsets[0] + title_link.length()); | 117 gfx::Range(offsets[0], offsets[0] + title_link.length()); |
118 } else { | 118 } else { |
119 replacements.insert( | 119 replacements.insert( |
120 replacements.begin(), | 120 replacements.begin(), |
121 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_TITLE_BRAND)); | 121 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_TITLE_BRAND)); |
122 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); | 122 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 void GetManagePasswordsDialogTitleText(const GURL& user_visible_url, | 126 void GetManagePasswordsDialogTitleText(const GURL& user_visible_url, |
127 const GURL& password_origin_url, | 127 const GURL& password_origin_url, |
128 base::string16* title) { | 128 base::string16* title) { |
129 DCHECK(!password_manager::IsValidAndroidFacetURI(password_origin_url.spec())); | 129 DCHECK(!password_manager::IsValidAndroidFacetURI(password_origin_url.spec())); |
130 // Check whether the registry controlled domains for user-visible URL | 130 // Check whether the registry controlled domains for user-visible URL |
131 // (i.e. the one seen in the omnibox) and the managed password origin URL | 131 // (i.e. the one seen in the omnibox) and the managed password origin URL |
132 // differ or not. | 132 // differ or not. |
133 if (!SameDomainOrHost(user_visible_url, password_origin_url)) { | 133 if (!SameDomainOrHost(user_visible_url, password_origin_url)) { |
134 // TODO(palmer): Look into passing real language prefs here, not "". | 134 base::string16 formatted_url = |
135 base::string16 formatted_url = url_formatter::FormatUrlForSecurityDisplay( | 135 url_formatter::FormatUrlForSecurityDisplay(password_origin_url); |
136 password_origin_url, std::string()); | |
137 *title = l10n_util::GetStringFUTF16( | 136 *title = l10n_util::GetStringFUTF16( |
138 IDS_MANAGE_PASSWORDS_TITLE_DIFFERENT_DOMAIN, formatted_url); | 137 IDS_MANAGE_PASSWORDS_TITLE_DIFFERENT_DOMAIN, formatted_url); |
139 } else { | 138 } else { |
140 *title = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_TITLE); | 139 *title = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_TITLE); |
141 } | 140 } |
142 } | 141 } |
143 | 142 |
144 void GetAccountChooserDialogTitleTextAndLinkRange( | 143 void GetAccountChooserDialogTitleTextAndLinkRange( |
145 bool is_smartlock_branding_enabled, | 144 bool is_smartlock_branding_enabled, |
146 bool many_accounts, | 145 bool many_accounts, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 : form.username_value; | 179 : form.username_value; |
181 } | 180 } |
182 | 181 |
183 bool IsSyncingAutosignSetting(Profile* profile) { | 182 bool IsSyncingAutosignSetting(Profile* profile) { |
184 const ProfileSyncService* sync_service = | 183 const ProfileSyncService* sync_service = |
185 ProfileSyncServiceFactory::GetForProfile(profile); | 184 ProfileSyncServiceFactory::GetForProfile(profile); |
186 return (sync_service && sync_service->IsFirstSetupComplete() && | 185 return (sync_service && sync_service->IsFirstSetupComplete() && |
187 sync_service->IsSyncActive() && | 186 sync_service->IsSyncActive() && |
188 sync_service->GetActiveDataTypes().Has(syncer::PRIORITY_PREFERENCES)); | 187 sync_service->GetActiveDataTypes().Has(syncer::PRIORITY_PREFERENCES)); |
189 } | 188 } |
OLD | NEW |