Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_view_utils.cc

Issue 2535183002: Revert of Handle empty string in GetSavePasswordDialogTitleTextAndLinkRange gracefully (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 if (!offsets.empty()) { 119 *title_link_range =
120 // |offsets| can be empty when the localised string associated with 120 gfx::Range(offsets[0], offsets[0] + title_link.length());
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 }
126 } else { 121 } else {
127 replacements.insert( 122 replacements.insert(
128 replacements.begin(), 123 replacements.begin(),
129 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_TITLE_BRAND)); 124 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_TITLE_BRAND));
130 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); 125 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets);
131 } 126 }
132 } 127 }
133 128
134 void GetManagePasswordsDialogTitleText(const GURL& user_visible_url, 129 void GetManagePasswordsDialogTitleText(const GURL& user_visible_url,
135 const GURL& password_origin_url, 130 const GURL& password_origin_url,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 : form.username_value; 182 : form.username_value;
188 } 183 }
189 184
190 bool IsSyncingAutosignSetting(Profile* profile) { 185 bool IsSyncingAutosignSetting(Profile* profile) {
191 const browser_sync::ProfileSyncService* sync_service = 186 const browser_sync::ProfileSyncService* sync_service =
192 ProfileSyncServiceFactory::GetForProfile(profile); 187 ProfileSyncServiceFactory::GetForProfile(profile);
193 return (sync_service && sync_service->IsFirstSetupComplete() && 188 return (sync_service && sync_service->IsFirstSetupComplete() &&
194 sync_service->IsSyncActive() && 189 sync_service->IsSyncActive() &&
195 sync_service->GetActiveDataTypes().Has(syncer::PRIORITY_PREFERENCES)); 190 sync_service->GetActiveDataTypes().Has(syncer::PRIORITY_PREFERENCES));
196 } 191 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/passwords/manage_passwords_view_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698