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

Side by Side Diff: chrome/browser/sync/sync_ui_util.cc

Issue 5159001: Rest of the autofill work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch uploaded to debug why try servers have problem applying this patch. Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/sync/sync_ui_util.h" 5 #include "chrome/browser/sync/sync_ui_util.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/i18n/number_formatting.h" 8 #include "base/i18n/number_formatting.h"
9 #include "base/i18n/time_formatting.h"
10 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/sync/profile_sync_service.h" 13 #include "chrome/browser/sync/profile_sync_service.h"
12 #include "chrome/browser/ui/options/options_window.h" 14 #include "chrome/browser/ui/options/options_window.h"
13 #include "chrome/common/net/gaia/google_service_auth_error.h" 15 #include "chrome/common/net/gaia/google_service_auth_error.h"
14 #include "grit/chromium_strings.h" 16 #include "grit/chromium_strings.h"
15 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
16 18
17 typedef GoogleServiceAuthError AuthError; 19 typedef GoogleServiceAuthError AuthError;
18 20
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 210 }
209 211
210 void AddIntSyncDetail(ListValue* details, const std::string& stat_name, 212 void AddIntSyncDetail(ListValue* details, const std::string& stat_name,
211 int64 stat_value) { 213 int64 stat_value) {
212 DictionaryValue* val = new DictionaryValue; 214 DictionaryValue* val = new DictionaryValue;
213 val->SetString("stat_name", stat_name); 215 val->SetString("stat_name", stat_name);
214 val->SetString("stat_value", base::FormatNumber(stat_value)); 216 val->SetString("stat_value", base::FormatNumber(stat_value));
215 details->Append(val); 217 details->Append(val);
216 } 218 }
217 219
220 std::wstring ConstructTime(int64 time_in_int) {
221 base::Time time = base::Time::FromInternalValue(time_in_int);
222
223 // If time is null the format function returns a time in 1969.
224 if (time.is_null())
225 return std::wstring();
226 return base::TimeFormatFriendlyDateAndTime(time);
227 }
228
218 std::string MakeSyncAuthErrorText( 229 std::string MakeSyncAuthErrorText(
219 const GoogleServiceAuthError::State& state) { 230 const GoogleServiceAuthError::State& state) {
220 switch (state) { 231 switch (state) {
221 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: 232 case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS:
222 case GoogleServiceAuthError::ACCOUNT_DELETED: 233 case GoogleServiceAuthError::ACCOUNT_DELETED:
223 case GoogleServiceAuthError::ACCOUNT_DISABLED: 234 case GoogleServiceAuthError::ACCOUNT_DISABLED:
224 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: 235 case GoogleServiceAuthError::SERVICE_UNAVAILABLE:
225 return "INVALID_GAIA_CREDENTIALS"; 236 return "INVALID_GAIA_CREDENTIALS";
226 case GoogleServiceAuthError::USER_NOT_SIGNED_UP: 237 case GoogleServiceAuthError::USER_NOT_SIGNED_UP:
227 return "USER_NOT_SIGNED_UP"; 238 return "USER_NOT_SIGNED_UP";
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 service->backend()->GetModelSafeRoutingInfo(&routes); 327 service->backend()->GetModelSafeRoutingInfo(&routes);
317 ListValue* routing_info = new ListValue(); 328 ListValue* routing_info = new ListValue();
318 strings->Set("routing_info", routing_info); 329 strings->Set("routing_info", routing_info);
319 browser_sync::ModelSafeRoutingInfo::const_iterator it = routes.begin(); 330 browser_sync::ModelSafeRoutingInfo::const_iterator it = routes.begin();
320 for (; it != routes.end(); ++it) { 331 for (; it != routes.end(); ++it) {
321 DictionaryValue* val = new DictionaryValue; 332 DictionaryValue* val = new DictionaryValue;
322 val->SetString("model_type", ModelTypeToString(it->first)); 333 val->SetString("model_type", ModelTypeToString(it->first));
323 val->SetString("group", ModelSafeGroupToString(it->second)); 334 val->SetString("group", ModelSafeGroupToString(it->second));
324 routing_info->Append(val); 335 routing_info->Append(val);
325 } 336 }
337
338 sync_ui_util::AddBoolSyncDetail(details,
339 "Autofill Migrated",
340 service->backend()->GetAutofillMigrationState() ==
341 syncable::MIGRATED);
342 syncable::AutofillMigrationDebugInfo info =
343 service->backend()->GetAutofillMigrationDebugInfo();
344
345 sync_ui_util::AddIntSyncDetail(details,
346 "Bookmarks created during migration",
347 info.bookmarks_added_during_migration);
348 sync_ui_util::AddIntSyncDetail(details,
349 "Autofill entries created during migration",
350 info.autofill_entries_added_during_migration);
351 sync_ui_util::AddIntSyncDetail(details,
352 "Autofill Profiles created during migration",
353 info.autofill_profile_added_during_migration);
354
355 DictionaryValue* val = new DictionaryValue;
356 val->SetString("stat_name", "Autofill Migration Time");
357 val->SetString("stat_value", ConstructTime(info.autofill_migration_time));
358 details->Append(val);
326 } 359 }
327 } 360 }
328 } 361 }
329 362
330 } // namespace sync_ui_util 363 } // namespace sync_ui_util
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/sync/syncable/autofill_migration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698