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 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 } | 1322 } |
1323 | 1323 |
1324 // Only log the data types that are shown in the sync settings ui. | 1324 // Only log the data types that are shown in the sync settings ui. |
1325 const syncer::ModelType model_types[] = { | 1325 const syncer::ModelType model_types[] = { |
1326 syncer::APPS, | 1326 syncer::APPS, |
1327 syncer::AUTOFILL, | 1327 syncer::AUTOFILL, |
1328 syncer::BOOKMARKS, | 1328 syncer::BOOKMARKS, |
1329 syncer::EXTENSIONS, | 1329 syncer::EXTENSIONS, |
1330 syncer::PASSWORDS, | 1330 syncer::PASSWORDS, |
1331 syncer::PREFERENCES, | 1331 syncer::PREFERENCES, |
1332 syncer::SESSIONS, | 1332 syncer::TABS, |
1333 syncer::SYNCED_NOTIFICATIONS, | 1333 syncer::SYNCED_NOTIFICATIONS, |
1334 syncer::THEMES, | 1334 syncer::THEMES, |
1335 syncer::TYPED_URLS | 1335 syncer::TYPED_URLS |
1336 }; | 1336 }; |
1337 | 1337 |
1338 const browser_sync::user_selectable_type::UserSelectableSyncType | 1338 const browser_sync::user_selectable_type::UserSelectableSyncType |
1339 user_selectable_types[] = { | 1339 user_selectable_types[] = { |
1340 browser_sync::user_selectable_type::APPS, | 1340 browser_sync::user_selectable_type::APPS, |
1341 browser_sync::user_selectable_type::AUTOFILL, | 1341 browser_sync::user_selectable_type::AUTOFILL, |
1342 browser_sync::user_selectable_type::BOOKMARKS, | 1342 browser_sync::user_selectable_type::BOOKMARKS, |
1343 browser_sync::user_selectable_type::EXTENSIONS, | 1343 browser_sync::user_selectable_type::EXTENSIONS, |
1344 browser_sync::user_selectable_type::PASSWORDS, | 1344 browser_sync::user_selectable_type::PASSWORDS, |
1345 browser_sync::user_selectable_type::PREFERENCES, | 1345 browser_sync::user_selectable_type::PREFERENCES, |
1346 browser_sync::user_selectable_type::SESSIONS, | 1346 browser_sync::user_selectable_type::TABS, |
1347 browser_sync::user_selectable_type::SYNCED_NOTIFICATIONS, | 1347 browser_sync::user_selectable_type::SYNCED_NOTIFICATIONS, |
1348 browser_sync::user_selectable_type::THEMES, | 1348 browser_sync::user_selectable_type::THEMES, |
1349 browser_sync::user_selectable_type::TYPED_URLS | 1349 browser_sync::user_selectable_type::TYPED_URLS |
1350 }; | 1350 }; |
1351 | 1351 |
1352 COMPILE_ASSERT(23 == syncer::MODEL_TYPE_COUNT, UpdateCustomConfigHistogram); | 1352 COMPILE_ASSERT(24 == syncer::MODEL_TYPE_COUNT, UpdateCustomConfigHistogram); |
1353 COMPILE_ASSERT(arraysize(model_types) == | 1353 COMPILE_ASSERT(arraysize(model_types) == |
1354 browser_sync::user_selectable_type::SELECTABLE_DATATYPE_COUNT, | 1354 browser_sync::user_selectable_type::SELECTABLE_DATATYPE_COUNT, |
1355 UpdateCustomConfigHistogram); | 1355 UpdateCustomConfigHistogram); |
1356 COMPILE_ASSERT(arraysize(model_types) == arraysize(user_selectable_types), | 1356 COMPILE_ASSERT(arraysize(model_types) == arraysize(user_selectable_types), |
1357 UpdateCustomConfigHistogram); | 1357 UpdateCustomConfigHistogram); |
1358 | 1358 |
1359 if (!sync_everything) { | 1359 if (!sync_everything) { |
1360 const syncer::ModelTypeSet current_types = GetPreferredDataTypes(); | 1360 const syncer::ModelTypeSet current_types = GetPreferredDataTypes(); |
1361 for (size_t i = 0; i < arraysize(model_types); ++i) { | 1361 for (size_t i = 0; i < arraysize(model_types); ++i) { |
1362 const syncer::ModelType type = model_types[i]; | 1362 const syncer::ModelType type = model_types[i]; |
(...skipping 19 matching lines...) Expand all Loading... |
1382 | 1382 |
1383 std::string bootstrap_token; | 1383 std::string bootstrap_token; |
1384 if (!temp_cryptographer.AddKey(key_params)) { | 1384 if (!temp_cryptographer.AddKey(key_params)) { |
1385 NOTREACHED() << "Failed to add key to cryptographer."; | 1385 NOTREACHED() << "Failed to add key to cryptographer."; |
1386 } | 1386 } |
1387 temp_cryptographer.GetBootstrapToken(&bootstrap_token); | 1387 temp_cryptographer.GetBootstrapToken(&bootstrap_token); |
1388 sync_prefs_.SetSpareBootstrapToken(bootstrap_token); | 1388 sync_prefs_.SetSpareBootstrapToken(bootstrap_token); |
1389 } | 1389 } |
1390 #endif | 1390 #endif |
1391 | 1391 |
1392 void ProfileSyncService::OnUserChoseDatatypes(bool sync_everything, | 1392 void ProfileSyncService::OnUserChoseDatatypes( |
| 1393 bool sync_everything, |
1393 syncer::ModelTypeSet chosen_types) { | 1394 syncer::ModelTypeSet chosen_types) { |
1394 if (!backend_.get() && !HasUnrecoverableError()) { | 1395 if (!backend_.get() && !HasUnrecoverableError()) { |
1395 NOTREACHED(); | 1396 NOTREACHED(); |
1396 return; | 1397 return; |
1397 } | 1398 } |
1398 | 1399 |
1399 UpdateSelectedTypesHistogram(sync_everything, chosen_types); | 1400 UpdateSelectedTypesHistogram(sync_everything, chosen_types); |
1400 sync_prefs_.SetKeepEverythingSynced(sync_everything); | 1401 sync_prefs_.SetKeepEverythingSynced(sync_everything); |
1401 | 1402 |
1402 failed_datatypes_handler_.OnUserChoseDatatypes(); | 1403 failed_datatypes_handler_.OnUserChoseDatatypes(); |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. | 1967 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. |
1967 ProfileSyncService* old_this = this; | 1968 ProfileSyncService* old_this = this; |
1968 this->~ProfileSyncService(); | 1969 this->~ProfileSyncService(); |
1969 new(old_this) ProfileSyncService( | 1970 new(old_this) ProfileSyncService( |
1970 new ProfileSyncComponentsFactoryImpl(profile, | 1971 new ProfileSyncComponentsFactoryImpl(profile, |
1971 CommandLine::ForCurrentProcess()), | 1972 CommandLine::ForCurrentProcess()), |
1972 profile, | 1973 profile, |
1973 signin, | 1974 signin, |
1974 behavior); | 1975 behavior); |
1975 } | 1976 } |
OLD | NEW |