OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 void ProfileSyncService::UpdateSelectedTypesHistogram( | 1319 void ProfileSyncService::UpdateSelectedTypesHistogram( |
1320 bool sync_everything, const syncer::ModelTypeSet chosen_types) const { | 1320 bool sync_everything, const syncer::ModelTypeSet chosen_types) const { |
1321 if (!HasSyncSetupCompleted() || | 1321 if (!HasSyncSetupCompleted() || |
1322 sync_everything != sync_prefs_.HasKeepEverythingSynced()) { | 1322 sync_everything != sync_prefs_.HasKeepEverythingSynced()) { |
1323 UMA_HISTOGRAM_BOOLEAN("Sync.SyncEverything", sync_everything); | 1323 UMA_HISTOGRAM_BOOLEAN("Sync.SyncEverything", sync_everything); |
1324 } | 1324 } |
1325 | 1325 |
1326 // Only log the data types that are shown in the sync settings ui. | 1326 // Only log the data types that are shown in the sync settings ui. |
1327 // Note: the order of these types must match the ordering of | 1327 // Note: the order of these types must match the ordering of |
1328 // the respective types in ModelType | 1328 // the respective types in ModelType |
1329 const browser_sync::user_selectable_type::UserSelectableSyncType | 1329 const browser_sync::user_selectable_type::UserSelectableSyncType |
1330 user_selectable_types[] = { | 1330 user_selectable_types[] = { |
1331 browser_sync::user_selectable_type::BOOKMARKS, | 1331 browser_sync::user_selectable_type::BOOKMARKS, |
1332 browser_sync::user_selectable_type::PREFERENCES, | 1332 browser_sync::user_selectable_type::PREFERENCES, |
1333 browser_sync::user_selectable_type::PASSWORDS, | 1333 browser_sync::user_selectable_type::PASSWORDS, |
1334 browser_sync::user_selectable_type::AUTOFILL, | 1334 browser_sync::user_selectable_type::AUTOFILL, |
1335 browser_sync::user_selectable_type::THEMES, | 1335 browser_sync::user_selectable_type::THEMES, |
1336 browser_sync::user_selectable_type::TYPED_URLS, | 1336 browser_sync::user_selectable_type::TYPED_URLS, |
1337 browser_sync::user_selectable_type::EXTENSIONS, | 1337 browser_sync::user_selectable_type::EXTENSIONS, |
1338 browser_sync::user_selectable_type::SESSIONS, | 1338 browser_sync::user_selectable_type::APPS, |
1339 browser_sync::user_selectable_type::APPS | 1339 browser_sync::user_selectable_type::PROXY_TABS |
1340 }; | 1340 }; |
1341 | 1341 |
1342 COMPILE_ASSERT(25 == syncer::MODEL_TYPE_COUNT, UpdateCustomConfigHistogram); | 1342 COMPILE_ASSERT(26 == syncer::MODEL_TYPE_COUNT, UpdateCustomConfigHistogram); |
1343 | 1343 |
1344 if (!sync_everything) { | 1344 if (!sync_everything) { |
1345 const syncer::ModelTypeSet current_types = GetPreferredDataTypes(); | 1345 const syncer::ModelTypeSet current_types = GetPreferredDataTypes(); |
1346 | 1346 |
1347 syncer::ModelTypeSet type_set = syncer::UserSelectableTypes(); | 1347 syncer::ModelTypeSet type_set = syncer::UserSelectableTypes(); |
1348 syncer::ModelTypeSet::Iterator it = type_set.First(); | 1348 syncer::ModelTypeSet::Iterator it = type_set.First(); |
1349 | 1349 |
1350 DCHECK_EQ(arraysize(user_selectable_types), type_set.Size()); | 1350 DCHECK_EQ(arraysize(user_selectable_types), type_set.Size()); |
1351 | 1351 |
1352 for (size_t i = 0; i < arraysize(user_selectable_types) && it.Good(); | 1352 for (size_t i = 0; i < arraysize(user_selectable_types) && it.Good(); |
(...skipping 21 matching lines...) Expand all Loading... |
1374 | 1374 |
1375 std::string bootstrap_token; | 1375 std::string bootstrap_token; |
1376 if (!temp_cryptographer.AddKey(key_params)) { | 1376 if (!temp_cryptographer.AddKey(key_params)) { |
1377 NOTREACHED() << "Failed to add key to cryptographer."; | 1377 NOTREACHED() << "Failed to add key to cryptographer."; |
1378 } | 1378 } |
1379 temp_cryptographer.GetBootstrapToken(&bootstrap_token); | 1379 temp_cryptographer.GetBootstrapToken(&bootstrap_token); |
1380 sync_prefs_.SetSpareBootstrapToken(bootstrap_token); | 1380 sync_prefs_.SetSpareBootstrapToken(bootstrap_token); |
1381 } | 1381 } |
1382 #endif | 1382 #endif |
1383 | 1383 |
1384 void ProfileSyncService::OnUserChoseDatatypes(bool sync_everything, | 1384 void ProfileSyncService::OnUserChoseDatatypes( |
| 1385 bool sync_everything, |
1385 syncer::ModelTypeSet chosen_types) { | 1386 syncer::ModelTypeSet chosen_types) { |
1386 if (!backend_.get() && !HasUnrecoverableError()) { | 1387 if (!backend_.get() && !HasUnrecoverableError()) { |
1387 NOTREACHED(); | 1388 NOTREACHED(); |
1388 return; | 1389 return; |
1389 } | 1390 } |
1390 | 1391 |
1391 UpdateSelectedTypesHistogram(sync_everything, chosen_types); | 1392 UpdateSelectedTypesHistogram(sync_everything, chosen_types); |
1392 sync_prefs_.SetKeepEverythingSynced(sync_everything); | 1393 sync_prefs_.SetKeepEverythingSynced(sync_everything); |
1393 | 1394 |
1394 failed_datatypes_handler_.OnUserChoseDatatypes(); | 1395 failed_datatypes_handler_.OnUserChoseDatatypes(); |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. | 1963 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. |
1963 ProfileSyncService* old_this = this; | 1964 ProfileSyncService* old_this = this; |
1964 this->~ProfileSyncService(); | 1965 this->~ProfileSyncService(); |
1965 new(old_this) ProfileSyncService( | 1966 new(old_this) ProfileSyncService( |
1966 new ProfileSyncComponentsFactoryImpl(profile, | 1967 new ProfileSyncComponentsFactoryImpl(profile, |
1967 CommandLine::ForCurrentProcess()), | 1968 CommandLine::ForCurrentProcess()), |
1968 profile, | 1969 profile, |
1969 signin, | 1970 signin, |
1970 behavior); | 1971 behavior); |
1971 } | 1972 } |
OLD | NEW |