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

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

Issue 11961030: [Sync] Make SESSIONS an implicit type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
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 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 } 1281 }
1282 1282
1283 // Only log the data types that are shown in the sync settings ui. 1283 // Only log the data types that are shown in the sync settings ui.
1284 const syncer::ModelType model_types[] = { 1284 const syncer::ModelType model_types[] = {
1285 syncer::APPS, 1285 syncer::APPS,
1286 syncer::AUTOFILL, 1286 syncer::AUTOFILL,
1287 syncer::BOOKMARKS, 1287 syncer::BOOKMARKS,
1288 syncer::EXTENSIONS, 1288 syncer::EXTENSIONS,
1289 syncer::PASSWORDS, 1289 syncer::PASSWORDS,
1290 syncer::PREFERENCES, 1290 syncer::PREFERENCES,
1291 syncer::SESSIONS, 1291 syncer::TABS,
1292 syncer::SYNCED_NOTIFICATIONS, 1292 syncer::SYNCED_NOTIFICATIONS,
1293 syncer::THEMES, 1293 syncer::THEMES,
1294 syncer::TYPED_URLS 1294 syncer::TYPED_URLS
1295 }; 1295 };
1296 1296
1297 const browser_sync::user_selectable_type::UserSelectableSyncType 1297 const browser_sync::user_selectable_type::UserSelectableSyncType
1298 user_selectable_types[] = { 1298 user_selectable_types[] = {
1299 browser_sync::user_selectable_type::APPS, 1299 browser_sync::user_selectable_type::APPS,
1300 browser_sync::user_selectable_type::AUTOFILL, 1300 browser_sync::user_selectable_type::AUTOFILL,
1301 browser_sync::user_selectable_type::BOOKMARKS, 1301 browser_sync::user_selectable_type::BOOKMARKS,
1302 browser_sync::user_selectable_type::EXTENSIONS, 1302 browser_sync::user_selectable_type::EXTENSIONS,
1303 browser_sync::user_selectable_type::PASSWORDS, 1303 browser_sync::user_selectable_type::PASSWORDS,
1304 browser_sync::user_selectable_type::PREFERENCES, 1304 browser_sync::user_selectable_type::PREFERENCES,
1305 browser_sync::user_selectable_type::SESSIONS, 1305 browser_sync::user_selectable_type::TABS,
1306 browser_sync::user_selectable_type::SYNCED_NOTIFICATIONS, 1306 browser_sync::user_selectable_type::SYNCED_NOTIFICATIONS,
1307 browser_sync::user_selectable_type::THEMES, 1307 browser_sync::user_selectable_type::THEMES,
1308 browser_sync::user_selectable_type::TYPED_URLS 1308 browser_sync::user_selectable_type::TYPED_URLS
1309 }; 1309 };
1310 1310
1311 COMPILE_ASSERT(22 == syncer::MODEL_TYPE_COUNT, UpdateCustomConfigHistogram); 1311 COMPILE_ASSERT(23 == syncer::MODEL_TYPE_COUNT, UpdateCustomConfigHistogram);
1312 COMPILE_ASSERT(arraysize(model_types) == 1312 COMPILE_ASSERT(arraysize(model_types) ==
1313 browser_sync::user_selectable_type::SELECTABLE_DATATYPE_COUNT, 1313 browser_sync::user_selectable_type::SELECTABLE_DATATYPE_COUNT,
1314 UpdateCustomConfigHistogram); 1314 UpdateCustomConfigHistogram);
1315 COMPILE_ASSERT(arraysize(model_types) == arraysize(user_selectable_types), 1315 COMPILE_ASSERT(arraysize(model_types) == arraysize(user_selectable_types),
1316 UpdateCustomConfigHistogram); 1316 UpdateCustomConfigHistogram);
1317 1317
1318 if (!sync_everything) { 1318 if (!sync_everything) {
1319 const syncer::ModelTypeSet current_types = GetPreferredDataTypes(); 1319 const syncer::ModelTypeSet current_types = GetPreferredDataTypes();
1320 for (size_t i = 0; i < arraysize(model_types); ++i) { 1320 for (size_t i = 0; i < arraysize(model_types); ++i) {
1321 const syncer::ModelType type = model_types[i]; 1321 const syncer::ModelType type = model_types[i];
(...skipping 19 matching lines...) Expand all
1341 1341
1342 std::string bootstrap_token; 1342 std::string bootstrap_token;
1343 if (!temp_cryptographer.AddKey(key_params)) { 1343 if (!temp_cryptographer.AddKey(key_params)) {
1344 NOTREACHED() << "Failed to add key to cryptographer."; 1344 NOTREACHED() << "Failed to add key to cryptographer.";
1345 } 1345 }
1346 temp_cryptographer.GetBootstrapToken(&bootstrap_token); 1346 temp_cryptographer.GetBootstrapToken(&bootstrap_token);
1347 sync_prefs_.SetSpareBootstrapToken(bootstrap_token); 1347 sync_prefs_.SetSpareBootstrapToken(bootstrap_token);
1348 } 1348 }
1349 #endif 1349 #endif
1350 1350
1351 void ProfileSyncService::OnUserChoseDatatypes(bool sync_everything, 1351 void ProfileSyncService::OnUserChoseDatatypes(
1352 bool sync_everything,
1352 syncer::ModelTypeSet chosen_types) { 1353 syncer::ModelTypeSet chosen_types) {
1353 if (!backend_.get() && !HasUnrecoverableError()) { 1354 if (!backend_.get() && !HasUnrecoverableError()) {
1354 NOTREACHED(); 1355 NOTREACHED();
1355 return; 1356 return;
1356 } 1357 }
1357 1358
1358 UpdateSelectedTypesHistogram(sync_everything, chosen_types); 1359 UpdateSelectedTypesHistogram(sync_everything, chosen_types);
1359 sync_prefs_.SetKeepEverythingSynced(sync_everything); 1360 sync_prefs_.SetKeepEverythingSynced(sync_everything);
1360 1361
1361 failed_datatypes_handler_.OnUserChoseDatatypes(); 1362 failed_datatypes_handler_.OnUserChoseDatatypes();
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. 1914 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru.
1914 ProfileSyncService* old_this = this; 1915 ProfileSyncService* old_this = this;
1915 this->~ProfileSyncService(); 1916 this->~ProfileSyncService();
1916 new(old_this) ProfileSyncService( 1917 new(old_this) ProfileSyncService(
1917 new ProfileSyncComponentsFactoryImpl(profile, 1918 new ProfileSyncComponentsFactoryImpl(profile,
1918 CommandLine::ForCurrentProcess()), 1919 CommandLine::ForCurrentProcess()),
1919 profile, 1920 profile,
1920 signin, 1921 signin,
1921 behavior); 1922 behavior);
1922 } 1923 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698