| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 replacements.push_back( | 109 replacements.push_back( |
| 110 url_formatter::FormatUrlForSecurityDisplay(form_origin_url)); | 110 url_formatter::FormatUrlForSecurityDisplay(form_origin_url)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 if (is_smartlock_branding_enabled) { | 113 if (is_smartlock_branding_enabled) { |
| 114 // "Google Smart Lock" should be a hyperlink. | 114 // "Google Smart Lock" should be a hyperlink. |
| 115 base::string16 title_link = | 115 base::string16 title_link = |
| 116 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); | 116 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); |
| 117 replacements.insert(replacements.begin(), title_link); | 117 replacements.insert(replacements.begin(), title_link); |
| 118 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); | 118 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); |
| 119 *title_link_range = | 119 if (!offsets.empty()) { |
| 120 gfx::Range(offsets[0], offsets[0] + title_link.length()); | 120 // |offsets| can be empty when the localised string associated with |
| 121 // |title_id| could not be found. While this situation is an error, it |
| 122 // needs to be handled gracefully, see http://crbug.com/658902#c18. |
| 123 *title_link_range = |
| 124 gfx::Range(offsets[0], offsets[0] + title_link.length()); |
| 125 } |
| 121 } else { | 126 } else { |
| 122 replacements.insert( | 127 replacements.insert( |
| 123 replacements.begin(), | 128 replacements.begin(), |
| 124 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_TITLE_BRAND)); | 129 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_TITLE_BRAND)); |
| 125 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); | 130 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); |
| 126 } | 131 } |
| 127 } | 132 } |
| 128 | 133 |
| 129 void GetManagePasswordsDialogTitleText(const GURL& user_visible_url, | 134 void GetManagePasswordsDialogTitleText(const GURL& user_visible_url, |
| 130 const GURL& password_origin_url, | 135 const GURL& password_origin_url, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 : form.username_value; | 187 : form.username_value; |
| 183 } | 188 } |
| 184 | 189 |
| 185 bool IsSyncingAutosignSetting(Profile* profile) { | 190 bool IsSyncingAutosignSetting(Profile* profile) { |
| 186 const browser_sync::ProfileSyncService* sync_service = | 191 const browser_sync::ProfileSyncService* sync_service = |
| 187 ProfileSyncServiceFactory::GetForProfile(profile); | 192 ProfileSyncServiceFactory::GetForProfile(profile); |
| 188 return (sync_service && sync_service->IsFirstSetupComplete() && | 193 return (sync_service && sync_service->IsFirstSetupComplete() && |
| 189 sync_service->IsSyncActive() && | 194 sync_service->IsSyncActive() && |
| 190 sync_service->GetActiveDataTypes().Has(syncer::PRIORITY_PREFERENCES)); | 195 sync_service->GetActiveDataTypes().Has(syncer::PRIORITY_PREFERENCES)); |
| 191 } | 196 } |
| OLD | NEW |