| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 void GetAccountChooserDialogTitleTextAndLinkRange( | 121 void GetAccountChooserDialogTitleTextAndLinkRange( |
| 122 bool is_smartlock_branding_enabled, | 122 bool is_smartlock_branding_enabled, |
| 123 base::string16* title, | 123 base::string16* title, |
| 124 gfx::Range* title_link_range) { | 124 gfx::Range* title_link_range) { |
| 125 GetBrandedTextAndLinkRange(is_smartlock_branding_enabled, | 125 GetBrandedTextAndLinkRange(is_smartlock_branding_enabled, |
| 126 IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_TITLE, | 126 IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_TITLE, |
| 127 IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_TITLE, | 127 IDS_PASSWORD_MANAGER_ACCOUNT_CHOOSER_TITLE, |
| 128 title, title_link_range); | 128 title, title_link_range); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void GetAutoSigninPromptFirstRunExperienceExplanation( | |
| 132 bool is_smartlock_branding_enabled, | |
| 133 base::string16* explanation, | |
| 134 gfx::Range* explanation_link_range) { | |
| 135 GetBrandedTextAndLinkRange( | |
| 136 is_smartlock_branding_enabled, | |
| 137 IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_SMART_LOCK_WELCOME, | |
| 138 IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_DEFAULT_WELCOME, | |
| 139 explanation, explanation_link_range); | |
| 140 } | |
| 141 | |
| 142 void GetBrandedTextAndLinkRange(bool is_smartlock_branding_enabled, | 131 void GetBrandedTextAndLinkRange(bool is_smartlock_branding_enabled, |
| 143 int smartlock_string_id, | 132 int smartlock_string_id, |
| 144 int default_string_id, | 133 int default_string_id, |
| 145 base::string16* out_string, | 134 base::string16* out_string, |
| 146 gfx::Range* link_range) { | 135 gfx::Range* link_range) { |
| 147 if (is_smartlock_branding_enabled) { | 136 if (is_smartlock_branding_enabled) { |
| 148 size_t offset; | 137 size_t offset; |
| 149 base::string16 brand_name = | 138 base::string16 brand_name = |
| 150 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); | 139 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); |
| 151 *out_string = l10n_util::GetStringFUTF16(smartlock_string_id, brand_name, | 140 *out_string = l10n_util::GetStringFUTF16(smartlock_string_id, brand_name, |
| 152 &offset); | 141 &offset); |
| 153 *link_range = gfx::Range(offset, offset + brand_name.length()); | 142 *link_range = gfx::Range(offset, offset + brand_name.length()); |
| 154 } else { | 143 } else { |
| 155 *out_string = l10n_util::GetStringFUTF16( | 144 *out_string = l10n_util::GetStringFUTF16( |
| 156 default_string_id, | 145 default_string_id, |
| 157 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_TITLE_BRAND)); | 146 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_TITLE_BRAND)); |
| 158 *link_range = gfx::Range(); | 147 *link_range = gfx::Range(); |
| 159 } | 148 } |
| 160 } | 149 } |
| 161 | 150 |
| 162 base::string16 GetDisplayUsername(const autofill::PasswordForm& form) { | 151 base::string16 GetDisplayUsername(const autofill::PasswordForm& form) { |
| 163 return form.username_value.empty() | 152 return form.username_value.empty() |
| 164 ? l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_EMPTY_LOGIN) | 153 ? l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_EMPTY_LOGIN) |
| 165 : form.username_value; | 154 : form.username_value; |
| 166 } | 155 } |
| OLD | NEW |