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

Side by Side Diff: components/browsing_data/core/browsing_data_utils.cc

Issue 2828083003: Show autofill sync status in CBD (Closed)
Patch Set: fix history test Created 3 years, 7 months 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/browsing_data/core/browsing_data_utils.h" 5 #include "components/browsing_data/core/browsing_data_utils.h"
6 6
7 #include "base/metrics/user_metrics.h" 7 #include "base/metrics/user_metrics.h"
8 #include "components/browsing_data/core/counters/autofill_counter.h" 8 #include "components/browsing_data/core/counters/autofill_counter.h"
9 #include "components/browsing_data/core/counters/history_counter.h" 9 #include "components/browsing_data/core/counters/history_counter.h"
10 #include "components/browsing_data/core/counters/passwords_counter.h" 10 #include "components/browsing_data/core/counters/passwords_counter.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 break; 138 break;
139 case 2: 139 case 2:
140 displayed_strings.push_back(l10n_util::GetPluralStringFUTF16( 140 displayed_strings.push_back(l10n_util::GetPluralStringFUTF16(
141 IDS_DEL_AUTOFILL_COUNTER_SUGGESTIONS_SHORT, num_suggestions)); 141 IDS_DEL_AUTOFILL_COUNTER_SUGGESTIONS_SHORT, num_suggestions));
142 break; 142 break;
143 default: 143 default:
144 NOTREACHED(); 144 NOTREACHED();
145 } 145 }
146 } 146 }
147 147
148 bool synced = autofill_result->autofill_sync_enabled();
149
148 // Construct the resulting string from the sections in |displayed_strings|. 150 // Construct the resulting string from the sections in |displayed_strings|.
149 switch (displayed_strings.size()) { 151 switch (displayed_strings.size()) {
150 case 0: 152 case 0:
151 text = l10n_util::GetStringUTF16(IDS_DEL_AUTOFILL_COUNTER_EMPTY); 153 text = l10n_util::GetStringUTF16(IDS_DEL_AUTOFILL_COUNTER_EMPTY);
152 break; 154 break;
153 case 1: 155 case 1:
154 text = displayed_strings[0]; 156 text = synced ? l10n_util::GetStringFUTF16(
157 IDS_DEL_AUTOFILL_COUNTER_ONE_TYPE_SYNCED,
158 displayed_strings[0])
159 : displayed_strings[0];
155 break; 160 break;
156 case 2: 161 case 2:
157 text = l10n_util::GetStringFUTF16(IDS_DEL_AUTOFILL_COUNTER_TWO_TYPES, 162 text = l10n_util::GetStringFUTF16(
158 displayed_strings[0], 163 synced ? IDS_DEL_AUTOFILL_COUNTER_TWO_TYPES_SYNCED
159 displayed_strings[1]); 164 : IDS_DEL_AUTOFILL_COUNTER_TWO_TYPES,
165 displayed_strings[0], displayed_strings[1]);
160 break; 166 break;
161 case 3: 167 case 3:
162 text = l10n_util::GetStringFUTF16( 168 text = l10n_util::GetStringFUTF16(
163 IDS_DEL_AUTOFILL_COUNTER_THREE_TYPES, displayed_strings[0], 169 synced ? IDS_DEL_AUTOFILL_COUNTER_THREE_TYPES_SYNCED
164 displayed_strings[1], displayed_strings[2]); 170 : IDS_DEL_AUTOFILL_COUNTER_THREE_TYPES,
171 displayed_strings[0], displayed_strings[1], displayed_strings[2]);
165 break; 172 break;
166 default: 173 default:
167 NOTREACHED(); 174 NOTREACHED();
168 } 175 }
169 } 176 }
170 177
171 return text; 178 return text;
172 } 179 }
173 180
174 const char* GetTimePeriodPreferenceName( 181 const char* GetTimePeriodPreferenceName(
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 prefs->GetBoolean(prefs::kDeleteCache)); 243 prefs->GetBoolean(prefs::kDeleteCache));
237 prefs->SetBoolean(prefs::kDeleteCookiesBasic, 244 prefs->SetBoolean(prefs::kDeleteCookiesBasic,
238 prefs->GetBoolean(prefs::kDeleteCookies)); 245 prefs->GetBoolean(prefs::kDeleteCookies));
239 prefs->SetInteger(prefs::kDeleteTimePeriodBasic, 246 prefs->SetInteger(prefs::kDeleteTimePeriodBasic,
240 prefs->GetInteger(prefs::kDeleteTimePeriod)); 247 prefs->GetInteger(prefs::kDeleteTimePeriod));
241 prefs->SetBoolean(prefs::kPreferencesMigratedToBasic, true); 248 prefs->SetBoolean(prefs::kPreferencesMigratedToBasic, true);
242 } 249 }
243 } 250 }
244 251
245 } // namespace browsing_data 252 } // namespace browsing_data
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698