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

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

Issue 12033093: sync: Implementation of Priority Preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 7 years, 8 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 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 const syncer::BaseTransaction* trans) const { 1506 const syncer::BaseTransaction* trans) const {
1507 return backend_.get() && backend_->IsCryptographerReady(trans); 1507 return backend_.get() && backend_->IsCryptographerReady(trans);
1508 } 1508 }
1509 1509
1510 SyncBackendHost* ProfileSyncService::GetBackendForTest() { 1510 SyncBackendHost* ProfileSyncService::GetBackendForTest() {
1511 // We don't check |backend_initialized_|; we assume the test class 1511 // We don't check |backend_initialized_|; we assume the test class
1512 // knows what it's doing. 1512 // knows what it's doing.
1513 return backend_.get(); 1513 return backend_.get();
1514 } 1514 }
1515 1515
1516 void ProfileSyncService::ConfigurePriorityDataTypes() {
1517 const syncer::ModelTypeSet priority_types =
1518 Intersection(GetPreferredDataTypes(), syncer::PriorityUserTypes());
1519 if (!priority_types.Empty()) {
1520 const syncer::ConfigureReason reason = HasSyncSetupCompleted() ?
1521 syncer::CONFIGURE_REASON_RECONFIGURATION :
1522 syncer::CONFIGURE_REASON_NEW_CLIENT;
1523 data_type_manager_->Configure(priority_types, reason);
1524 }
1525 }
1526
1516 void ProfileSyncService::ConfigureDataTypeManager() { 1527 void ProfileSyncService::ConfigureDataTypeManager() {
1517 // Don't configure datatypes if the setup UI is still on the screen - this 1528 // Don't configure datatypes if the setup UI is still on the screen - this
1518 // is to help multi-screen setting UIs (like iOS) where they don't want to 1529 // is to help multi-screen setting UIs (like iOS) where they don't want to
1519 // start syncing data until the user is done configuring encryption options, 1530 // start syncing data until the user is done configuring encryption options,
1520 // etc. ReconfigureDatatypeManager() will get called again once the UI calls 1531 // etc. ReconfigureDatatypeManager() will get called again once the UI calls
1521 // SetSetupInProgress(false). 1532 // SetSetupInProgress(false).
1522 if (setup_in_progress_) 1533 if (setup_in_progress_)
1523 return; 1534 return;
1524 1535
1525 bool restart = false; 1536 bool restart = false;
1526 if (!data_type_manager_.get()) { 1537 if (!data_type_manager_.get()) {
1527 restart = true; 1538 restart = true;
1528 data_type_manager_.reset( 1539 data_type_manager_.reset(
1529 factory_->CreateDataTypeManager(debug_info_listener_, 1540 factory_->CreateDataTypeManager(debug_info_listener_,
1530 backend_.get(), 1541 backend_.get(),
1531 &data_type_controllers_, 1542 &data_type_controllers_,
1532 this, 1543 this,
1533 &failed_datatypes_handler_)); 1544 &failed_datatypes_handler_));
1534 1545
1535 // We create the migrator at the same time. 1546 // We create the migrator at the same time.
1536 migrator_.reset( 1547 migrator_.reset(
1537 new browser_sync::BackendMigrator( 1548 new browser_sync::BackendMigrator(
1538 profile_->GetDebugName(), GetUserShare(), 1549 profile_->GetDebugName(), GetUserShare(),
1539 this, data_type_manager_.get(), 1550 this, data_type_manager_.get(),
1540 base::Bind(&ProfileSyncService::StartSyncingWithServer, 1551 base::Bind(&ProfileSyncService::StartSyncingWithServer,
1541 base::Unretained(this)))); 1552 base::Unretained(this))));
1542 } 1553 }
1554 ConfigurePriorityDataTypes();
1543 1555
1544 #if defined(OS_ANDROID) 1556 #if defined(OS_ANDROID)
1545 if (GetPreferredDataTypes().Has(syncer::PASSWORDS) && 1557 if (GetPreferredDataTypes().Has(syncer::PASSWORDS) &&
1546 !ShouldEnablePasswordSyncForAndroid()) { 1558 !ShouldEnablePasswordSyncForAndroid()) {
1547 DisableBrokenDatatype(syncer::PASSWORDS, FROM_HERE, "Not supported."); 1559 DisableBrokenDatatype(syncer::PASSWORDS, FROM_HERE, "Not supported.");
1548 } 1560 }
1549 #endif 1561 #endif
1550 1562
1551 const syncer::ModelTypeSet types = GetPreferredDataTypes(); 1563 const syncer::ModelTypeSet types = GetPreferredDataTypes();
1552 if (IsPassphraseRequiredForDecryption()) { 1564 if (IsPassphraseRequiredForDecryption()) {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. 2026 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru.
2015 ProfileSyncService* old_this = this; 2027 ProfileSyncService* old_this = this;
2016 this->~ProfileSyncService(); 2028 this->~ProfileSyncService();
2017 new(old_this) ProfileSyncService( 2029 new(old_this) ProfileSyncService(
2018 new ProfileSyncComponentsFactoryImpl(profile, 2030 new ProfileSyncComponentsFactoryImpl(profile,
2019 CommandLine::ForCurrentProcess()), 2031 CommandLine::ForCurrentProcess()),
2020 profile, 2032 profile,
2021 signin, 2033 signin,
2022 behavior); 2034 behavior);
2023 } 2035 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_preference_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698