diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-30 02:27:29 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-30 02:27:29 +0000 |
commit | fcd3a7a671ecf2d5f46ea34787d27507a914d2f5 (patch) | |
tree | c65595bf09f2c9752eb4c453ba1e193052d75bc0 /sync/internal_api | |
parent | 4291d518d20c146646b92e1908adad292a0ed4e4 (diff) | |
download | chromium_src-fcd3a7a671ecf2d5f46ea34787d27507a914d2f5.zip chromium_src-fcd3a7a671ecf2d5f46ea34787d27507a914d2f5.tar.gz chromium_src-fcd3a7a671ecf2d5f46ea34787d27507a914d2f5.tar.bz2 |
[Sync] Cleanup all tab sync enabling logic now that its on by default.
BUG=none
TEST=
Review URL: https://chromiumcodereview.appspot.com/10443046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139462 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api')
-rw-r--r-- | sync/internal_api/sync_manager.cc | 45 | ||||
-rw-r--r-- | sync/internal_api/sync_manager.h | 5 | ||||
-rw-r--r-- | sync/internal_api/syncapi_unittest.cc | 23 |
3 files changed, 0 insertions, 73 deletions
diff --git a/sync/internal_api/sync_manager.cc b/sync/internal_api/sync_manager.cc index 1906185..e60b212 100644 --- a/sync/internal_api/sync_manager.cc +++ b/sync/internal_api/sync_manager.cc @@ -141,7 +141,6 @@ class SyncManager::SyncInternal explicit SyncInternal(const std::string& name) : name_(name), weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), - enable_sync_tabs_for_other_clients_(false), registrar_(NULL), change_delegate_(NULL), initialized_(false), @@ -204,7 +203,6 @@ class SyncManager::SyncInternal ChangeDelegate* change_delegate, const std::string& user_agent, const SyncCredentials& credentials, - bool enable_sync_tabs_for_other_clients, sync_notifier::SyncNotifier* sync_notifier, const std::string& restored_key_for_bootstrapping, TestingMode testing_mode, @@ -225,10 +223,6 @@ class SyncManager::SyncInternal // Called when the user disables or enables a sync type. void UpdateEnabledTypes(); - // Conditionally sets the flag in the Nigori node which instructs other - // clients to start syncing tabs. - void MaybeSetSyncTabsInNigoriNode(ModelTypeSet enabled_types); - // Tell the sync engine to start the syncing process. void StartSyncingNormally(); @@ -574,8 +568,6 @@ class SyncManager::SyncInternal // Start()ed. scoped_ptr<SyncScheduler> scheduler_; - bool enable_sync_tabs_for_other_clients_; - // The SyncNotifier which notifies us when updates need to be downloaded. scoped_ptr<sync_notifier::SyncNotifier> sync_notifier_; @@ -760,7 +752,6 @@ bool SyncManager::Init( ChangeDelegate* change_delegate, const std::string& user_agent, const SyncCredentials& credentials, - bool enable_sync_tabs_for_other_clients, sync_notifier::SyncNotifier* sync_notifier, const std::string& restored_key_for_bootstrapping, TestingMode testing_mode, @@ -783,7 +774,6 @@ bool SyncManager::Init( change_delegate, user_agent, credentials, - enable_sync_tabs_for_other_clients, sync_notifier, restored_key_for_bootstrapping, testing_mode, @@ -802,12 +792,6 @@ void SyncManager::UpdateEnabledTypes() { data_->UpdateEnabledTypes(); } -void SyncManager::MaybeSetSyncTabsInNigoriNode( - ModelTypeSet enabled_types) { - DCHECK(thread_checker_.CalledOnValidThread()); - data_->MaybeSetSyncTabsInNigoriNode(enabled_types); -} - void SyncManager::ThrowUnrecoverableError() { DCHECK(thread_checker_.CalledOnValidThread()); ReadTransaction trans(FROM_HERE, GetUserShare()); @@ -912,7 +896,6 @@ bool SyncManager::SyncInternal::Init( ChangeDelegate* change_delegate, const std::string& user_agent, const SyncCredentials& credentials, - bool enable_sync_tabs_for_other_clients, sync_notifier::SyncNotifier* sync_notifier, const std::string& restored_key_for_bootstrapping, TestingMode testing_mode, @@ -933,8 +916,6 @@ bool SyncManager::SyncInternal::Init( change_delegate_ = change_delegate; testing_mode_ = testing_mode; - enable_sync_tabs_for_other_clients_ = enable_sync_tabs_for_other_clients; - sync_notifier_.reset(sync_notifier); AddObserver(&js_sync_manager_observer_); @@ -1241,28 +1222,6 @@ void SyncManager::SyncInternal::UpdateEnabledTypes() { registrar_->GetModelSafeRoutingInfo(&routes); const ModelTypeSet enabled_types = GetRoutingInfoTypes(routes); sync_notifier_->UpdateEnabledTypes(enabled_types); - if (enable_sync_tabs_for_other_clients_) - MaybeSetSyncTabsInNigoriNode(enabled_types); -} - -void SyncManager::SyncInternal::MaybeSetSyncTabsInNigoriNode( - const ModelTypeSet enabled_types) { - // The initialized_ check is to ensure that we don't CHECK in GetUserShare - // when this is called on start-up. It's ok to ignore that case, since - // presumably this would've run when the user originally enabled sessions. - if (initialized_ && enabled_types.Has(syncable::SESSIONS)) { - WriteTransaction trans(FROM_HERE, GetUserShare()); - WriteNode node(&trans); - if (node.InitByTagLookup(kNigoriTag) != sync_api::BaseNode::INIT_OK) { - LOG(WARNING) << "Unable to set 'sync_tabs' bit because Nigori node not " - << "found."; - return; - } - - sync_pb::NigoriSpecifics specifics(node.GetNigoriSpecifics()); - specifics.set_sync_tabs(true); - node.SetNigoriSpecifics(specifics); - } } void SyncManager::SyncInternal::SetEncryptionPassphrase( @@ -2487,10 +2446,6 @@ bool SyncManager::ReceivedExperiment(browser_sync::Experiments* experiments) return false; } bool found_experiment = false; - if (node.GetNigoriSpecifics().sync_tabs()) { - experiments->sync_tabs = true; - found_experiment = true; - } if (node.GetNigoriSpecifics().sync_tab_favicons()) { experiments->sync_tab_favicons = true; found_experiment = true; diff --git a/sync/internal_api/sync_manager.h b/sync/internal_api/sync_manager.h index 4d23d19..2ecbbdc 100644 --- a/sync/internal_api/sync_manager.h +++ b/sync/internal_api/sync_manager.h @@ -453,7 +453,6 @@ class SyncManager { ChangeDelegate* change_delegate, const std::string& user_agent, const SyncCredentials& credentials, - bool enable_sync_tabs_for_other_clients, sync_notifier::SyncNotifier* sync_notifier, const std::string& restored_key_for_bootstrapping, TestingMode testing_mode, @@ -479,10 +478,6 @@ class SyncManager { // Called when the user disables or enables a sync type. void UpdateEnabledTypes(); - // Conditionally sets the flag in the Nigori node which instructs other - // clients to start syncing tabs. - void MaybeSetSyncTabsInNigoriNode(syncable::ModelTypeSet enabled_types); - // Put the syncer in normal mode ready to perform nudges and polls. void StartSyncingNormally(); diff --git a/sync/internal_api/syncapi_unittest.cc b/sync/internal_api/syncapi_unittest.cc index 6b38a4f..04705c6 100644 --- a/sync/internal_api/syncapi_unittest.cc +++ b/sync/internal_api/syncapi_unittest.cc @@ -785,7 +785,6 @@ class SyncManagerTest : public testing::Test, new TestHttpPostProviderFactory(), this, &extensions_activity_monitor_, this, "bogus", credentials, - false /* enable_sync_tabs_for_other_clients */, sync_notifier_mock_, "", sync_api::SyncManager::TEST_IN_MEMORY, &encryptor_, @@ -960,28 +959,6 @@ TEST_F(SyncManagerTest, UpdateEnabledTypes) { EXPECT_EQ(2, update_enabled_types_call_count_); } -TEST_F(SyncManagerTest, DoNotSyncTabsInNigoriNode) { - const syncable::ModelTypeSet encrypted_types(syncable::TYPED_URLS); - sync_manager_.MaybeSetSyncTabsInNigoriNode(encrypted_types); - - ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); - ReadNode node(&trans); - ASSERT_EQ(BaseNode::INIT_OK, - node.InitByIdLookup(GetIdForDataType(syncable::NIGORI))); - EXPECT_FALSE(node.GetNigoriSpecifics().sync_tabs()); -} - -TEST_F(SyncManagerTest, SyncTabsInNigoriNode) { - const syncable::ModelTypeSet encrypted_types(syncable::SESSIONS); - sync_manager_.MaybeSetSyncTabsInNigoriNode(encrypted_types); - - ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); - ReadNode node(&trans); - ASSERT_EQ(BaseNode::INIT_OK, - node.InitByIdLookup(GetIdForDataType(syncable::NIGORI))); - EXPECT_TRUE(node.GetNigoriSpecifics().sync_tabs()); -} - TEST_F(SyncManagerTest, ProcessJsMessage) { const JsArgList kNoArgs; |