OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webui/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/sync_setup_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 PrefService* pref_service = profile->GetPrefs(); | 181 PrefService* pref_service = profile->GetPrefs(); |
182 CHECK(pref_service); | 182 CHECK(pref_service); |
183 | 183 |
184 if (config.sync_everything != | 184 if (config.sync_everything != |
185 pref_service->GetBoolean(prefs::kSyncKeepEverythingSynced)) | 185 pref_service->GetBoolean(prefs::kSyncKeepEverythingSynced)) |
186 return true; | 186 return true; |
187 | 187 |
188 // Only check the data types that are explicitly listed on the sync | 188 // Only check the data types that are explicitly listed on the sync |
189 // preferences page. | 189 // preferences page. |
190 const syncable::ModelEnumSet types = config.data_types; | 190 const syncable::ModelTypeSet types = config.data_types; |
191 if (((types.Has(syncable::BOOKMARKS)) != | 191 if (((types.Has(syncable::BOOKMARKS)) != |
192 pref_service->GetBoolean(prefs::kSyncBookmarks)) || | 192 pref_service->GetBoolean(prefs::kSyncBookmarks)) || |
193 ((types.Has(syncable::PREFERENCES)) != | 193 ((types.Has(syncable::PREFERENCES)) != |
194 pref_service->GetBoolean(prefs::kSyncPreferences)) || | 194 pref_service->GetBoolean(prefs::kSyncPreferences)) || |
195 ((types.Has(syncable::THEMES)) != | 195 ((types.Has(syncable::THEMES)) != |
196 pref_service->GetBoolean(prefs::kSyncThemes)) || | 196 pref_service->GetBoolean(prefs::kSyncThemes)) || |
197 ((types.Has(syncable::PASSWORDS)) != | 197 ((types.Has(syncable::PASSWORDS)) != |
198 pref_service->GetBoolean(prefs::kSyncPasswords)) || | 198 pref_service->GetBoolean(prefs::kSyncPasswords)) || |
199 ((types.Has(syncable::AUTOFILL)) != | 199 ((types.Has(syncable::AUTOFILL)) != |
200 pref_service->GetBoolean(prefs::kSyncAutofill)) || | 200 pref_service->GetBoolean(prefs::kSyncAutofill)) || |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 | 565 |
566 // We do not do UMA logging during unit tests. | 566 // We do not do UMA logging during unit tests. |
567 if (web_ui_) { | 567 if (web_ui_) { |
568 Profile* profile = Profile::FromWebUI(web_ui_); | 568 Profile* profile = Profile::FromWebUI(web_ui_); |
569 if (HasConfigurationChanged(configuration, profile)) { | 569 if (HasConfigurationChanged(configuration, profile)) { |
570 UMA_HISTOGRAM_BOOLEAN("Sync.SyncEverything", | 570 UMA_HISTOGRAM_BOOLEAN("Sync.SyncEverything", |
571 configuration.sync_everything); | 571 configuration.sync_everything); |
572 if (!configuration.sync_everything) { | 572 if (!configuration.sync_everything) { |
573 // Only log the data types that are explicitly listed on the sync | 573 // Only log the data types that are explicitly listed on the sync |
574 // preferences page. | 574 // preferences page. |
575 const syncable::ModelEnumSet types = configuration.data_types; | 575 const syncable::ModelTypeSet types = configuration.data_types; |
576 if (types.Has(syncable::BOOKMARKS)) | 576 if (types.Has(syncable::BOOKMARKS)) |
577 UMA_HISTOGRAM_ENUMERATION( | 577 UMA_HISTOGRAM_ENUMERATION( |
578 "Sync.CustomSync", BOOKMARKS, SELECTABLE_DATATYPE_COUNT + 1); | 578 "Sync.CustomSync", BOOKMARKS, SELECTABLE_DATATYPE_COUNT + 1); |
579 if (types.Has(syncable::PREFERENCES)) | 579 if (types.Has(syncable::PREFERENCES)) |
580 UMA_HISTOGRAM_ENUMERATION( | 580 UMA_HISTOGRAM_ENUMERATION( |
581 "Sync.CustomSync", PREFERENCES, SELECTABLE_DATATYPE_COUNT + 1); | 581 "Sync.CustomSync", PREFERENCES, SELECTABLE_DATATYPE_COUNT + 1); |
582 if (types.Has(syncable::PASSWORDS)) | 582 if (types.Has(syncable::PASSWORDS)) |
583 UMA_HISTOGRAM_ENUMERATION( | 583 UMA_HISTOGRAM_ENUMERATION( |
584 "Sync.CustomSync", PASSWORDS, SELECTABLE_DATATYPE_COUNT + 1); | 584 "Sync.CustomSync", PASSWORDS, SELECTABLE_DATATYPE_COUNT + 1); |
585 if (types.Has(syncable::AUTOFILL)) | 585 if (types.Has(syncable::AUTOFILL)) |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 } | 762 } |
763 | 763 |
764 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { | 764 void SyncSetupHandler::ShowLoginErrorMessage(const string16& error_message) { |
765 DictionaryValue args; | 765 DictionaryValue args; |
766 Profile* profile = Profile::FromWebUI(web_ui_); | 766 Profile* profile = Profile::FromWebUI(web_ui_); |
767 ProfileSyncService* service = profile->GetProfileSyncService(); | 767 ProfileSyncService* service = profile->GetProfileSyncService(); |
768 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); | 768 SyncSetupFlow::GetArgsForGaiaLogin(service, &args); |
769 args.SetString("error_message", error_message); | 769 args.SetString("error_message", error_message); |
770 ShowGaiaLogin(args); | 770 ShowGaiaLogin(args); |
771 } | 771 } |
OLD | NEW |