diff options
Diffstat (limited to 'chrome/browser')
127 files changed, 724 insertions, 724 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 25ff0df..afbbe06 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -4976,9 +4976,9 @@ void TestingAutomationProvider::GetSyncInfo(Browser* browser, sync_info->SetString("last synced", service->GetLastSyncedTimeString()); sync_info->SetInteger("updates received", status.updates_received); ListValue* synced_datatype_list = new ListValue; - const syncable::ModelEnumSet synced_datatypes = + const syncable::ModelTypeSet synced_datatypes = service->GetPreferredDataTypes(); - for (syncable::ModelEnumSet::Iterator it = synced_datatypes.First(); + for (syncable::ModelTypeSet::Iterator it = synced_datatypes.First(); it.Good(); it.Inc()) { synced_datatype_list->Append( new StringValue(syncable::ModelTypeToString(it.Get()))); diff --git a/chrome/browser/sync/backend_migrator.cc b/chrome/browser/sync/backend_migrator.cc index a0dabde..fed3d67 100644 --- a/chrome/browser/sync/backend_migrator.cc +++ b/chrome/browser/sync/backend_migrator.cc @@ -17,7 +17,7 @@ #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" -using syncable::ModelEnumSet; +using syncable::ModelTypeSet; namespace browser_sync { @@ -47,12 +47,12 @@ BackendMigrator::~BackendMigrator() { #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " -void BackendMigrator::MigrateTypes(syncable::ModelEnumSet types) { - const ModelEnumSet old_to_migrate = to_migrate_; +void BackendMigrator::MigrateTypes(syncable::ModelTypeSet types) { + const ModelTypeSet old_to_migrate = to_migrate_; to_migrate_.PutAll(types); - SDVLOG(1) << "MigrateTypes called with " << ModelEnumSetToString(types) - << ", old_to_migrate = " << ModelEnumSetToString(old_to_migrate) - << ", to_migrate_ = " << ModelEnumSetToString(to_migrate_); + SDVLOG(1) << "MigrateTypes called with " << ModelTypeSetToString(types) + << ", old_to_migrate = " << ModelTypeSetToString(old_to_migrate) + << ", to_migrate_ = " << ModelTypeSetToString(to_migrate_); if (old_to_migrate.Equals(to_migrate_)) { SDVLOG(1) << "MigrateTypes called with no new types; ignoring"; return; @@ -103,12 +103,12 @@ bool BackendMigrator::TryStart() { void BackendMigrator::RestartMigration() { // We'll now disable any running types that need to be migrated. ChangeState(DISABLING_TYPES); - const ModelEnumSet full_set = service_->GetPreferredDataTypes(); - const ModelEnumSet difference = Difference(full_set, to_migrate_); + const ModelTypeSet full_set = service_->GetPreferredDataTypes(); + const ModelTypeSet difference = Difference(full_set, to_migrate_); bool configure_with_nigori = !to_migrate_.Has(syncable::NIGORI); SDVLOG(1) << "BackendMigrator disabling types " - << ModelEnumSetToString(to_migrate_) << "; configuring " - << ModelEnumSetToString(difference) + << ModelTypeSetToString(to_migrate_) << "; configuring " + << ModelTypeSetToString(difference) << (configure_with_nigori ? " with nigori" : " without nigori"); // Add nigori for config or not based upon if the server told us to migrate @@ -141,9 +141,9 @@ void BackendMigrator::Observe(int type, namespace { -syncable::ModelEnumSet GetUnsyncedDataTypes(sync_api::UserShare* user_share) { +syncable::ModelTypeSet GetUnsyncedDataTypes(sync_api::UserShare* user_share) { sync_api::ReadTransaction trans(FROM_HERE, user_share); - syncable::ModelEnumSet unsynced_data_types; + syncable::ModelTypeSet unsynced_data_types; for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { syncable::ModelType type = syncable::ModelTypeFromInt(i); @@ -161,9 +161,9 @@ syncable::ModelEnumSet GetUnsyncedDataTypes(sync_api::UserShare* user_share) { void BackendMigrator::OnConfigureDone( const DataTypeManager::ConfigureResult& result) { SDVLOG(1) << "OnConfigureDone with requested types " - << ModelEnumSetToString(result.requested_types) + << ModelTypeSetToString(result.requested_types) << ", status " << result.status - << ", and to_migrate_ = " << ModelEnumSetToString(to_migrate_); + << ", and to_migrate_ = " << ModelTypeSetToString(to_migrate_); if (state_ == WAITING_TO_START) { if (!TryStart()) SDVLOG(1) << "Manager still not configured; still waiting"; @@ -172,7 +172,7 @@ void BackendMigrator::OnConfigureDone( DCHECK_GT(state_, WAITING_TO_START); - const ModelEnumSet intersection = + const ModelTypeSet intersection = Intersection(result.requested_types, to_migrate_); // This intersection check is to determine if our disable request // was interrupted by a user changing preferred types. @@ -197,13 +197,13 @@ void BackendMigrator::OnConfigureDone( } if (state_ == DISABLING_TYPES) { - const syncable::ModelEnumSet unsynced_types = + const syncable::ModelTypeSet unsynced_types = GetUnsyncedDataTypes(user_share_); if (!unsynced_types.HasAll(to_migrate_)) { SLOG(WARNING) << "Set of unsynced types: " - << syncable::ModelEnumSetToString(unsynced_types) + << syncable::ModelTypeSetToString(unsynced_types) << " does not contain types to migrate: " - << syncable::ModelEnumSetToString(to_migrate_) + << syncable::ModelTypeSetToString(to_migrate_) << "; not re-enabling yet"; return; } @@ -211,16 +211,16 @@ void BackendMigrator::OnConfigureDone( ChangeState(REENABLING_TYPES); // Don't use |to_migrate_| for the re-enabling because the user // may have chosen to disable types during the migration. - const ModelEnumSet full_set = service_->GetPreferredDataTypes(); + const ModelTypeSet full_set = service_->GetPreferredDataTypes(); SDVLOG(1) << "BackendMigrator re-enabling types: " - << syncable::ModelEnumSetToString(full_set); + << syncable::ModelTypeSetToString(full_set); manager_->Configure(full_set, sync_api::CONFIGURE_REASON_MIGRATION); } else if (state_ == REENABLING_TYPES) { // We're done! ChangeState(IDLE); SDVLOG(1) << "BackendMigrator: Migration complete for: " - << syncable::ModelEnumSetToString(to_migrate_); + << syncable::ModelTypeSetToString(to_migrate_); to_migrate_.Clear(); } } @@ -229,7 +229,7 @@ BackendMigrator::State BackendMigrator::state() const { return state_; } -syncable::ModelEnumSet +syncable::ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const { return to_migrate_; } diff --git a/chrome/browser/sync/backend_migrator.h b/chrome/browser/sync/backend_migrator.h index ad34132..ee040f0 100644 --- a/chrome/browser/sync/backend_migrator.h +++ b/chrome/browser/sync/backend_migrator.h @@ -55,7 +55,7 @@ class BackendMigrator : public content::NotificationObserver { virtual ~BackendMigrator(); // Starts a sequence of events that will disable and reenable |types|. - void MigrateTypes(syncable::ModelEnumSet types); + void MigrateTypes(syncable::ModelTypeSet types); void AddMigrationObserver(MigrationObserver* observer); bool HasMigrationObserver(MigrationObserver* observer) const; @@ -69,7 +69,7 @@ class BackendMigrator : public content::NotificationObserver { State state() const; // Returns the types that are currently pending migration (if any). - syncable::ModelEnumSet GetPendingMigrationTypesForTest() const; + syncable::ModelTypeSet GetPendingMigrationTypesForTest() const; private: void ChangeState(State new_state); @@ -97,7 +97,7 @@ class BackendMigrator : public content::NotificationObserver { ObserverList<MigrationObserver> migration_observers_; - syncable::ModelEnumSet to_migrate_; + syncable::ModelTypeSet to_migrate_; base::WeakPtrFactory<BackendMigrator> weak_ptr_factory_; diff --git a/chrome/browser/sync/backend_migrator_unittest.cc b/chrome/browser/sync/backend_migrator_unittest.cc index c52f1a5..34ba5c5 100644 --- a/chrome/browser/sync/backend_migrator_unittest.cc +++ b/chrome/browser/sync/backend_migrator_unittest.cc @@ -49,7 +49,7 @@ class BackendMigratorTest : public testing::Test { migrator_.reset( new BackendMigrator( "Profile0", test_user_share_.user_share(), service(), manager())); - SetUnsyncedTypes(syncable::ModelEnumSet()); + SetUnsyncedTypes(syncable::ModelTypeSet()); } virtual void TearDown() { @@ -59,7 +59,7 @@ class BackendMigratorTest : public testing::Test { // Marks all types in |unsynced_types| as unsynced and all other // types as synced. - void SetUnsyncedTypes(syncable::ModelEnumSet unsynced_types) { + void SetUnsyncedTypes(syncable::ModelTypeSet unsynced_types) { sync_api::WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); for (int i = syncable::FIRST_REAL_MODEL_TYPE; @@ -74,7 +74,7 @@ class BackendMigratorTest : public testing::Test { } void SendConfigureDone(DataTypeManager::ConfigureStatus status, - syncable::ModelEnumSet requested_types) { + syncable::ModelTypeSet requested_types) { if (status == DataTypeManager::OK) { DataTypeManager::ConfigureResult result(status, requested_types); content::NotificationService::current()->Notify( @@ -97,7 +97,7 @@ class BackendMigratorTest : public testing::Test { ProfileSyncService* service() { return &service_; } DataTypeManagerMock* manager() { return &manager_; } - syncable::ModelEnumSet preferred_types() { return preferred_types_; } + syncable::ModelTypeSet preferred_types() { return preferred_types_; } BackendMigrator* migrator() { return migrator_.get(); } void RemovePreferredType(syncable::ModelType type) { preferred_types_.Remove(type); @@ -109,7 +109,7 @@ class BackendMigratorTest : public testing::Test { private: scoped_ptr<SyncSessionSnapshot> snap_; MessageLoop message_loop_; - syncable::ModelEnumSet preferred_types_; + syncable::ModelTypeSet preferred_types_; NiceMock<ProfileSyncServiceMock> service_; NiceMock<DataTypeManagerMock> manager_; TestUserShare test_user_share_; @@ -130,7 +130,7 @@ TEST_F(BackendMigratorTest, Sanity) { migrator()->AddMigrationObserver(&migration_observer); EXPECT_CALL(migration_observer, OnMigrationStateChange()).Times(4); - syncable::ModelEnumSet to_migrate, difference; + syncable::ModelTypeSet to_migrate, difference; to_migrate.Put(syncable::PREFERENCES); difference.Put(syncable::AUTOFILL); difference.Put(syncable::BOOKMARKS); @@ -147,7 +147,7 @@ TEST_F(BackendMigratorTest, Sanity) { SendConfigureDone(DataTypeManager::OK, difference); EXPECT_EQ(BackendMigrator::REENABLING_TYPES, migrator()->state()); - SetUnsyncedTypes(syncable::ModelEnumSet()); + SetUnsyncedTypes(syncable::ModelTypeSet()); SendConfigureDone(DataTypeManager::OK, preferred_types()); EXPECT_EQ(BackendMigrator::IDLE, migrator()->state()); @@ -157,7 +157,7 @@ TEST_F(BackendMigratorTest, Sanity) { // Test that in the normal case with Nigori a migration transitions through // each state and wind up back in IDLE. TEST_F(BackendMigratorTest, MigrateNigori) { - syncable::ModelEnumSet to_migrate, difference; + syncable::ModelTypeSet to_migrate, difference; to_migrate.Put(syncable::NIGORI); difference.Put(syncable::AUTOFILL); difference.Put(syncable::BOOKMARKS); @@ -175,7 +175,7 @@ TEST_F(BackendMigratorTest, MigrateNigori) { SendConfigureDone(DataTypeManager::OK, difference); EXPECT_EQ(BackendMigrator::REENABLING_TYPES, migrator()->state()); - SetUnsyncedTypes(syncable::ModelEnumSet()); + SetUnsyncedTypes(syncable::ModelTypeSet()); SendConfigureDone(DataTypeManager::OK, preferred_types()); EXPECT_EQ(BackendMigrator::IDLE, migrator()->state()); } @@ -184,7 +184,7 @@ TEST_F(BackendMigratorTest, MigrateNigori) { // Test that the migrator waits for the data type manager to be idle before // starting a migration. TEST_F(BackendMigratorTest, WaitToStart) { - syncable::ModelEnumSet to_migrate; + syncable::ModelTypeSet to_migrate; to_migrate.Put(syncable::PREFERENCES); EXPECT_CALL(*manager(), state()) @@ -197,8 +197,8 @@ TEST_F(BackendMigratorTest, WaitToStart) { EXPECT_CALL(*manager(), state()) .WillOnce(Return(DataTypeManager::CONFIGURED)); EXPECT_CALL(*manager(), Configure(_, sync_api::CONFIGURE_REASON_MIGRATION)); - SetUnsyncedTypes(syncable::ModelEnumSet()); - SendConfigureDone(DataTypeManager::OK, syncable::ModelEnumSet()); + SetUnsyncedTypes(syncable::ModelTypeSet()); + SendConfigureDone(DataTypeManager::OK, syncable::ModelTypeSet()); EXPECT_EQ(BackendMigrator::DISABLING_TYPES, migrator()->state()); } @@ -206,7 +206,7 @@ TEST_F(BackendMigratorTest, WaitToStart) { // Test that the migrator can cope with a migration request while a migration // is in progress. TEST_F(BackendMigratorTest, RestartMigration) { - syncable::ModelEnumSet to_migrate1, to_migrate2, to_migrate_union, bookmarks; + syncable::ModelTypeSet to_migrate1, to_migrate2, to_migrate_union, bookmarks; to_migrate1.Put(syncable::PREFERENCES); to_migrate2.Put(syncable::AUTOFILL); to_migrate_union.Put(syncable::PREFERENCES); @@ -222,7 +222,7 @@ TEST_F(BackendMigratorTest, RestartMigration) { EXPECT_EQ(BackendMigrator::DISABLING_TYPES, migrator()->state()); migrator()->MigrateTypes(to_migrate2); - const syncable::ModelEnumSet difference1 = + const syncable::ModelTypeSet difference1 = Difference(preferred_types(), to_migrate1); Mock::VerifyAndClearExpectations(manager()); @@ -240,8 +240,8 @@ TEST_F(BackendMigratorTest, RestartMigration) { // Test that an external invocation of Configure(...) during a migration results // in a migration reattempt. TEST_F(BackendMigratorTest, InterruptedWhileDisablingTypes) { - syncable::ModelEnumSet to_migrate; - syncable::ModelEnumSet difference; + syncable::ModelTypeSet to_migrate; + syncable::ModelTypeSet difference; to_migrate.Put(syncable::PREFERENCES); difference.Put(syncable::AUTOFILL); difference.Put(syncable::BOOKMARKS); @@ -256,7 +256,7 @@ TEST_F(BackendMigratorTest, InterruptedWhileDisablingTypes) { Mock::VerifyAndClearExpectations(manager()); EXPECT_CALL(*manager(), Configure(HasModelTypes(difference), sync_api::CONFIGURE_REASON_MIGRATION)); - SetUnsyncedTypes(syncable::ModelEnumSet()); + SetUnsyncedTypes(syncable::ModelTypeSet()); SendConfigureDone(DataTypeManager::OK, preferred_types()); EXPECT_EQ(BackendMigrator::DISABLING_TYPES, migrator()->state()); @@ -266,7 +266,7 @@ TEST_F(BackendMigratorTest, InterruptedWhileDisablingTypes) { // migrator while it's waiting for disabled types to have been purged // from the sync db. TEST_F(BackendMigratorTest, WaitingForPurge) { - syncable::ModelEnumSet to_migrate, difference; + syncable::ModelTypeSet to_migrate, difference; to_migrate.Put(syncable::PREFERENCES); to_migrate.Put(syncable::AUTOFILL); difference.Put(syncable::BOOKMARKS); @@ -282,7 +282,7 @@ TEST_F(BackendMigratorTest, WaitingForPurge) { SendConfigureDone(DataTypeManager::OK, difference); EXPECT_EQ(BackendMigrator::DISABLING_TYPES, migrator()->state()); - syncable::ModelEnumSet prefs; + syncable::ModelTypeSet prefs; prefs.Put(syncable::PREFERENCES); SetUnsyncedTypes(prefs); SendConfigureDone(DataTypeManager::OK, difference); @@ -294,7 +294,7 @@ TEST_F(BackendMigratorTest, WaitingForPurge) { } TEST_F(BackendMigratorTest, MigratedTypeDisabledByUserDuringMigration) { - syncable::ModelEnumSet to_migrate; + syncable::ModelTypeSet to_migrate; to_migrate.Put(syncable::PREFERENCES); EXPECT_CALL(*manager(), state()) @@ -307,13 +307,13 @@ TEST_F(BackendMigratorTest, MigratedTypeDisabledByUserDuringMigration) { SetUnsyncedTypes(to_migrate); SendConfigureDone(DataTypeManager::OK, preferred_types()); EXPECT_EQ(BackendMigrator::REENABLING_TYPES, migrator()->state()); - SetUnsyncedTypes(syncable::ModelEnumSet()); + SetUnsyncedTypes(syncable::ModelTypeSet()); SendConfigureDone(DataTypeManager::OK, preferred_types()); EXPECT_EQ(BackendMigrator::IDLE, migrator()->state()); } TEST_F(BackendMigratorTest, ConfigureFailure) { - syncable::ModelEnumSet to_migrate; + syncable::ModelTypeSet to_migrate; to_migrate.Put(syncable::PREFERENCES); EXPECT_CALL(*manager(), state()) @@ -321,8 +321,8 @@ TEST_F(BackendMigratorTest, ConfigureFailure) { EXPECT_CALL(*manager(), Configure(_, sync_api::CONFIGURE_REASON_MIGRATION)) .Times(1); migrator()->MigrateTypes(to_migrate); - SetUnsyncedTypes(syncable::ModelEnumSet()); - SendConfigureDone(DataTypeManager::ABORTED, syncable::ModelEnumSet()); + SetUnsyncedTypes(syncable::ModelTypeSet()); + SendConfigureDone(DataTypeManager::ABORTED, syncable::ModelTypeSet()); EXPECT_EQ(BackendMigrator::IDLE, migrator()->state()); } diff --git a/chrome/browser/sync/engine/all_status.cc b/chrome/browser/sync/engine/all_status.cc index e8bb066..98f0e00 100644 --- a/chrome/browser/sync/engine/all_status.cc +++ b/chrome/browser/sync/engine/all_status.cc @@ -173,7 +173,7 @@ void AllStatus::IncrementNotificationsReceived() { ++status_.notifications_received; } -void AllStatus::SetEncryptedTypes(syncable::ModelEnumSet types) { +void AllStatus::SetEncryptedTypes(syncable::ModelTypeSet types) { ScopedStatusLock lock(this); status_.encrypted_types = types; } diff --git a/chrome/browser/sync/engine/all_status.h b/chrome/browser/sync/engine/all_status.h index 0e6238c..17f20b5 100644 --- a/chrome/browser/sync/engine/all_status.h +++ b/chrome/browser/sync/engine/all_status.h @@ -44,7 +44,7 @@ class AllStatus : public SyncEngineEventListener { void IncrementNotificationsReceived(); - void SetEncryptedTypes(syncable::ModelEnumSet types); + void SetEncryptedTypes(syncable::ModelTypeSet types); void SetCryptographerReady(bool ready); void SetCryptoHasPendingKeys(bool has_pending_keys); diff --git a/chrome/browser/sync/engine/apply_updates_command.cc b/chrome/browser/sync/engine/apply_updates_command.cc index 2acd63b..c7a14c8 100644 --- a/chrome/browser/sync/engine/apply_updates_command.cc +++ b/chrome/browser/sync/engine/apply_updates_command.cc @@ -25,7 +25,7 @@ std::set<ModelSafeGroup> ApplyUpdatesCommand::GetGroupsToChange( const sessions::SyncSession& session) const { std::set<ModelSafeGroup> groups_with_unapplied_updates; - syncable::FullModelEnumSet server_types_with_unapplied_updates; + syncable::FullModelTypeSet server_types_with_unapplied_updates; { syncable::ScopedDirLookup dir(session.context()->directory_manager(), session.context()->account_name()); @@ -39,7 +39,7 @@ std::set<ModelSafeGroup> ApplyUpdatesCommand::GetGroupsToChange( dir->GetServerTypesWithUnappliedUpdates(&trans); } - for (syncable::FullModelEnumSet::Iterator it = + for (syncable::FullModelTypeSet::Iterator it = server_types_with_unapplied_updates.First(); it.Good(); it.Inc()) { groups_with_unapplied_updates.insert( GetGroupForModelType(it.Get(), session.routing_info())); @@ -60,10 +60,10 @@ void ApplyUpdatesCommand::ModelChangingExecuteImpl(SyncSession* session) { // Compute server types with unapplied updates that fall under our // group restriction. - const syncable::FullModelEnumSet server_types_with_unapplied_updates = + const syncable::FullModelTypeSet server_types_with_unapplied_updates = dir->GetServerTypesWithUnappliedUpdates(&trans); - syncable::FullModelEnumSet server_type_restriction; - for (syncable::FullModelEnumSet::Iterator it = + syncable::FullModelTypeSet server_type_restriction; + for (syncable::FullModelTypeSet::Iterator it = server_types_with_unapplied_updates.First(); it.Good(); it.Inc()) { if (GetGroupForModelType(it.Get(), session->routing_info()) == session->status_controller().group_restriction()) { @@ -89,7 +89,7 @@ void ApplyUpdatesCommand::ModelChangingExecuteImpl(SyncSession* session) { // some subset of the currently synced datatypes. const sessions::StatusController& status(session->status_controller()); if (status.ServerSaysNothingMoreToDownload()) { - for (syncable::ModelEnumSet::Iterator it = + for (syncable::ModelTypeSet::Iterator it = status.updates_request_types().First(); it.Good(); it.Inc()) { // This gets persisted to the directory's backing store. dir->set_initial_sync_ended_for_type(it.Get(), true); diff --git a/chrome/browser/sync/engine/apply_updates_command_unittest.cc b/chrome/browser/sync/engine/apply_updates_command_unittest.cc index cadc14f..a70f17e 100644 --- a/chrome/browser/sync/engine/apply_updates_command_unittest.cc +++ b/chrome/browser/sync/engine/apply_updates_command_unittest.cc @@ -426,7 +426,7 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) { // Storing the cryptographer separately is bad, but for this test we // know it's safe. Cryptographer* cryptographer; - syncable::ModelEnumSet encrypted_types; + syncable::ModelTypeSet encrypted_types; encrypted_types.Put(syncable::PASSWORDS); encrypted_types.Put(syncable::NIGORI); { @@ -471,14 +471,14 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) { EXPECT_TRUE(cryptographer->has_pending_keys()); EXPECT_TRUE( cryptographer->GetEncryptedTypes() - .Equals(syncable::ModelEnumSet::All())); + .Equals(syncable::ModelTypeSet::All())); } TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) { // Storing the cryptographer separately is bad, but for this test we // know it's safe. Cryptographer* cryptographer; - syncable::ModelEnumSet encrypted_types; + syncable::ModelTypeSet encrypted_types; encrypted_types.Put(syncable::PASSWORDS); encrypted_types.Put(syncable::NIGORI); { @@ -525,14 +525,14 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) { EXPECT_TRUE(cryptographer->has_pending_keys()); EXPECT_TRUE( cryptographer->GetEncryptedTypes() - .Equals(syncable::ModelEnumSet::All())); + .Equals(syncable::ModelTypeSet::All())); } TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) { // Storing the cryptographer separately is bad, but for this test we // know it's safe. Cryptographer* cryptographer; - syncable::ModelEnumSet encrypted_types; + syncable::ModelTypeSet encrypted_types; encrypted_types.Put(syncable::PASSWORDS); encrypted_types.Put(syncable::NIGORI); { @@ -621,7 +621,7 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) { // If ProcessUnsyncedChangesForEncryption worked, all our unsynced changes // should be encrypted now. - EXPECT_TRUE(syncable::ModelEnumSet::All().Equals( + EXPECT_TRUE(syncable::ModelTypeSet::All().Equals( cryptographer->GetEncryptedTypes())); EXPECT_TRUE(VerifyUnsyncedChangesAreEncrypted(&trans, encrypted_types)); @@ -635,7 +635,7 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) { // Storing the cryptographer separately is bad, but for this test we // know it's safe. Cryptographer* cryptographer; - syncable::ModelEnumSet encrypted_types; + syncable::ModelTypeSet encrypted_types; encrypted_types.Put(syncable::PASSWORDS); encrypted_types.Put(syncable::NIGORI); { @@ -733,7 +733,7 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) { encrypted_types.Put(syncable::BOOKMARKS); EXPECT_TRUE( cryptographer->GetEncryptedTypes().Equals( - syncable::ModelEnumSet().All())); + syncable::ModelTypeSet().All())); Syncer::UnsyncedMetaHandles handles; SyncerUtil::GetUnsyncedEntries(&trans, &handles); diff --git a/chrome/browser/sync/engine/cleanup_disabled_types_command.cc b/chrome/browser/sync/engine/cleanup_disabled_types_command.cc index 1be80891..49a0fda 100644 --- a/chrome/browser/sync/engine/cleanup_disabled_types_command.cc +++ b/chrome/browser/sync/engine/cleanup_disabled_types_command.cc @@ -18,8 +18,8 @@ CleanupDisabledTypesCommand::CleanupDisabledTypesCommand() {} CleanupDisabledTypesCommand::~CleanupDisabledTypesCommand() {} void CleanupDisabledTypesCommand::ExecuteImpl(sessions::SyncSession* session) { - using syncable::ModelEnumSet; - using syncable::ModelEnumSetToString; + using syncable::ModelTypeSet; + using syncable::ModelTypeSetToString; // Because a full directory purge is slow, we avoid purging // undesired types unless we have reason to believe they were @@ -39,14 +39,14 @@ void CleanupDisabledTypesCommand::ExecuteImpl(sessions::SyncSession* session) { // | (failure, browser restart // | before another sync session,..) - const ModelEnumSet enabled_types = + const ModelTypeSet enabled_types = GetRoutingInfoTypes(session->routing_info()); - const ModelEnumSet previous_enabled_types = + const ModelTypeSet previous_enabled_types = GetRoutingInfoTypes( session->context()->previous_session_routing_info()); - ModelEnumSet to_cleanup = Difference(ModelEnumSet::All(), enabled_types); + ModelTypeSet to_cleanup = Difference(ModelTypeSet::All(), enabled_types); // If |previous_enabled_types| is non-empty (i.e., not the first // sync session), set |to_cleanup| to its intersection with @@ -55,10 +55,10 @@ void CleanupDisabledTypesCommand::ExecuteImpl(sessions::SyncSession* session) { to_cleanup.RetainAll(previous_enabled_types); } - DVLOG(1) << "enabled_types = " << ModelEnumSetToString(enabled_types) + DVLOG(1) << "enabled_types = " << ModelTypeSetToString(enabled_types) << ", previous_enabled_types = " - << ModelEnumSetToString(previous_enabled_types) - << ", to_cleanup = " << ModelEnumSetToString(to_cleanup); + << ModelTypeSetToString(previous_enabled_types) + << ", to_cleanup = " << ModelTypeSetToString(to_cleanup); if (to_cleanup.Empty()) return; diff --git a/chrome/browser/sync/engine/cleanup_disabled_types_command_unittest.cc b/chrome/browser/sync/engine/cleanup_disabled_types_command_unittest.cc index ea96bee..f6ad509 100644 --- a/chrome/browser/sync/engine/cleanup_disabled_types_command_unittest.cc +++ b/chrome/browser/sync/engine/cleanup_disabled_types_command_unittest.cc @@ -18,7 +18,7 @@ namespace browser_sync { namespace { using syncable::HasModelTypes; -using syncable::ModelEnumSet; +using syncable::ModelTypeSet; using testing::_; class CleanupDisabledTypesCommandTest : public MockDirectorySyncerCommandTest { @@ -40,7 +40,7 @@ class CleanupDisabledTypesCommandTest : public MockDirectorySyncerCommandTest { // TODO(tim): Add syncer test to verify previous routing info is set. TEST_F(CleanupDisabledTypesCommandTest, NoPreviousRoutingInfo) { CleanupDisabledTypesCommand command; - ModelEnumSet expected = ModelEnumSet::All(); + ModelTypeSet expected = ModelTypeSet::All(); expected.Remove(syncable::BOOKMARKS); EXPECT_CALL(*mock_directory(), PurgeEntriesWithTypeIn(HasModelTypes(expected))); @@ -72,7 +72,7 @@ TEST_F(CleanupDisabledTypesCommandTest, TypeDisabled) { prev[syncable::PREFERENCES] = GROUP_PASSIVE; session()->context()->set_previous_session_routing_info(prev); - const ModelEnumSet expected(syncable::PASSWORDS, syncable::PREFERENCES); + const ModelTypeSet expected(syncable::PASSWORDS, syncable::PREFERENCES); EXPECT_CALL(*mock_directory(), PurgeEntriesWithTypeIn(HasModelTypes(expected))); command.ExecuteImpl(session()); diff --git a/chrome/browser/sync/engine/download_updates_command.cc b/chrome/browser/sync/engine/download_updates_command.cc index b2bcccc5..86414a6e 100644 --- a/chrome/browser/sync/engine/download_updates_command.cc +++ b/chrome/browser/sync/engine/download_updates_command.cc @@ -24,8 +24,8 @@ using sessions::SyncSession; using std::string; using syncable::FIRST_REAL_MODEL_TYPE; using syncable::MODEL_TYPE_COUNT; -using syncable::ModelEnumSet; -using syncable::ModelEnumSetToString; +using syncable::ModelTypeSet; +using syncable::ModelTypeSetToString; DownloadUpdatesCommand::DownloadUpdatesCommand() {} DownloadUpdatesCommand::~DownloadUpdatesCommand() {} @@ -52,15 +52,15 @@ void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { } // Request updates for all enabled types. - const ModelEnumSet enabled_types = + const ModelTypeSet enabled_types = GetRoutingInfoTypes(session->routing_info()); DVLOG(1) << "Getting updates for types " - << ModelEnumSetToString(enabled_types); + << ModelTypeSetToString(enabled_types); DCHECK(!enabled_types.Empty()); const syncable::ModelTypePayloadMap& type_payload_map = session->source().types; - for (ModelEnumSet::Iterator it = enabled_types.First(); + for (ModelTypeSet::Iterator it = enabled_types.First(); it.Good(); it.Inc()) { sync_pb::DataTypeProgressMarker* progress_marker = get_updates->add_from_progress_marker(); diff --git a/chrome/browser/sync/engine/get_commit_ids_command.cc b/chrome/browser/sync/engine/get_commit_ids_command.cc index 2fbd9ed..fa847f7 100644 --- a/chrome/browser/sync/engine/get_commit_ids_command.cc +++ b/chrome/browser/sync/engine/get_commit_ids_command.cc @@ -44,7 +44,7 @@ void GetCommitIdsCommand::ExecuteImpl(SyncSession* session) { passphrase_missing_ = cryptographer->has_pending_keys(); }; - const syncable::ModelEnumSet throttled_types = + const syncable::ModelTypeSet throttled_types = session->context()->GetThrottledTypes(); // We filter out all unready entries from the set of unsynced handles to // ensure we don't trigger useless sync cycles attempting to retry due to @@ -74,10 +74,10 @@ namespace { // and not requiring encryption (any entry containing an encrypted datatype // while the cryptographer requires a passphrase is not ready for commit.) // 2. Its type is not currently throttled. -bool IsEntryReadyForCommit(syncable::ModelEnumSet encrypted_types, +bool IsEntryReadyForCommit(syncable::ModelTypeSet encrypted_types, bool passphrase_missing, const syncable::Entry& entry, - syncable::ModelEnumSet throttled_types) { + syncable::ModelTypeSet throttled_types) { if (!entry.Get(syncable::IS_UNSYNCED)) return false; @@ -121,7 +121,7 @@ bool IsEntryReadyForCommit(syncable::ModelEnumSet encrypted_types, void GetCommitIdsCommand::FilterUnreadyEntries( syncable::BaseTransaction* trans, - syncable::ModelEnumSet throttled_types, + syncable::ModelTypeSet throttled_types, syncable::Directory::UnsyncedMetaHandles* unsynced_handles) { syncable::Directory::UnsyncedMetaHandles::iterator iter; syncable::Directory::UnsyncedMetaHandles new_unsynced_handles; @@ -144,7 +144,7 @@ void GetCommitIdsCommand::AddUncommittedParentsAndTheirPredecessors( syncable::BaseTransaction* trans, syncable::Id parent_id, const ModelSafeRoutingInfo& routes, - syncable::ModelEnumSet throttled_types) { + syncable::ModelTypeSet throttled_types) { OrderedCommitSet item_dependencies(routes); // Climb the tree adding entries leaf -> root. @@ -169,7 +169,7 @@ void GetCommitIdsCommand::AddUncommittedParentsAndTheirPredecessors( } bool GetCommitIdsCommand::AddItem(syncable::Entry* item, - syncable::ModelEnumSet throttled_types, + syncable::ModelTypeSet throttled_types, OrderedCommitSet* result) { if (!IsEntryReadyForCommit(encrypted_types_, passphrase_missing_, *item, throttled_types)) @@ -186,7 +186,7 @@ bool GetCommitIdsCommand::AddItem(syncable::Entry* item, bool GetCommitIdsCommand::AddItemThenPredecessors( syncable::BaseTransaction* trans, - syncable::ModelEnumSet throttled_types, + syncable::ModelTypeSet throttled_types, syncable::Entry* item, syncable::IndexedBitField inclusion_filter, OrderedCommitSet* result) { @@ -210,7 +210,7 @@ bool GetCommitIdsCommand::AddItemThenPredecessors( void GetCommitIdsCommand::AddPredecessorsThenItem( syncable::BaseTransaction* trans, - syncable::ModelEnumSet throttled_types, + syncable::ModelTypeSet throttled_types, syncable::Entry* item, syncable::IndexedBitField inclusion_filter, const ModelSafeRoutingInfo& routes) { @@ -230,7 +230,7 @@ void GetCommitIdsCommand::AddCreatesAndMoves( const vector<int64>& unsynced_handles, syncable::WriteTransaction* write_transaction, const ModelSafeRoutingInfo& routes, - syncable::ModelEnumSet throttled_types) { + syncable::ModelTypeSet throttled_types) { // Add moves and creates, and prepend their uncommitted parents. for (CommitMetahandleIterator iterator(unsynced_handles, write_transaction, ordered_commit_set_.get()); @@ -341,7 +341,7 @@ void GetCommitIdsCommand::AddDeletes(const vector<int64>& unsynced_handles, void GetCommitIdsCommand::BuildCommitIds(const vector<int64>& unsynced_handles, syncable::WriteTransaction* write_transaction, const ModelSafeRoutingInfo& routes, - syncable::ModelEnumSet throttled_types) { + syncable::ModelTypeSet throttled_types) { ordered_commit_set_.reset(new OrderedCommitSet(routes)); // Commits follow these rules: // 1. Moves or creates are preceded by needed folder creates, from diff --git a/chrome/browser/sync/engine/get_commit_ids_command.h b/chrome/browser/sync/engine/get_commit_ids_command.h index 5cd923a..b728671 100644 --- a/chrome/browser/sync/engine/get_commit_ids_command.h +++ b/chrome/browser/sync/engine/get_commit_ids_command.h @@ -34,7 +34,7 @@ class GetCommitIdsCommand : public SyncerCommand { void BuildCommitIds(const vector<int64>& unsynced_handles, syncable::WriteTransaction* write_transaction, const ModelSafeRoutingInfo& routes, - syncable::ModelEnumSet throttled_types); + syncable::ModelTypeSet throttled_types); // TODO(chron): Remove writes from this iterator. As a warning, this // iterator causes writes to entries and so isn't a pure iterator. @@ -117,28 +117,28 @@ class GetCommitIdsCommand : public SyncerCommand { // 2. Its type is currently throttled. void FilterUnreadyEntries( syncable::BaseTransaction* trans, - syncable::ModelEnumSet throttled_types, + syncable::ModelTypeSet throttled_types, syncable::Directory::UnsyncedMetaHandles* unsynced_handles); void AddUncommittedParentsAndTheirPredecessors( syncable::BaseTransaction* trans, syncable::Id parent_id, const ModelSafeRoutingInfo& routes, - syncable::ModelEnumSet throttled_types); + syncable::ModelTypeSet throttled_types); // OrderedCommitSet helpers for adding predecessors in order. // TODO(ncarter): Refactor these so that the |result| parameter goes away, // and AddItem doesn't need to consider two OrderedCommitSets. bool AddItem(syncable::Entry* item, - syncable::ModelEnumSet throttled_types, + syncable::ModelTypeSet throttled_types, sessions::OrderedCommitSet* result); bool AddItemThenPredecessors(syncable::BaseTransaction* trans, - syncable::ModelEnumSet throttled_types, + syncable::ModelTypeSet throttled_types, syncable::Entry* item, syncable::IndexedBitField inclusion_filter, sessions::OrderedCommitSet* result); void AddPredecessorsThenItem(syncable::BaseTransaction* trans, - syncable::ModelEnumSet throttled_types, + syncable::ModelTypeSet throttled_types, syncable::Entry* item, syncable::IndexedBitField inclusion_filter, const ModelSafeRoutingInfo& routes); @@ -148,7 +148,7 @@ class GetCommitIdsCommand : public SyncerCommand { void AddCreatesAndMoves(const vector<int64>& unsynced_handles, syncable::WriteTransaction* write_transaction, const ModelSafeRoutingInfo& routes, - syncable::ModelEnumSet throttled_types); + syncable::ModelTypeSet throttled_types); void AddDeletes(const vector<int64>& unsynced_handles, syncable::WriteTransaction* write_transaction); @@ -157,7 +157,7 @@ class GetCommitIdsCommand : public SyncerCommand { int requested_commit_batch_size_; bool passphrase_missing_; - syncable::ModelEnumSet encrypted_types_; + syncable::ModelTypeSet encrypted_types_; DISALLOW_COPY_AND_ASSIGN(GetCommitIdsCommand); }; diff --git a/chrome/browser/sync/engine/model_safe_worker.cc b/chrome/browser/sync/engine/model_safe_worker.cc index 3ae485d..eb2b903 100644 --- a/chrome/browser/sync/engine/model_safe_worker.cc +++ b/chrome/browser/sync/engine/model_safe_worker.cc @@ -30,9 +30,9 @@ std::string ModelSafeRoutingInfoToString( return json; } -syncable::ModelEnumSet GetRoutingInfoTypes( +syncable::ModelTypeSet GetRoutingInfoTypes( const ModelSafeRoutingInfo& routing_info) { - syncable::ModelEnumSet types; + syncable::ModelTypeSet types; for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); it != routing_info.end(); ++it) { types.Put(it->first); diff --git a/chrome/browser/sync/engine/model_safe_worker.h b/chrome/browser/sync/engine/model_safe_worker.h index 6198496..aa065fc 100644 --- a/chrome/browser/sync/engine/model_safe_worker.h +++ b/chrome/browser/sync/engine/model_safe_worker.h @@ -78,7 +78,7 @@ base::DictionaryValue* ModelSafeRoutingInfoToValue( std::string ModelSafeRoutingInfoToString( const ModelSafeRoutingInfo& routing_info); -syncable::ModelEnumSet GetRoutingInfoTypes( +syncable::ModelTypeSet GetRoutingInfoTypes( const ModelSafeRoutingInfo& routing_info); ModelSafeGroup GetGroupForModelType(const syncable::ModelType type, diff --git a/chrome/browser/sync/engine/model_safe_worker_unittest.cc b/chrome/browser/sync/engine/model_safe_worker_unittest.cc index d701e36..0bd5965 100644 --- a/chrome/browser/sync/engine/model_safe_worker_unittest.cc +++ b/chrome/browser/sync/engine/model_safe_worker_unittest.cc @@ -44,7 +44,7 @@ TEST_F(ModelSafeWorkerTest, GetRoutingInfoTypes) { routing_info[syncable::BOOKMARKS] = GROUP_PASSIVE; routing_info[syncable::NIGORI] = GROUP_UI; routing_info[syncable::PREFERENCES] = GROUP_DB; - const syncable::ModelEnumSet expected_types( + const syncable::ModelTypeSet expected_types( syncable::BOOKMARKS, syncable::NIGORI, syncable::PREFERENCES); diff --git a/chrome/browser/sync/engine/nigori_util.cc b/chrome/browser/sync/engine/nigori_util.cc index 9b089ec..f8a26a9 100644 --- a/chrome/browser/sync/engine/nigori_util.cc +++ b/chrome/browser/sync/engine/nigori_util.cc @@ -38,7 +38,7 @@ bool ProcessUnsyncedChangesForEncryption( bool VerifyUnsyncedChangesAreEncrypted( BaseTransaction* const trans, - ModelEnumSet encrypted_types) { + ModelTypeSet encrypted_types) { std::vector<int64> handles; browser_sync::SyncerUtil::GetUnsyncedEntries(trans, &handles); for (size_t i = 0; i < handles.size(); ++i) { @@ -53,7 +53,7 @@ bool VerifyUnsyncedChangesAreEncrypted( return true; } -bool EntryNeedsEncryption(ModelEnumSet encrypted_types, +bool EntryNeedsEncryption(ModelTypeSet encrypted_types, const Entry& entry) { if (!entry.Get(UNIQUE_SERVER_TAG).empty()) return false; // We don't encrypt unique server nodes. @@ -68,7 +68,7 @@ bool EntryNeedsEncryption(ModelEnumSet encrypted_types, entry.Get(NON_UNIQUE_NAME) != kEncryptedString); } -bool SpecificsNeedsEncryption(ModelEnumSet encrypted_types, +bool SpecificsNeedsEncryption(ModelTypeSet encrypted_types, const sync_pb::EntitySpecifics& specifics) { const ModelType type = GetModelTypeFromSpecifics(specifics); if (type == PASSWORDS || type == NIGORI) diff --git a/chrome/browser/sync/engine/nigori_util.h b/chrome/browser/sync/engine/nigori_util.h index 08ed0d4..33ba53d 100644 --- a/chrome/browser/sync/engine/nigori_util.h +++ b/chrome/browser/sync/engine/nigori_util.h @@ -36,7 +36,7 @@ class WriteTransaction; // modify the data and does not care if data is unnecessarily encrypted. bool VerifyUnsyncedChangesAreEncrypted( BaseTransaction* const trans, - ModelEnumSet encrypted_types); + ModelTypeSet encrypted_types); // Processes all unsynced changes and ensures they are appropriately encrypted // or unencrypted, based on |encrypted_types|. @@ -47,11 +47,11 @@ bool ProcessUnsyncedChangesForEncryption( // Returns true if the entry requires encryption but is not encrypted, false // otherwise. Note: this does not check that already encrypted entries are // encrypted with the proper key. -bool EntryNeedsEncryption(ModelEnumSet encrypted_types, +bool EntryNeedsEncryption(ModelTypeSet encrypted_types, const Entry& entry); // Same as EntryNeedsEncryption, but looks at specifics. -bool SpecificsNeedsEncryption(ModelEnumSet encrypted_types, +bool SpecificsNeedsEncryption(ModelTypeSet encrypted_types, const sync_pb::EntitySpecifics& specifics); // Verifies all data of type |type| is encrypted appropriately. diff --git a/chrome/browser/sync/engine/nigori_util_unittest.cc b/chrome/browser/sync/engine/nigori_util_unittest.cc index 6ec2291..1472f39 100644 --- a/chrome/browser/sync/engine/nigori_util_unittest.cc +++ b/chrome/browser/sync/engine/nigori_util_unittest.cc @@ -12,12 +12,12 @@ namespace syncable { typedef testing::Test NigoriUtilTest; TEST(NigoriUtilTest, SpecificsNeedsEncryption) { - ModelEnumSet encrypted_types; + ModelTypeSet encrypted_types; encrypted_types.Put(BOOKMARKS); encrypted_types.Put(PASSWORDS); sync_pb::EntitySpecifics specifics; - EXPECT_FALSE(SpecificsNeedsEncryption(ModelEnumSet(), specifics)); + EXPECT_FALSE(SpecificsNeedsEncryption(ModelTypeSet(), specifics)); EXPECT_FALSE(SpecificsNeedsEncryption(encrypted_types, specifics)); AddDefaultExtensionValue(PREFERENCES, &specifics); @@ -30,11 +30,11 @@ TEST(NigoriUtilTest, SpecificsNeedsEncryption) { bookmark_specifics.MutableExtension(sync_pb::bookmark)->set_title("title"); bookmark_specifics.MutableExtension(sync_pb::bookmark)->set_url("url"); EXPECT_TRUE(SpecificsNeedsEncryption(encrypted_types, bookmark_specifics)); - EXPECT_FALSE(SpecificsNeedsEncryption(ModelEnumSet(), bookmark_specifics)); + EXPECT_FALSE(SpecificsNeedsEncryption(ModelTypeSet(), bookmark_specifics)); bookmark_specifics.mutable_encrypted(); EXPECT_FALSE(SpecificsNeedsEncryption(encrypted_types, bookmark_specifics)); - EXPECT_FALSE(SpecificsNeedsEncryption(ModelEnumSet(), bookmark_specifics)); + EXPECT_FALSE(SpecificsNeedsEncryption(ModelTypeSet(), bookmark_specifics)); sync_pb::EntitySpecifics password_specifics; AddDefaultExtensionValue(PASSWORDS, &password_specifics); diff --git a/chrome/browser/sync/engine/store_timestamps_command.cc b/chrome/browser/sync/engine/store_timestamps_command.cc index 345f039..140191b 100644 --- a/chrome/browser/sync/engine/store_timestamps_command.cc +++ b/chrome/browser/sync/engine/store_timestamps_command.cc @@ -32,7 +32,7 @@ void StoreTimestampsCommand::ExecuteImpl(sessions::SyncSession* session) { // Update the progress marker tokens from the server result. If a marker // was omitted for any one type, that indicates no change from the previous // state. - syncable::ModelEnumSet forward_progress_types; + syncable::ModelTypeSet forward_progress_types; for (int i = 0; i < updates.new_progress_marker_size(); ++i) { syncable::ModelType model = syncable::GetModelTypeFromExtensionFieldNumber( @@ -49,9 +49,9 @@ void StoreTimestampsCommand::ExecuteImpl(sessions::SyncSession* session) { if (VLOG_IS_ON(1)) { DVLOG_IF(1, !forward_progress_types.Empty()) << "Get Updates got new progress marker for types: " - << syncable::ModelEnumSetToString(forward_progress_types) + << syncable::ModelTypeSetToString(forward_progress_types) << " out of possible: " - << syncable::ModelEnumSetToString(status->updates_request_types()); + << syncable::ModelTypeSetToString(status->updates_request_types()); } if (updates.has_changes_remaining()) { int64 changes_left = updates.changes_remaining(); diff --git a/chrome/browser/sync/engine/sync_scheduler.cc b/chrome/browser/sync/engine/sync_scheduler.cc index 2af0ba3..7bb2d65 100644 --- a/chrome/browser/sync/engine/sync_scheduler.cc +++ b/chrome/browser/sync/engine/sync_scheduler.cc @@ -26,8 +26,8 @@ namespace browser_sync { using sessions::SyncSession; using sessions::SyncSessionSnapshot; using sessions::SyncSourceInfo; -using syncable::ModelEnumSet; -using syncable::ModelEnumSetToString; +using syncable::ModelTypeSet; +using syncable::ModelTypeSetToString; using syncable::ModelTypePayloadMap; using sync_pb::GetUpdatesCallerInfo; @@ -460,13 +460,13 @@ void SyncScheduler::ScheduleCleanupDisabledTypes() { void SyncScheduler::ScheduleNudge( const TimeDelta& delay, - NudgeSource source, ModelEnumSet types, + NudgeSource source, ModelTypeSet types, const tracked_objects::Location& nudge_location) { DCHECK_EQ(MessageLoop::current(), sync_loop_); SDVLOG_LOC(nudge_location, 2) << "Nudge scheduled with delay " << delay.InMilliseconds() << " ms, " << "source " << GetNudgeSourceString(source) << ", " - << "types " << ModelEnumSetToString(types); + << "types " << ModelTypeSetToString(types); ModelTypePayloadMap types_with_payloads = syncable::ModelTypePayloadMapFromEnumSet(types, std::string()); @@ -563,7 +563,7 @@ void SyncScheduler::ScheduleNudgeImpl( // Helper to extract the routing info and workers corresponding to types in // |types| from |registrar|. -void GetModelSafeParamsForTypes(ModelEnumSet types, +void GetModelSafeParamsForTypes(ModelTypeSet types, ModelSafeWorkerRegistrar* registrar, ModelSafeRoutingInfo* routes, std::vector<ModelSafeWorker*>* workers) { ModelSafeRoutingInfo r_tmp; @@ -574,7 +574,7 @@ void GetModelSafeParamsForTypes(ModelEnumSet types, bool passive_group_added = false; typedef std::vector<ModelSafeWorker*>::const_iterator iter; - for (ModelEnumSet::Iterator it = types.First(); + for (ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) { const syncable::ModelType t = it.Get(); DCHECK_EQ(1U, r_tmp.count(t)); @@ -606,7 +606,7 @@ void GetModelSafeParamsForTypes(ModelEnumSet types, } void SyncScheduler::ScheduleConfig( - ModelEnumSet types, + ModelTypeSet types, GetUpdatesCallerInfo::GetUpdatesSource source) { DCHECK_EQ(MessageLoop::current(), sync_loop_); DCHECK(IsConfigRelatedUpdateSourceValue(source)); diff --git a/chrome/browser/sync/engine/sync_scheduler.h b/chrome/browser/sync/engine/sync_scheduler.h index ad5cf02..f5617fc 100644 --- a/chrome/browser/sync/engine/sync_scheduler.h +++ b/chrome/browser/sync/engine/sync_scheduler.h @@ -79,7 +79,7 @@ class SyncScheduler : public sessions::SyncSession::Delegate, // The meat and potatoes. void ScheduleNudge(const base::TimeDelta& delay, NudgeSource source, - syncable::ModelEnumSet types, + syncable::ModelTypeSet types, const tracked_objects::Location& nudge_location); void ScheduleNudgeWithPayloads( const base::TimeDelta& delay, NudgeSource source, @@ -89,7 +89,7 @@ class SyncScheduler : public sessions::SyncSession::Delegate, // Note: The source argument of this function must come from the subset of // GetUpdatesCallerInfo values related to configurations. void ScheduleConfig( - syncable::ModelEnumSet types, + syncable::ModelTypeSet types, sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); void ScheduleClearUserData(); diff --git a/chrome/browser/sync/engine/sync_scheduler_unittest.cc b/chrome/browser/sync/engine/sync_scheduler_unittest.cc index 672aa63..b44a88c 100644 --- a/chrome/browser/sync/engine/sync_scheduler_unittest.cc +++ b/chrome/browser/sync/engine/sync_scheduler_unittest.cc @@ -32,7 +32,7 @@ namespace browser_sync { using sessions::SyncSession; using sessions::SyncSessionContext; using sessions::SyncSessionSnapshot; -using syncable::ModelEnumSet; +using syncable::ModelTypeSet; using sync_pb::GetUpdatesCallerInfo; class MockSyncer : public Syncer { @@ -150,7 +150,7 @@ class SyncSchedulerTest : public testing::Test { } bool GetBackoffAndResetTest() { - ModelEnumSet nudge_types; + ModelTypeSet nudge_types; StartSyncScheduler(SyncScheduler::NORMAL_MODE); RunLoop(); @@ -178,10 +178,10 @@ class SyncSchedulerTest : public testing::Test { scheduler_->delay_provider_.reset(delay_); } - // Compare a ModelEnumSet to a ModelTypePayloadMap, ignoring + // Compare a ModelTypeSet to a ModelTypePayloadMap, ignoring // payload values. - bool CompareModelEnumSetToModelTypePayloadMap( - ModelEnumSet lhs, + bool CompareModelTypeSetToModelTypePayloadMap( + ModelTypeSet lhs, const syncable::ModelTypePayloadMap& rhs) { size_t count = 0; for (syncable::ModelTypePayloadMap::const_iterator i = rhs.begin(); @@ -239,7 +239,7 @@ ACTION(QuitLoopNowAction) { // Test nudge scheduling. TEST_F(SyncSchedulerTest, Nudge) { SyncShareRecords records; - ModelEnumSet model_types(syncable::BOOKMARKS); + ModelTypeSet model_types(syncable::BOOKMARKS); EXPECT_CALL(*syncer(), SyncShare(_,_,_)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess), @@ -254,7 +254,7 @@ TEST_F(SyncSchedulerTest, Nudge) { RunLoop(); ASSERT_EQ(1U, records.snapshots.size()); - EXPECT_TRUE(CompareModelEnumSetToModelTypePayloadMap(model_types, + EXPECT_TRUE(CompareModelTypeSetToModelTypePayloadMap(model_types, records.snapshots[0]->source.types)); EXPECT_EQ(GetUpdatesCallerInfo::LOCAL, records.snapshots[0]->source.updates_source); @@ -273,7 +273,7 @@ TEST_F(SyncSchedulerTest, Nudge) { RunLoop(); ASSERT_EQ(1U, records2.snapshots.size()); - EXPECT_TRUE(CompareModelEnumSetToModelTypePayloadMap(model_types, + EXPECT_TRUE(CompareModelTypeSetToModelTypePayloadMap(model_types, records2.snapshots[0]->source.types)); EXPECT_EQ(GetUpdatesCallerInfo::LOCAL, records2.snapshots[0]->source.updates_source); @@ -283,7 +283,7 @@ TEST_F(SyncSchedulerTest, Nudge) { // errors. TEST_F(SyncSchedulerTest, Config) { SyncShareRecords records; - const ModelEnumSet model_types(syncable::BOOKMARKS); + const ModelTypeSet model_types(syncable::BOOKMARKS); EXPECT_CALL(*syncer(), SyncShare(_,_,_)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess), @@ -297,7 +297,7 @@ TEST_F(SyncSchedulerTest, Config) { RunLoop(); ASSERT_EQ(1U, records.snapshots.size()); - EXPECT_TRUE(CompareModelEnumSetToModelTypePayloadMap(model_types, + EXPECT_TRUE(CompareModelTypeSetToModelTypePayloadMap(model_types, records.snapshots[0]->source.types)); EXPECT_EQ(GetUpdatesCallerInfo::RECONFIGURATION, records.snapshots[0]->source.updates_source); @@ -309,7 +309,7 @@ TEST_F(SyncSchedulerTest, ConfigWithBackingOff) { EXPECT_CALL(*delay(), GetDelay(_)) .WillRepeatedly(Return(TimeDelta::FromMilliseconds(1))); SyncShareRecords records; - const ModelEnumSet model_types(syncable::BOOKMARKS); + const ModelTypeSet model_types(syncable::BOOKMARKS); EXPECT_CALL(*syncer(), SyncShare(_,_,_)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateCommitFailed), @@ -329,7 +329,7 @@ TEST_F(SyncSchedulerTest, ConfigWithBackingOff) { RunLoop(); ASSERT_EQ(2U, records.snapshots.size()); - EXPECT_TRUE(CompareModelEnumSetToModelTypePayloadMap(model_types, + EXPECT_TRUE(CompareModelTypeSetToModelTypePayloadMap(model_types, records.snapshots[1]->source.types)); EXPECT_EQ(GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION, records.snapshots[1]->source.updates_source); @@ -338,7 +338,7 @@ TEST_F(SyncSchedulerTest, ConfigWithBackingOff) { // Issue 2 config commands. Second one right after the first has failed // and make sure LATEST is executed. TEST_F(SyncSchedulerTest, MultipleConfigWithBackingOff) { - const ModelEnumSet + const ModelTypeSet model_types1(syncable::BOOKMARKS), model_types2(syncable::AUTOFILL); UseMockDelayProvider(); @@ -371,7 +371,7 @@ TEST_F(SyncSchedulerTest, MultipleConfigWithBackingOff) { RunLoop(); ASSERT_EQ(3U, records.snapshots.size()); - EXPECT_TRUE(CompareModelEnumSetToModelTypePayloadMap(model_types2, + EXPECT_TRUE(CompareModelTypeSetToModelTypePayloadMap(model_types2, records.snapshots[2]->source.types)); EXPECT_EQ(GetUpdatesCallerInfo::RECONFIGURATION, records.snapshots[2]->source.updates_source); @@ -380,7 +380,7 @@ TEST_F(SyncSchedulerTest, MultipleConfigWithBackingOff) { // Issue a nudge when the config has failed. Make sure both the config and // nudge are executed. TEST_F(SyncSchedulerTest, NudgeWithConfigWithBackingOff) { - const ModelEnumSet model_types(syncable::BOOKMARKS); + const ModelTypeSet model_types(syncable::BOOKMARKS); UseMockDelayProvider(); EXPECT_CALL(*delay(), GetDelay(_)) .WillRepeatedly(Return(TimeDelta::FromMilliseconds(50))); @@ -419,12 +419,12 @@ TEST_F(SyncSchedulerTest, NudgeWithConfigWithBackingOff) { ASSERT_EQ(4U, records.snapshots.size()); - EXPECT_TRUE(CompareModelEnumSetToModelTypePayloadMap(model_types, + EXPECT_TRUE(CompareModelTypeSetToModelTypePayloadMap(model_types, records.snapshots[2]->source.types)); EXPECT_EQ(GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION, records.snapshots[2]->source.updates_source); - EXPECT_TRUE(CompareModelEnumSetToModelTypePayloadMap(model_types, + EXPECT_TRUE(CompareModelTypeSetToModelTypePayloadMap(model_types, records.snapshots[3]->source.types)); EXPECT_EQ(GetUpdatesCallerInfo::LOCAL, records.snapshots[3]->source.updates_source); @@ -440,7 +440,7 @@ TEST_F(SyncSchedulerTest, NudgeCoalescing) { EXPECT_CALL(*syncer(), SyncShare(_,_,_)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess), WithArg<0>(RecordSyncShare(&r)))); - const ModelEnumSet + const ModelTypeSet types1(syncable::BOOKMARKS), types2(syncable::AUTOFILL), types3(syncable::THEMES); @@ -454,7 +454,7 @@ TEST_F(SyncSchedulerTest, NudgeCoalescing) { ASSERT_EQ(1U, r.snapshots.size()); EXPECT_GE(r.times[0], optimal_time); - EXPECT_TRUE(CompareModelEnumSetToModelTypePayloadMap( + EXPECT_TRUE(CompareModelTypeSetToModelTypePayloadMap( Union(types1, types2), r.snapshots[0]->source.types)); EXPECT_EQ(GetUpdatesCallerInfo::LOCAL, r.snapshots[0]->source.updates_source); @@ -470,7 +470,7 @@ TEST_F(SyncSchedulerTest, NudgeCoalescing) { RunLoop(); ASSERT_EQ(1U, r2.snapshots.size()); - EXPECT_TRUE(CompareModelEnumSetToModelTypePayloadMap(types3, + EXPECT_TRUE(CompareModelTypeSetToModelTypePayloadMap(types3, r2.snapshots[0]->source.types)); EXPECT_EQ(GetUpdatesCallerInfo::NOTIFICATION, r2.snapshots[0]->source.updates_source); @@ -652,7 +652,7 @@ TEST_F(SyncSchedulerTest, SessionsCommitDelay) { RunLoop(); EXPECT_EQ(delay1, scheduler()->sessions_commit_delay()); - const ModelEnumSet model_types(syncable::BOOKMARKS); + const ModelTypeSet model_types(syncable::BOOKMARKS); scheduler()->ScheduleNudge( zero(), NUDGE_SOURCE_LOCAL, model_types, FROM_HERE); RunLoop(); @@ -671,7 +671,7 @@ TEST_F(SyncSchedulerTest, HasMoreToSync) { RunLoop(); scheduler()->ScheduleNudge( - zero(), NUDGE_SOURCE_LOCAL, ModelEnumSet(), FROM_HERE); + zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(), FROM_HERE); RunLoop(); // If more nudges are scheduled, they'll be waited on by TearDown, and would // cause our expectation to break. @@ -679,7 +679,7 @@ TEST_F(SyncSchedulerTest, HasMoreToSync) { // Test that no syncing occurs when throttled. TEST_F(SyncSchedulerTest, ThrottlingDoesThrottle) { - const ModelEnumSet types(syncable::BOOKMARKS); + const ModelTypeSet types(syncable::BOOKMARKS); TimeDelta poll(TimeDelta::FromMilliseconds(5)); TimeDelta throttle(TimeDelta::FromMinutes(10)); scheduler()->OnReceivedLongPollIntervalUpdate(poll); @@ -740,20 +740,20 @@ TEST_F(SyncSchedulerTest, ConfigurationMode) { StartSyncScheduler(SyncScheduler::CONFIGURATION_MODE); RunLoop(); - const ModelEnumSet nudge_types(syncable::AUTOFILL); + const ModelTypeSet nudge_types(syncable::AUTOFILL); scheduler()->ScheduleNudge( zero(), NUDGE_SOURCE_LOCAL, nudge_types, FROM_HERE); scheduler()->ScheduleNudge( zero(), NUDGE_SOURCE_LOCAL, nudge_types, FROM_HERE); - const ModelEnumSet config_types(syncable::BOOKMARKS); + const ModelTypeSet config_types(syncable::BOOKMARKS); scheduler()->ScheduleConfig( config_types, GetUpdatesCallerInfo::RECONFIGURATION); RunLoop(); ASSERT_EQ(1U, records.snapshots.size()); - EXPECT_TRUE(CompareModelEnumSetToModelTypePayloadMap(config_types, + EXPECT_TRUE(CompareModelTypeSetToModelTypePayloadMap(config_types, records.snapshots[0]->source.types)); } @@ -801,7 +801,7 @@ TEST_F(SyncSchedulerTest, BackoffTriggers) { TEST_F(SyncSchedulerTest, BackoffDropsJobs) { SyncShareRecords r; TimeDelta poll(TimeDelta::FromMilliseconds(5)); - const ModelEnumSet types(syncable::BOOKMARKS); + const ModelTypeSet types(syncable::BOOKMARKS); scheduler()->OnReceivedLongPollIntervalUpdate(poll); UseMockDelayProvider(); @@ -965,7 +965,7 @@ TEST_F(SyncSchedulerTest, SyncerSteps) { RunLoop(); scheduler()->ScheduleNudge( - zero(), NUDGE_SOURCE_LOCAL, ModelEnumSet(), FROM_HERE); + zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(), FROM_HERE); PumpLoop(); // Pump again to run job. PumpLoop(); @@ -992,7 +992,7 @@ TEST_F(SyncSchedulerTest, SyncerSteps) { RunLoop(); scheduler()->ScheduleConfig( - ModelEnumSet(), GetUpdatesCallerInfo::RECONFIGURATION); + ModelTypeSet(), GetUpdatesCallerInfo::RECONFIGURATION); PumpLoop(); PumpLoop(); @@ -1044,7 +1044,7 @@ TEST_F(SyncSchedulerTest, StartWhenNotConnected) { RunLoop(); scheduler()->ScheduleNudge( - zero(), NUDGE_SOURCE_LOCAL, ModelEnumSet(), FROM_HERE); + zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(), FROM_HERE); // Should save the nudge for until after the server is reachable. PumpLoop(); @@ -1064,7 +1064,7 @@ TEST_F(SyncSchedulerTest, SetsPreviousRoutingInfo) { RunLoop(); scheduler()->ScheduleNudge( - zero(), NUDGE_SOURCE_LOCAL, ModelEnumSet(), FROM_HERE); + zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(), FROM_HERE); PumpLoop(); // Pump again to run job. PumpLoop(); diff --git a/chrome/browser/sync/engine/syncer_proto_util.cc b/chrome/browser/sync/engine/syncer_proto_util.cc index 5c7f757..b70f0cc 100644 --- a/chrome/browser/sync/engine/syncer_proto_util.cc +++ b/chrome/browser/sync/engine/syncer_proto_util.cc @@ -87,7 +87,7 @@ void SyncerProtoUtil::HandleMigrationDoneResponse( sessions::SyncSession* session) { LOG_IF(ERROR, 0 >= response->migrated_data_type_id_size()) << "MIGRATION_DONE but no types specified."; - syncable::ModelEnumSet to_migrate; + syncable::ModelTypeSet to_migrate; for (int i = 0; i < response->migrated_data_type_id_size(); i++) { to_migrate.Put(syncable::GetModelTypeFromExtensionFieldNumber( response->migrated_data_type_id(i))); diff --git a/chrome/browser/sync/engine/syncer_proto_util_unittest.cc b/chrome/browser/sync/engine/syncer_proto_util_unittest.cc index 1fd0f67..f5cee2c 100644 --- a/chrome/browser/sync/engine/syncer_proto_util_unittest.cc +++ b/chrome/browser/sync/engine/syncer_proto_util_unittest.cc @@ -36,7 +36,7 @@ class MockSyncSessionContext : public SyncSessionContext { public: MockSyncSessionContext() {} ~MockSyncSessionContext() {} - MOCK_METHOD2(SetUnthrottleTime, void(syncable::ModelEnumSet, + MOCK_METHOD2(SetUnthrottleTime, void(syncable::ModelTypeSet, const base::TimeTicks&)); }; @@ -275,7 +275,7 @@ TEST_F(SyncerProtoUtilTest, HandleThrottlingWithDatatypes) { MockSyncSessionContext context; SyncProtocolError error; error.error_type = browser_sync::THROTTLED; - syncable::ModelEnumSet types; + syncable::ModelTypeSet types; types.Put(syncable::BOOKMARKS); types.Put(syncable::PASSWORDS); error.error_data_types = types; diff --git a/chrome/browser/sync/engine/syncer_unittest.cc b/chrome/browser/sync/engine/syncer_unittest.cc index eabe323..405bf45 100644 --- a/chrome/browser/sync/engine/syncer_unittest.cc +++ b/chrome/browser/sync/engine/syncer_unittest.cc @@ -144,7 +144,7 @@ class SyncerTest : public testing::Test, virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) OVERRIDE { // We're just testing the sync engine here, so we shunt everything to // the SyncerThread. Datatypes which aren't enabled aren't in the map. - for (syncable::ModelEnumSet::Iterator it = enabled_datatypes_.First(); + for (syncable::ModelTypeSet::Iterator it = enabled_datatypes_.First(); it.Good(); it.Inc()) { (*out)[it.Get()] = GROUP_PASSIVE; } @@ -370,7 +370,7 @@ class SyncerTest : public testing::Test, GetCommitIdsCommand command(limit); command.BuildCommitIds( session_->status_controller().unsynced_handles(), - session_->write_transaction(), routes, syncable::ModelEnumSet()); + session_->write_transaction(), routes, syncable::ModelTypeSet()); vector<syncable::Id> output = command.ordered_commit_set_->GetAllCommitIds(); size_t truncated_size = std::min(limit, expected_id_order.size()); @@ -495,7 +495,7 @@ class SyncerTest : public testing::Test, base::TimeDelta last_sessions_commit_delay_seconds_; scoped_refptr<ModelSafeWorker> worker_; - syncable::ModelEnumSet enabled_datatypes_; + syncable::ModelTypeSet enabled_datatypes_; DISALLOW_COPY_AND_ASSIGN(SyncerTest); }; @@ -558,7 +558,7 @@ TEST_F(SyncerTest, GetCommitIdsCommandTruncates) { TEST_F(SyncerTest, GetCommitIdsFiltersThrottledEntries) { ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); ASSERT_TRUE(dir.good()); - const syncable::ModelEnumSet throttled_types(syncable::BOOKMARKS); + const syncable::ModelTypeSet throttled_types(syncable::BOOKMARKS); KeyParams key_params = {"localhost", "dummy", "foobar"}; sync_pb::EntitySpecifics bookmark_data; AddDefaultExtensionValue(syncable::BOOKMARKS, &bookmark_data); @@ -856,7 +856,7 @@ TEST_F(SyncerTest, TestPurgeWhileUnsynced) { parent2.Put(syncable::ID, pref_node_id); } - dir->PurgeEntriesWithTypeIn(syncable::ModelEnumSet(syncable::PREFERENCES)); + dir->PurgeEntriesWithTypeIn(syncable::ModelTypeSet(syncable::PREFERENCES)); const StatusController& status = session_->status_controller(); syncer_->SyncShare(session_.get(), SYNCER_BEGIN, SYNCER_END); @@ -894,7 +894,7 @@ TEST_F(SyncerTest, TestPurgeWhileUnapplied) { parent.Put(syncable::ID, parent_id_); } - dir->PurgeEntriesWithTypeIn(syncable::ModelEnumSet(syncable::BOOKMARKS)); + dir->PurgeEntriesWithTypeIn(syncable::ModelTypeSet(syncable::BOOKMARKS)); syncer_->SyncShare(session_.get(), SYNCER_BEGIN, SYNCER_END); dir->SaveChanges(); @@ -2156,8 +2156,8 @@ TEST_F(SyncerTest, CommitsUpdateDoesntAlterEntry) { } TEST_F(SyncerTest, ParentAndChildBothMatch) { - const syncable::FullModelEnumSet all_types = - syncable::FullModelEnumSet::All(); + const syncable::FullModelTypeSet all_types = + syncable::FullModelTypeSet::All(); ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); CHECK(dir.good()); syncable::Id parent_id = ids_.NewServerId(); diff --git a/chrome/browser/sync/engine/syncer_util.cc b/chrome/browser/sync/engine/syncer_util.cc index 77551d9..1be2e0c 100644 --- a/chrome/browser/sync/engine/syncer_util.cc +++ b/chrome/browser/sync/engine/syncer_util.cc @@ -299,7 +299,7 @@ UpdateAttemptResponse SyncerUtil::AttemptToUpdateEntry( cryptographer->Update(nigori); // Make sure any unsynced changes are properly encrypted as necessary. - const syncable::ModelEnumSet encrypted_types = + const syncable::ModelTypeSet encrypted_types = cryptographer->GetEncryptedTypes(); if (!VerifyUnsyncedChangesAreEncrypted(trans, encrypted_types) && (!cryptographer->is_ready() || diff --git a/chrome/browser/sync/failed_datatypes_handler.cc b/chrome/browser/sync/failed_datatypes_handler.cc index 2bd5864..1094982 100644 --- a/chrome/browser/sync/failed_datatypes_handler.cc +++ b/chrome/browser/sync/failed_datatypes_handler.cc @@ -15,8 +15,8 @@ FailedDatatypesHandler::FailedDatatypesHandler(ProfileSyncService* service) FailedDatatypesHandler::~FailedDatatypesHandler() { } -syncable::ModelEnumSet FailedDatatypesHandler::GetFailedTypes() const { - syncable::ModelEnumSet result; +syncable::ModelTypeSet FailedDatatypesHandler::GetFailedTypes() const { + syncable::ModelTypeSet result; for (std::list<SyncError>::const_iterator it = errors_.begin(); it != errors_.end(); ++it) { DCHECK(!result.Has(it->type())); @@ -27,7 +27,7 @@ syncable::ModelEnumSet FailedDatatypesHandler::GetFailedTypes() const { bool FailedDatatypesHandler::UpdateFailedDatatypes( DataTypeManager::ConfigureResult result) { - const syncable::ModelEnumSet types = GetFailedTypes(); + const syncable::ModelTypeSet types = GetFailedTypes(); bool any_new_failed_types = false; for (std::list<SyncError>::iterator it = result.errors.begin(); it != result.errors.end(); ++it) { diff --git a/chrome/browser/sync/failed_datatypes_handler.h b/chrome/browser/sync/failed_datatypes_handler.h index b03713c..5b5ca7a 100644 --- a/chrome/browser/sync/failed_datatypes_handler.h +++ b/chrome/browser/sync/failed_datatypes_handler.h @@ -28,7 +28,7 @@ class FailedDatatypesHandler { void OnUserChoseDatatypes(); // Returns the types that are failing. - syncable::ModelEnumSet GetFailedTypes() const; + syncable::ModelTypeSet GetFailedTypes() const; // Returns if there are any failed types. bool AnyFailedDatatype() const; diff --git a/chrome/browser/sync/glue/bookmark_model_associator.cc b/chrome/browser/sync/glue/bookmark_model_associator.cc index 90b019f9..1dbb162 100644 --- a/chrome/browser/sync/glue/bookmark_model_associator.cc +++ b/chrome/browser/sync/glue/bookmark_model_associator.cc @@ -617,7 +617,7 @@ bool BookmarkModelAssociator::LoadAssociations() { bool BookmarkModelAssociator::CryptoReadyIfNecessary() { // We only access the cryptographer while holding a transaction. sync_api::ReadTransaction trans(FROM_HERE, user_share_); - const syncable::ModelEnumSet encrypted_types = + const syncable::ModelTypeSet encrypted_types = sync_api::GetEncryptedTypes(&trans); return !encrypted_types.Has(syncable::BOOKMARKS) || trans.GetCryptographer()->is_ready(); diff --git a/chrome/browser/sync/glue/data_type_manager.h b/chrome/browser/sync/glue/data_type_manager.h index eb02f11..3235fdd 100644 --- a/chrome/browser/sync/glue/data_type_manager.h +++ b/chrome/browser/sync/glue/data_type_manager.h @@ -48,7 +48,7 @@ class DataTypeManager { UNRECOVERABLE_ERROR // We got an unrecoverable error during startup. }; - typedef syncable::ModelEnumSet TypeSet; + typedef syncable::ModelTypeSet TypeSet; // Note: |errors| is only filled when status is not OK. struct ConfigureResult { diff --git a/chrome/browser/sync/glue/data_type_manager_impl.cc b/chrome/browser/sync/glue/data_type_manager_impl.cc index 5d5fd50..714ca23 100644 --- a/chrome/browser/sync/glue/data_type_manager_impl.cc +++ b/chrome/browser/sync/glue/data_type_manager_impl.cc @@ -217,16 +217,16 @@ void DataTypeManagerImpl::Restart(sync_api::ConfigureReason reason, // The task will be invoked when updates are downloaded. state_ = DOWNLOAD_PENDING; // Hopefully http://crbug.com/79970 will make this less verbose. - syncable::ModelEnumSet all_types; + syncable::ModelTypeSet all_types; for (DataTypeController::TypeMap::const_iterator it = controllers_->begin(); it != controllers_->end(); ++it) { all_types.Put(it->first); } - const syncable::ModelEnumSet types_to_add = last_requested_types_; + const syncable::ModelTypeSet types_to_add = last_requested_types_; // Check that types_to_add \subseteq all_types. DCHECK(all_types.HasAll(types_to_add)); // Set types_to_remove to all_types \setminus types_to_add. - const syncable::ModelEnumSet types_to_remove = + const syncable::ModelTypeSet types_to_remove = Difference(all_types, types_to_add); backend_->ConfigureDataTypes( types_to_add, @@ -268,7 +268,7 @@ bool DataTypeManagerImpl::ProcessReconfigure() { } void DataTypeManagerImpl::DownloadReady( - syncable::ModelEnumSet failed_configuration_types) { + syncable::ModelTypeSet failed_configuration_types) { DCHECK_EQ(state_, DOWNLOAD_PENDING); // Ignore |failed_configuration_types| if we need to reconfigure @@ -280,7 +280,7 @@ void DataTypeManagerImpl::DownloadReady( if (!failed_configuration_types.Empty()) { std::string error_msg = "Configuration failed for types " + - syncable::ModelEnumSetToString(failed_configuration_types); + syncable::ModelTypeSetToString(failed_configuration_types); SyncError error(FROM_HERE, error_msg, failed_configuration_types.First().Get()); Abort(UNRECOVERABLE_ERROR, error); diff --git a/chrome/browser/sync/glue/data_type_manager_impl.h b/chrome/browser/sync/glue/data_type_manager_impl.h index a3c9f86..31df234 100644 --- a/chrome/browser/sync/glue/data_type_manager_impl.h +++ b/chrome/browser/sync/glue/data_type_manager_impl.h @@ -66,7 +66,7 @@ class DataTypeManagerImpl : public DataTypeManager { bool ProcessReconfigure(); void Restart(sync_api::ConfigureReason reason, bool enable_nigori); - void DownloadReady(syncable::ModelEnumSet failed_configuration_types); + void DownloadReady(syncable::ModelTypeSet failed_configuration_types); void NotifyStart(); void NotifyDone(const ConfigureResult& result); void SetBlockedAndNotify(); diff --git a/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc b/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc index 0e7b265..f54b11d 100644 --- a/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc +++ b/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc @@ -55,12 +55,12 @@ DataTypeManager::ConfigureStatus GetStatus( } void DoConfigureDataTypes( - syncable::ModelEnumSet types_to_add, - syncable::ModelEnumSet types_to_remove, + syncable::ModelTypeSet types_to_add, + syncable::ModelTypeSet types_to_remove, sync_api::ConfigureReason reason, - base::Callback<void(syncable::ModelEnumSet)> ready_task, + base::Callback<void(syncable::ModelTypeSet)> ready_task, bool enable_nigori) { - ready_task.Run(syncable::ModelEnumSet()); + ready_task.Run(syncable::ModelTypeSet()); } void QuitMessageLoop() { @@ -243,7 +243,7 @@ class DataTypeManagerImplTest : public testing::Test { void RunConfigureWhileDownloadPendingTest( bool enable_nigori, - syncable::ModelEnumSet first_configure_result) { + syncable::ModelTypeSet first_configure_result) { DataTypeControllerMock* bookmark_dtc = MakeBookmarkDTC(); SetStartStopExpectations(bookmark_dtc); controllers_[syncable::BOOKMARKS] = bookmark_dtc; @@ -255,7 +255,7 @@ class DataTypeManagerImplTest : public testing::Test { DataTypeManagerImpl dtm(&backend_, &controllers_); SetConfigureStartExpectation(); SetConfigureDoneExpectation(DataTypeManager::OK); - base::Callback<void(syncable::ModelEnumSet)> task; + base::Callback<void(syncable::ModelTypeSet)> task; // Grab the task the first time this is called so we can configure // before it is finished. EXPECT_CALL(backend_, ConfigureDataTypes(_, _, _, _, enable_nigori)). @@ -289,7 +289,7 @@ class DataTypeManagerImplTest : public testing::Test { NiceMock<SyncBackendHostMock> backend_; content::NotificationObserverMock observer_; content::NotificationRegistrar registrar_; - syncable::ModelEnumSet types_; + syncable::ModelTypeSet types_; }; TEST_F(DataTypeManagerImplTest, NoControllers) { @@ -565,20 +565,20 @@ TEST_F(DataTypeManagerImplTest, OneControllerFailsAssociation) { TEST_F(DataTypeManagerImplTest, ConfigureWhileDownloadPending) { RunConfigureWhileDownloadPendingTest( true /* enable_nigori */, - syncable::ModelEnumSet() /* first_configure_result */); + syncable::ModelTypeSet() /* first_configure_result */); } TEST_F(DataTypeManagerImplTest, ConfigureWhileDownloadPendingWithoutNigori) { RunConfigureWhileDownloadPendingTest( false /* enable_nigori */, - syncable::ModelEnumSet() /* first_configure_result */); + syncable::ModelTypeSet() /* first_configure_result */); } TEST_F(DataTypeManagerImplTest, ConfigureWhileDownloadPendingFail) { RunConfigureWhileDownloadPendingTest( true /* enable_nigori */, /* first_configure_result */ - syncable::ModelEnumSet(syncable::BOOKMARKS)); + syncable::ModelTypeSet(syncable::BOOKMARKS)); } TEST_F(DataTypeManagerImplTest, @@ -586,7 +586,7 @@ TEST_F(DataTypeManagerImplTest, RunConfigureWhileDownloadPendingTest( false /* enable_nigori */, /* first_configure_result */ - syncable::ModelEnumSet(syncable::BOOKMARKS)); + syncable::ModelTypeSet(syncable::BOOKMARKS)); } TEST_F(DataTypeManagerImplTest, StopWhileDownloadPending) { @@ -597,7 +597,7 @@ TEST_F(DataTypeManagerImplTest, StopWhileDownloadPending) { DataTypeManagerImpl dtm(&backend_, &controllers_); SetConfigureStartExpectation(); SetConfigureDoneExpectation(DataTypeManager::ABORTED); - base::Callback<void(syncable::ModelEnumSet)> task; + base::Callback<void(syncable::ModelTypeSet)> task; // Grab the task the first time this is called so we can stop // before it is finished. EXPECT_CALL(backend_, ConfigureDataTypes(_, _, _, _, true)). @@ -614,5 +614,5 @@ TEST_F(DataTypeManagerImplTest, StopWhileDownloadPending) { // It should be perfectly safe to run this task even though the DTM // has been stopped. - task.Run(syncable::ModelEnumSet()); + task.Run(syncable::ModelTypeSet()); } diff --git a/chrome/browser/sync/glue/data_type_manager_mock.cc b/chrome/browser/sync/glue/data_type_manager_mock.cc index ebc70ed..be50dbb 100644 --- a/chrome/browser/sync/glue/data_type_manager_mock.cc +++ b/chrome/browser/sync/glue/data_type_manager_mock.cc @@ -9,7 +9,7 @@ namespace browser_sync { DataTypeManagerMock::DataTypeManagerMock() - : result_(OK, syncable::ModelEnumSet()) { + : result_(OK, syncable::ModelTypeSet()) { // By default, calling Configure will send a SYNC_CONFIGURE_START // and SYNC_CONFIGURE_DONE notification with a DataTypeManager::OK diff --git a/chrome/browser/sync/glue/generic_change_processor.cc b/chrome/browser/sync/glue/generic_change_processor.cc index d9fa42a..b714036 100644 --- a/chrome/browser/sync/glue/generic_change_processor.cc +++ b/chrome/browser/sync/glue/generic_change_processor.cc @@ -252,7 +252,7 @@ bool GenericChangeProcessor::CryptoReadyIfNecessary(syncable::ModelType type) { DCHECK_NE(type, syncable::UNSPECIFIED); // We only access the cryptographer while holding a transaction. sync_api::ReadTransaction trans(FROM_HERE, share_handle()); - const syncable::ModelEnumSet encrypted_types = GetEncryptedTypes(&trans); + const syncable::ModelTypeSet encrypted_types = GetEncryptedTypes(&trans); return !encrypted_types.Has(type) || trans.GetCryptographer()->is_ready(); } diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc index 8d6f54e..66d8634 100644 --- a/chrome/browser/sync/glue/session_model_associator.cc +++ b/chrome/browser/sync/glue/session_model_associator.cc @@ -1247,7 +1247,7 @@ void SessionModelAssociator::PopulateSessionSpecificsTab( bool SessionModelAssociator::CryptoReadyIfNecessary() { // We only access the cryptographer while holding a transaction. sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); - const syncable::ModelEnumSet encrypted_types = + const syncable::ModelTypeSet encrypted_types = sync_api::GetEncryptedTypes(&trans); return !encrypted_types.Has(SESSIONS) || sync_service_->IsCryptographerReady(&trans); diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index 255f3e3..58d519e 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -102,7 +102,7 @@ void SyncBackendHost::Initialize( SyncFrontend* frontend, const WeakHandle<JsEventHandler>& event_handler, const GURL& sync_service_url, - syncable::ModelEnumSet initial_types, + syncable::ModelTypeSet initial_types, const SyncCredentials& credentials, bool delete_sync_data_folder) { if (!sync_thread_.Start()) @@ -111,7 +111,7 @@ void SyncBackendHost::Initialize( frontend_ = frontend; DCHECK(frontend); - syncable::ModelEnumSet initial_types_with_nigori(initial_types); + syncable::ModelTypeSet initial_types_with_nigori(initial_types); CHECK(sync_prefs_.get()); if (sync_prefs_->HasSyncSetupCompleted()) { initial_types_with_nigori.Put(syncable::NIGORI); @@ -247,13 +247,13 @@ void SyncBackendHost::Shutdown(bool sync_disabled) { } void SyncBackendHost::ConfigureDataTypes( - syncable::ModelEnumSet types_to_add, - syncable::ModelEnumSet types_to_remove, + syncable::ModelTypeSet types_to_add, + syncable::ModelTypeSet types_to_remove, sync_api::ConfigureReason reason, - base::Callback<void(syncable::ModelEnumSet)> ready_task, + base::Callback<void(syncable::ModelTypeSet)> ready_task, bool enable_nigori) { - syncable::ModelEnumSet types_to_add_with_nigori = types_to_add; - syncable::ModelEnumSet types_to_remove_with_nigori = types_to_remove; + syncable::ModelTypeSet types_to_add_with_nigori = types_to_add; + syncable::ModelTypeSet types_to_remove_with_nigori = types_to_remove; if (enable_nigori) { types_to_add_with_nigori.Put(syncable::NIGORI); types_to_remove_with_nigori.Remove(syncable::NIGORI); @@ -482,7 +482,7 @@ void SyncBackendHost::Core::OnClearServerDataSucceeded() { } void SyncBackendHost::Core::OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) { if (!sync_loop_) return; @@ -684,7 +684,7 @@ void SyncBackendHost::Core::DoShutdown(bool sync_disabled) { } void SyncBackendHost::Core::DoRequestConfig( - syncable::ModelEnumSet types_to_config, + syncable::ModelTypeSet types_to_config, sync_api::ConfigureReason reason) { DCHECK_EQ(MessageLoop::current(), sync_loop_); sync_manager_->RequestConfig(types_to_config, reason); @@ -720,7 +720,7 @@ void SyncBackendHost::Core::HandleInitializationCompletedOnFrontendLoop( void SyncBackendHost::Core::HandleNigoriConfigurationCompletedOnFrontendLoop( const WeakHandle<JsBackend>& js_backend, - const syncable::ModelEnumSet failed_configuration_types) { + const syncable::ModelTypeSet failed_configuration_types) { if (!host_) return; host_->HandleInitializationCompletedOnFrontendLoop( @@ -794,7 +794,7 @@ void SyncBackendHost::Core::NotifyUpdatedToken(const std::string& token) { } void SyncBackendHost::Core::NotifyEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) { if (!host_) return; @@ -820,7 +820,7 @@ void SyncBackendHost::Core::HandleSyncCycleCompletedOnFrontendLoop( SVLOG(1) << "Got snapshot " << snapshot->ToString(); - const syncable::ModelEnumSet to_migrate = + const syncable::ModelTypeSet to_migrate = snapshot->syncer_status.types_needing_local_migration; if (!to_migrate.Empty()) host_->frontend_->OnMigrationNeededForTypes(to_migrate); @@ -836,20 +836,20 @@ void SyncBackendHost::Core::HandleSyncCycleCompletedOnFrontendLoop( if (host_->pending_download_state_.get()) { scoped_ptr<PendingConfigureDataTypesState> state( host_->pending_download_state_.release()); - const syncable::ModelEnumSet types_to_add = state->types_to_add; - const syncable::ModelEnumSet added_types = state->added_types; + const syncable::ModelTypeSet types_to_add = state->types_to_add; + const syncable::ModelTypeSet added_types = state->added_types; DCHECK(types_to_add.HasAll(added_types)); - const syncable::ModelEnumSet initial_sync_ended = + const syncable::ModelTypeSet initial_sync_ended = snapshot->initial_sync_ended; - const syncable::ModelEnumSet failed_configuration_types = + const syncable::ModelTypeSet failed_configuration_types = Difference(added_types, initial_sync_ended); SVLOG(1) << "Added types: " - << syncable::ModelEnumSetToString(added_types) + << syncable::ModelTypeSetToString(added_types) << ", configured types: " - << syncable::ModelEnumSetToString(initial_sync_ended) + << syncable::ModelTypeSetToString(initial_sync_ended) << ", failed configuration types: " - << syncable::ModelEnumSetToString(failed_configuration_types); + << syncable::ModelTypeSetToString(failed_configuration_types); state->ready_task.Run(failed_configuration_types); if (!failed_configuration_types.Empty()) return; @@ -883,7 +883,7 @@ void SyncBackendHost::Core::FinishConfigureDataTypesOnFrontendLoop() { void SyncBackendHost::AddExperimentalTypes() { CHECK(initialized()); - syncable::ModelEnumSet to_add; + syncable::ModelTypeSet to_add; if (core_->sync_manager()->ReceivedExperimentalTypes(&to_add)) frontend_->OnDataTypesChanged(to_add); } @@ -919,8 +919,8 @@ void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop( case NOT_INITIALIZED: initialization_state_ = DOWNLOADING_NIGORI; ConfigureDataTypes( - syncable::ModelEnumSet(), - syncable::ModelEnumSet(), + syncable::ModelTypeSet(), + syncable::ModelTypeSet(), sync_api::CONFIGURE_REASON_NEW_CLIENT, // Calls back into this function. base::Bind( @@ -977,7 +977,7 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() { if (pending_config_mode_state_->added_types.Empty() && !core_->sync_manager()->InitialSyncEndedForAllEnabledTypes()) { - syncable::ModelEnumSet enabled_types; + syncable::ModelTypeSet enabled_types; ModelSafeRoutingInfo routing_info; registrar_->GetModelSafeRoutingInfo(&routing_info); for (ModelSafeRoutingInfo::const_iterator i = routing_info.begin(); @@ -1002,13 +1002,13 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() { if (pending_config_mode_state_->added_types.Empty()) { SVLOG(1) << "No new types added; calling ready_task directly"; // No new types - just notify the caller that the types are available. - const syncable::ModelEnumSet failed_configuration_types; + const syncable::ModelTypeSet failed_configuration_types; pending_config_mode_state_->ready_task.Run(failed_configuration_types); } else { pending_download_state_.reset(pending_config_mode_state_.release()); // Always configure nigori if it's enabled. - syncable::ModelEnumSet types_to_config = + syncable::ModelTypeSet types_to_config = pending_download_state_->added_types; if (IsNigoriEnabled()) { // Note: Nigori is the only type that gets added with a nonempty @@ -1019,7 +1019,7 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() { types_to_config.Put(syncable::NIGORI); } SVLOG(1) << "Types " - << syncable::ModelEnumSetToString(types_to_config) + << syncable::ModelTypeSetToString(types_to_config) << " added; calling DoRequestConfig"; sync_thread_.message_loop()->PostTask(FROM_HERE, base::Bind(&SyncBackendHost::Core::DoRequestConfig, diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h index 269cc54..d7958ac 100644 --- a/chrome/browser/sync/glue/sync_backend_host.h +++ b/chrome/browser/sync/glue/sync_backend_host.h @@ -103,7 +103,7 @@ class SyncFrontend { // of encrypted types is Cryptographer::SensitiveTypes() and that // the encrypt everything flag is false. virtual void OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) = 0; // Called after we finish encrypting the current set of encrypted @@ -112,10 +112,10 @@ class SyncFrontend { // Called to perform migration of |types|. virtual void OnMigrationNeededForTypes( - syncable::ModelEnumSet types) = 0; + syncable::ModelTypeSet types) = 0; // Inform the Frontend that new datatypes are available for registration. - virtual void OnDataTypesChanged(syncable::ModelEnumSet to_add) = 0; + virtual void OnDataTypesChanged(syncable::ModelTypeSet to_add) = 0; // Called when the sync cycle returns there is an user actionable error. virtual void OnActionableError( @@ -157,7 +157,7 @@ class SyncBackendHost { void Initialize(SyncFrontend* frontend, const WeakHandle<JsEventHandler>& event_handler, const GURL& service_url, - syncable::ModelEnumSet initial_types, + syncable::ModelTypeSet initial_types, const sync_api::SyncCredentials& credentials, bool delete_sync_data_folder); @@ -193,10 +193,10 @@ class SyncBackendHost { // set of all types that failed configuration (i.e., if its argument // is non-empty, then an error was encountered). virtual void ConfigureDataTypes( - syncable::ModelEnumSet types_to_add, - syncable::ModelEnumSet types_to_remove, + syncable::ModelTypeSet types_to_add, + syncable::ModelTypeSet types_to_remove, sync_api::ConfigureReason reason, - base::Callback<void(syncable::ModelEnumSet)> ready_task, + base::Callback<void(syncable::ModelTypeSet)> ready_task, bool enable_nigori); // Makes an asynchronous call to syncer to switch to config mode. When done @@ -295,7 +295,7 @@ class SyncBackendHost { virtual void OnClearServerDataFailed() OVERRIDE; virtual void OnClearServerDataSucceeded() OVERRIDE; virtual void OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) OVERRIDE; virtual void OnEncryptionComplete() OVERRIDE; virtual void OnActionableError( @@ -386,7 +386,7 @@ class SyncBackendHost { void DoShutdown(bool stopping_sync); virtual void DoRequestConfig( - syncable::ModelEnumSet types_to_config, + syncable::ModelTypeSet types_to_config, sync_api::ConfigureReason reason); // Start the configuration mode. |callback| is called on the sync @@ -417,7 +417,7 @@ class SyncBackendHost { // part of the initialization process. void HandleNigoriConfigurationCompletedOnFrontendLoop( const WeakHandle<JsBackend>& js_backend, - syncable::ModelEnumSet failed_configuration_types); + syncable::ModelTypeSet failed_configuration_types); private: friend class base::RefCountedThreadSafe<SyncBackendHost::Core>; @@ -461,7 +461,7 @@ class SyncBackendHost { // Invoked when the set of encrypted types or the encrypt // everything flag changes. void NotifyEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything); // Invoked when sync finishes encrypting new datatypes. @@ -546,14 +546,14 @@ class SyncBackendHost { // The ready_task will be run when configuration is done with the // set of all types that failed configuration (i.e., if its // argument is non-empty, then an error was encountered). - base::Callback<void(syncable::ModelEnumSet)> ready_task; + base::Callback<void(syncable::ModelTypeSet)> ready_task; // The set of types that we are waiting to be initially synced in a // configuration cycle. - syncable::ModelEnumSet types_to_add; + syncable::ModelTypeSet types_to_add; // Additional details about which types were added. - syncable::ModelEnumSet added_types; + syncable::ModelTypeSet added_types; sync_api::ConfigureReason reason; }; diff --git a/chrome/browser/sync/glue/sync_backend_host_mock.cc b/chrome/browser/sync/glue/sync_backend_host_mock.cc index 79e38fa..4aa8d04 100644 --- a/chrome/browser/sync/glue/sync_backend_host_mock.cc +++ b/chrome/browser/sync/glue/sync_backend_host_mock.cc @@ -9,7 +9,7 @@ namespace browser_sync { using ::testing::_; ACTION(InvokeTask) { - arg3.Run(syncable::ModelEnumSet()); + arg3.Run(syncable::ModelTypeSet()); } SyncBackendHostMock::SyncBackendHostMock() { diff --git a/chrome/browser/sync/glue/sync_backend_host_mock.h b/chrome/browser/sync/glue/sync_backend_host_mock.h index 09eaec5..0829081 100644 --- a/chrome/browser/sync/glue/sync_backend_host_mock.h +++ b/chrome/browser/sync/glue/sync_backend_host_mock.h @@ -22,10 +22,10 @@ class SyncBackendHostMock : public SyncBackendHost { virtual ~SyncBackendHostMock(); MOCK_METHOD5(ConfigureDataTypes, - void(syncable::ModelEnumSet, - syncable::ModelEnumSet, + void(syncable::ModelTypeSet, + syncable::ModelTypeSet, sync_api::ConfigureReason, - base::Callback<void(syncable::ModelEnumSet)>, + base::Callback<void(syncable::ModelTypeSet)>, bool)); MOCK_METHOD0(StartSyncingWithServer, void()); }; diff --git a/chrome/browser/sync/glue/sync_backend_host_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_unittest.cc index 7232247..50963d1 100644 --- a/chrome/browser/sync/glue/sync_backend_host_unittest.cc +++ b/chrome/browser/sync/glue/sync_backend_host_unittest.cc @@ -40,10 +40,10 @@ class MockSyncFrontend : public SyncFrontend { MOCK_METHOD1(OnPassphraseRequired, void(sync_api::PassphraseRequiredReason)); MOCK_METHOD0(OnPassphraseAccepted, void()); MOCK_METHOD2(OnEncryptedTypesChanged, - void(syncable::ModelEnumSet, bool)); + void(syncable::ModelTypeSet, bool)); MOCK_METHOD0(OnEncryptionComplete, void()); - MOCK_METHOD1(OnMigrationNeededForTypes, void(syncable::ModelEnumSet)); - MOCK_METHOD1(OnDataTypesChanged, void(syncable::ModelEnumSet)); + MOCK_METHOD1(OnMigrationNeededForTypes, void(syncable::ModelTypeSet)); + MOCK_METHOD1(OnDataTypesChanged, void(syncable::ModelTypeSet)); MOCK_METHOD1(OnActionableError, void(const browser_sync::SyncProtocolError& sync_error)); }; @@ -97,7 +97,7 @@ TEST_F(SyncBackendHostTest, InitShutdown) { backend.Initialize(&mock_frontend, WeakHandle<JsEventHandler>(), GURL(k_mock_url), - syncable::ModelEnumSet(), + syncable::ModelTypeSet(), credentials, true); backend.StopSyncingForShutdown(); diff --git a/chrome/browser/sync/glue/sync_backend_registrar.cc b/chrome/browser/sync/glue/sync_backend_registrar.cc index 942db51..919b641 100644 --- a/chrome/browser/sync/glue/sync_backend_registrar.cc +++ b/chrome/browser/sync/glue/sync_backend_registrar.cc @@ -51,7 +51,7 @@ bool IsOnThreadForGroup(ModelSafeGroup group) { } // namespace SyncBackendRegistrar::SyncBackendRegistrar( - syncable::ModelEnumSet initial_types, + syncable::ModelTypeSet initial_types, const std::string& name, Profile* profile, MessageLoop* sync_loop) : name_(name), @@ -71,7 +71,7 @@ SyncBackendRegistrar::SyncBackendRegistrar( // routing_info map. We set them to group passive, meaning that // updates will be applied to sync, but not dispatched to the native // models. - for (syncable::ModelEnumSet::Iterator it = initial_types.First(); + for (syncable::ModelTypeSet::Iterator it = initial_types.First(); it.Good(); it.Inc()) { routing_info_[it.Get()] = GROUP_PASSIVE; } @@ -108,12 +108,12 @@ bool SyncBackendRegistrar::IsNigoriEnabled() const { return routing_info_.find(syncable::NIGORI) != routing_info_.end(); } -syncable::ModelEnumSet SyncBackendRegistrar::ConfigureDataTypes( - syncable::ModelEnumSet types_to_add, - syncable::ModelEnumSet types_to_remove) { +syncable::ModelTypeSet SyncBackendRegistrar::ConfigureDataTypes( + syncable::ModelTypeSet types_to_add, + syncable::ModelTypeSet types_to_remove) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(Intersection(types_to_add, types_to_remove).Empty()); - syncable::ModelEnumSet filtered_types_to_add = types_to_add; + syncable::ModelTypeSet filtered_types_to_add = types_to_add; if (workers_.count(GROUP_HISTORY) == 0) { LOG(WARNING) << "No history worker -- removing TYPED_URLS"; filtered_types_to_add.Remove(syncable::TYPED_URLS); @@ -124,8 +124,8 @@ syncable::ModelEnumSet SyncBackendRegistrar::ConfigureDataTypes( } base::AutoLock lock(lock_); - syncable::ModelEnumSet newly_added_types; - for (syncable::ModelEnumSet::Iterator it = + syncable::ModelTypeSet newly_added_types; + for (syncable::ModelTypeSet::Iterator it = filtered_types_to_add.First(); it.Good(); it.Inc()) { // Add a newly specified data type as GROUP_PASSIVE into the @@ -135,18 +135,18 @@ syncable::ModelEnumSet SyncBackendRegistrar::ConfigureDataTypes( newly_added_types.Put(it.Get()); } } - for (syncable::ModelEnumSet::Iterator it = types_to_remove.First(); + for (syncable::ModelTypeSet::Iterator it = types_to_remove.First(); it.Good(); it.Inc()) { routing_info_.erase(it.Get()); } // TODO(akalin): Use SVLOG/SLOG if we add any more logging. DVLOG(1) << name_ << ": Adding types " - << syncable::ModelEnumSetToString(types_to_add) + << syncable::ModelTypeSetToString(types_to_add) << " (with newly-added types " - << syncable::ModelEnumSetToString(newly_added_types) + << syncable::ModelTypeSetToString(newly_added_types) << ") and removing types " - << syncable::ModelEnumSetToString(types_to_remove) + << syncable::ModelTypeSetToString(types_to_remove) << " to get new routing info " << ModelSafeRoutingInfoToString(routing_info_); diff --git a/chrome/browser/sync/glue/sync_backend_registrar.h b/chrome/browser/sync/glue/sync_backend_registrar.h index 1fb2f2c..22cfd8d 100644 --- a/chrome/browser/sync/glue/sync_backend_registrar.h +++ b/chrome/browser/sync/glue/sync_backend_registrar.h @@ -39,7 +39,7 @@ class SyncBackendRegistrar : public ModelSafeWorkerRegistrar, // (initially put in the passive group). |name| is used for // debugging. Does not take ownership of |profile| or |sync_loop|. // Must be created on the UI thread. - SyncBackendRegistrar(syncable::ModelEnumSet initial_types, + SyncBackendRegistrar(syncable::ModelTypeSet initial_types, const std::string& name, Profile* profile, MessageLoop* sync_loop); @@ -66,9 +66,9 @@ class SyncBackendRegistrar : public ModelSafeWorkerRegistrar, // not already there (initially put in the passive group). // |types_to_remove| and |types_to_add| must be disjoint. Returns // the set of newly-added types. Must be called on the UI thread. - syncable::ModelEnumSet ConfigureDataTypes( - syncable::ModelEnumSet types_to_add, - syncable::ModelEnumSet types_to_remove); + syncable::ModelTypeSet ConfigureDataTypes( + syncable::ModelTypeSet types_to_add, + syncable::ModelTypeSet types_to_remove); // Must be called from the UI thread. (See destructor comment.) void StopOnUIThread(); diff --git a/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc b/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc index 3dabf54..06739ad 100644 --- a/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc +++ b/chrome/browser/sync/glue/sync_backend_registrar_unittest.cc @@ -30,7 +30,7 @@ using syncable::THEMES; using syncable::NIGORI; using syncable::PASSWORDS; using syncable::MODEL_TYPE_COUNT; -using syncable::ModelEnumSet; +using syncable::ModelTypeSet; using syncable::ModelType; using syncable::ModelTypeFromInt; @@ -56,7 +56,7 @@ class SyncBackendRegistrarTest : public testing::Test { } void ExpectHasProcessorsForTypes(const SyncBackendRegistrar& registrar, - ModelEnumSet types) { + ModelTypeSet types) { for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { ModelType model_type = ModelTypeFromInt(i); EXPECT_EQ(types.Has(model_type), @@ -73,7 +73,7 @@ class SyncBackendRegistrarTest : public testing::Test { TEST_F(SyncBackendRegistrarTest, ConstructorEmpty) { TestingProfile profile; - SyncBackendRegistrar registrar(ModelEnumSet(), "test", &profile, &loop_); + SyncBackendRegistrar registrar(ModelTypeSet(), "test", &profile, &loop_); EXPECT_FALSE(registrar.IsNigoriEnabled()); { std::vector<ModelSafeWorker*> workers; @@ -81,14 +81,14 @@ TEST_F(SyncBackendRegistrarTest, ConstructorEmpty) { EXPECT_EQ(4u, workers.size()); } ExpectRoutingInfo(®istrar, ModelSafeRoutingInfo()); - ExpectHasProcessorsForTypes(registrar, ModelEnumSet()); + ExpectHasProcessorsForTypes(registrar, ModelTypeSet()); registrar.OnSyncerShutdownComplete(); registrar.StopOnUIThread(); } TEST_F(SyncBackendRegistrarTest, ConstructorNonEmpty) { TestingProfile profile; - const ModelEnumSet initial_types(BOOKMARKS, NIGORI, PASSWORDS); + const ModelTypeSet initial_types(BOOKMARKS, NIGORI, PASSWORDS); SyncBackendRegistrar registrar(initial_types, "test", &profile, &loop_); EXPECT_TRUE(registrar.IsNigoriEnabled()); { @@ -103,19 +103,19 @@ TEST_F(SyncBackendRegistrarTest, ConstructorNonEmpty) { // Passwords dropped because of no password store. ExpectRoutingInfo(®istrar, expected_routing_info); } - ExpectHasProcessorsForTypes(registrar, ModelEnumSet()); + ExpectHasProcessorsForTypes(registrar, ModelTypeSet()); registrar.OnSyncerShutdownComplete(); registrar.StopOnUIThread(); } TEST_F(SyncBackendRegistrarTest, ConfigureDataTypes) { TestingProfile profile; - SyncBackendRegistrar registrar(ModelEnumSet(), "test", &profile, &loop_); + SyncBackendRegistrar registrar(ModelTypeSet(), "test", &profile, &loop_); // Add. - const ModelEnumSet types1(BOOKMARKS, NIGORI, AUTOFILL); + const ModelTypeSet types1(BOOKMARKS, NIGORI, AUTOFILL); EXPECT_TRUE( - registrar.ConfigureDataTypes(types1, ModelEnumSet()).Equals(types1)); + registrar.ConfigureDataTypes(types1, ModelTypeSet()).Equals(types1)); { ModelSafeRoutingInfo expected_routing_info; expected_routing_info[BOOKMARKS] = GROUP_PASSIVE; @@ -123,10 +123,10 @@ TEST_F(SyncBackendRegistrarTest, ConfigureDataTypes) { expected_routing_info[AUTOFILL] = GROUP_PASSIVE; ExpectRoutingInfo(®istrar, expected_routing_info); } - ExpectHasProcessorsForTypes(registrar, ModelEnumSet()); + ExpectHasProcessorsForTypes(registrar, ModelTypeSet()); // Add and remove. - const ModelEnumSet types2(PREFERENCES, THEMES); + const ModelTypeSet types2(PREFERENCES, THEMES); EXPECT_TRUE(registrar.ConfigureDataTypes(types2, types1).Equals(types2)); { ModelSafeRoutingInfo expected_routing_info; @@ -134,12 +134,12 @@ TEST_F(SyncBackendRegistrarTest, ConfigureDataTypes) { expected_routing_info[THEMES] = GROUP_PASSIVE; ExpectRoutingInfo(®istrar, expected_routing_info); } - ExpectHasProcessorsForTypes(registrar, ModelEnumSet()); + ExpectHasProcessorsForTypes(registrar, ModelTypeSet()); // Remove. - EXPECT_TRUE(registrar.ConfigureDataTypes(ModelEnumSet(), types2).Empty()); + EXPECT_TRUE(registrar.ConfigureDataTypes(ModelTypeSet(), types2).Empty()); ExpectRoutingInfo(®istrar, ModelSafeRoutingInfo()); - ExpectHasProcessorsForTypes(registrar, ModelEnumSet()); + ExpectHasProcessorsForTypes(registrar, ModelTypeSet()); registrar.OnSyncerShutdownComplete(); registrar.StopOnUIThread(); @@ -154,7 +154,7 @@ void TriggerChanges(SyncBackendRegistrar* registrar, ModelType type) { TEST_F(SyncBackendRegistrarTest, ActivateDeactivateUIDataType) { InSequence in_sequence; TestingProfile profile; - SyncBackendRegistrar registrar(ModelEnumSet(), "test", &profile, &loop_); + SyncBackendRegistrar registrar(ModelTypeSet(), "test", &profile, &loop_); // Should do nothing. TriggerChanges(®istrar, BOOKMARKS); @@ -171,9 +171,9 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateUIDataType) { EXPECT_CALL(change_processor_mock, IsRunning()) .WillRepeatedly(Return(false)); - const ModelEnumSet types(BOOKMARKS); + const ModelTypeSet types(BOOKMARKS); EXPECT_TRUE( - registrar.ConfigureDataTypes(types, ModelEnumSet()).Equals(types)); + registrar.ConfigureDataTypes(types, ModelTypeSet()).Equals(types)); registrar.ActivateDataType(BOOKMARKS, GROUP_UI, &change_processor_mock, test_user_share_.user_share()); @@ -188,7 +188,7 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateUIDataType) { registrar.DeactivateDataType(BOOKMARKS); ExpectRoutingInfo(®istrar, ModelSafeRoutingInfo()); - ExpectHasProcessorsForTypes(registrar, ModelEnumSet()); + ExpectHasProcessorsForTypes(registrar, ModelTypeSet()); // Should do nothing. TriggerChanges(®istrar, BOOKMARKS); @@ -201,7 +201,7 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateNonUIDataType) { content::TestBrowserThread db_thread(BrowserThread::DB, &loop_); InSequence in_sequence; TestingProfile profile; - SyncBackendRegistrar registrar(ModelEnumSet(), "test", &profile, &loop_); + SyncBackendRegistrar registrar(ModelTypeSet(), "test", &profile, &loop_); // Should do nothing. TriggerChanges(®istrar, AUTOFILL); @@ -218,9 +218,9 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateNonUIDataType) { EXPECT_CALL(change_processor_mock, IsRunning()) .WillRepeatedly(Return(false)); - const ModelEnumSet types(AUTOFILL); + const ModelTypeSet types(AUTOFILL); EXPECT_TRUE( - registrar.ConfigureDataTypes(types, ModelEnumSet()).Equals(types)); + registrar.ConfigureDataTypes(types, ModelTypeSet()).Equals(types)); registrar.ActivateDataType(AUTOFILL, GROUP_DB, &change_processor_mock, test_user_share_.user_share()); @@ -235,7 +235,7 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateNonUIDataType) { registrar.DeactivateDataType(AUTOFILL); ExpectRoutingInfo(®istrar, ModelSafeRoutingInfo()); - ExpectHasProcessorsForTypes(registrar, ModelEnumSet()); + ExpectHasProcessorsForTypes(registrar, ModelTypeSet()); // Should do nothing. TriggerChanges(®istrar, AUTOFILL); diff --git a/chrome/browser/sync/glue/theme_model_associator.cc b/chrome/browser/sync/glue/theme_model_associator.cc index 9f17196..0b378cf 100644 --- a/chrome/browser/sync/glue/theme_model_associator.cc +++ b/chrome/browser/sync/glue/theme_model_associator.cc @@ -103,7 +103,7 @@ bool ThemeModelAssociator::SyncModelHasUserCreatedNodes(bool* has_nodes) { bool ThemeModelAssociator::CryptoReadyIfNecessary() { // We only access the cryptographer while holding a transaction. sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); - const syncable::ModelEnumSet encrypted_types = + const syncable::ModelTypeSet encrypted_types = sync_api::GetEncryptedTypes(&trans); return !encrypted_types.Has(syncable::THEMES) || sync_service_->IsCryptographerReady(&trans); diff --git a/chrome/browser/sync/glue/typed_url_model_associator.cc b/chrome/browser/sync/glue/typed_url_model_associator.cc index ac07ff7..e68abbb 100644 --- a/chrome/browser/sync/glue/typed_url_model_associator.cc +++ b/chrome/browser/sync/glue/typed_url_model_associator.cc @@ -820,7 +820,7 @@ void TypedUrlModelAssociator::UpdateURLRowFromTypedUrlSpecifics( bool TypedUrlModelAssociator::CryptoReadyIfNecessary() { // We only access the cryptographer while holding a transaction. sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); - const syncable::ModelEnumSet encrypted_types = + const syncable::ModelTypeSet encrypted_types = sync_api::GetEncryptedTypes(&trans); return !encrypted_types.Has(syncable::TYPED_URLS) || sync_service_->IsCryptographerReady(&trans); diff --git a/chrome/browser/sync/internal_api/base_transaction.cc b/chrome/browser/sync/internal_api/base_transaction.cc index 8a7e123..8d26702 100644 --- a/chrome/browser/sync/internal_api/base_transaction.cc +++ b/chrome/browser/sync/internal_api/base_transaction.cc @@ -26,7 +26,7 @@ BaseTransaction::~BaseTransaction() { delete lookup_; } -syncable::ModelEnumSet GetEncryptedTypes( +syncable::ModelTypeSet GetEncryptedTypes( const sync_api::BaseTransaction* trans) { Cryptographer* cryptographer = trans->GetCryptographer(); return cryptographer->GetEncryptedTypes(); diff --git a/chrome/browser/sync/internal_api/base_transaction.h b/chrome/browser/sync/internal_api/base_transaction.h index 5459295..9bf2fb3 100644 --- a/chrome/browser/sync/internal_api/base_transaction.h +++ b/chrome/browser/sync/internal_api/base_transaction.h @@ -51,7 +51,7 @@ class BaseTransaction { DISALLOW_COPY_AND_ASSIGN(BaseTransaction); }; -syncable::ModelEnumSet GetEncryptedTypes( +syncable::ModelTypeSet GetEncryptedTypes( const sync_api::BaseTransaction* trans); } // namespace sync_api diff --git a/chrome/browser/sync/internal_api/debug_info_event_listener.cc b/chrome/browser/sync/internal_api/debug_info_event_listener.cc index e657782..be2d5b1 100644 --- a/chrome/browser/sync/internal_api/debug_info_event_listener.cc +++ b/chrome/browser/sync/internal_api/debug_info_event_listener.cc @@ -73,7 +73,7 @@ void DebugInfoEventListener::OnClearServerDataSucceeded() { } void DebugInfoEventListener::OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) { CreateAndAddEvent(sync_pb::DebugEventInfo::ENCRYPTED_TYPES_CHANGED); } diff --git a/chrome/browser/sync/internal_api/debug_info_event_listener.h b/chrome/browser/sync/internal_api/debug_info_event_listener.h index ed2200a..d42b9fb 100644 --- a/chrome/browser/sync/internal_api/debug_info_event_listener.h +++ b/chrome/browser/sync/internal_api/debug_info_event_listener.h @@ -46,7 +46,7 @@ class DebugInfoEventListener : public sync_api::SyncManager::Observer, virtual void OnClearServerDataFailed() OVERRIDE; virtual void OnClearServerDataSucceeded() OVERRIDE; virtual void OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) OVERRIDE; virtual void OnEncryptionComplete() OVERRIDE; virtual void OnActionableError( diff --git a/chrome/browser/sync/internal_api/sync_manager.cc b/chrome/browser/sync/internal_api/sync_manager.cc index 792f269..8c9f02d 100644 --- a/chrome/browser/sync/internal_api/sync_manager.cc +++ b/chrome/browser/sync/internal_api/sync_manager.cc @@ -78,7 +78,7 @@ using browser_sync::sessions::SyncSessionContext; using syncable::DirectoryManager; using syncable::ImmutableWriteTransactionInfo; using syncable::ModelType; -using syncable::ModelEnumSet; +using syncable::ModelTypeSet; using syncable::SPECIFICS; using sync_pb::GetUpdatesCallerInfo; @@ -207,7 +207,7 @@ class SyncManager::SyncInternal // Conditionally sets the flag in the Nigori node which instructs other // clients to start syncing tabs. - void MaybeSetSyncTabsInNigoriNode(ModelEnumSet enabled_types); + void MaybeSetSyncTabsInNigoriNode(ModelTypeSet enabled_types); // Tell the sync engine to start the syncing process. void StartSyncingNormally(); @@ -243,8 +243,8 @@ class SyncManager::SyncInternal // builds the list of sync-engine initiated changes that will be forwarded to // the SyncManager's Observers. virtual void HandleTransactionCompleteChangeEvent( - ModelEnumSet models_with_changes) OVERRIDE; - virtual ModelEnumSet HandleTransactionEndingChangeEvent( + ModelTypeSet models_with_changes) OVERRIDE; + virtual ModelTypeSet HandleTransactionEndingChangeEvent( const ImmutableWriteTransactionInfo& write_transaction_info, syncable::BaseTransaction* trans) OVERRIDE; virtual void HandleCalculateChangesChangeEventFromSyncApi( @@ -262,7 +262,7 @@ class SyncManager::SyncInternal // Cryptographer::Observer implementation. virtual void OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) OVERRIDE; // SyncNotifierObserver implementation. @@ -321,7 +321,7 @@ class SyncManager::SyncInternal virtual void OnIPAddressChanged() OVERRIDE; bool InitialSyncEndedForAllEnabledTypes() { - syncable::ModelEnumSet types; + syncable::ModelTypeSet types; ModelSafeRoutingInfo enabled_types; registrar_->GetModelSafeRoutingInfo(&enabled_types); for (ModelSafeRoutingInfo::const_iterator i = enabled_types.begin(); @@ -642,7 +642,7 @@ void SyncManager::UpdateEnabledTypes() { } void SyncManager::MaybeSetSyncTabsInNigoriNode( - ModelEnumSet enabled_types) { + ModelTypeSet enabled_types) { DCHECK(thread_checker_.CalledOnValidThread()); data_->MaybeSetSyncTabsInNigoriNode(enabled_types); } @@ -702,7 +702,7 @@ void SyncManager::RequestClearServerData() { } void SyncManager::RequestConfig( - ModelEnumSet types, ConfigureReason reason) { + ModelTypeSet types, ConfigureReason reason) { DCHECK(thread_checker_.CalledOnValidThread()); if (!data_->scheduler()) { LOG(INFO) @@ -965,7 +965,7 @@ void SyncManager::SyncInternal::UpdateEnabledTypes() { DCHECK(thread_checker_.CalledOnValidThread()); ModelSafeRoutingInfo routes; registrar_->GetModelSafeRoutingInfo(&routes); - const ModelEnumSet enabled_types = GetRoutingInfoTypes(routes); + const ModelTypeSet enabled_types = GetRoutingInfoTypes(routes); sync_notifier_->UpdateEnabledTypes(enabled_types); if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableSyncTabsForOtherClients)) { @@ -974,7 +974,7 @@ void SyncManager::SyncInternal::UpdateEnabledTypes() { } void SyncManager::SyncInternal::MaybeSetSyncTabsInNigoriNode( - const ModelEnumSet enabled_types) { + 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. @@ -1135,11 +1135,11 @@ void SyncManager::SyncInternal::ReEncryptEverything(WriteTransaction* trans) { Cryptographer* cryptographer = trans->GetCryptographer(); if (!cryptographer || !cryptographer->is_ready()) return; - syncable::ModelEnumSet encrypted_types = GetEncryptedTypes(trans); + syncable::ModelTypeSet encrypted_types = GetEncryptedTypes(trans); ModelSafeRoutingInfo routes; registrar_->GetModelSafeRoutingInfo(&routes); std::string tag; - for (syncable::ModelEnumSet::Iterator iter = encrypted_types.First(); + for (syncable::ModelTypeSet::Iterator iter = encrypted_types.First(); iter.Good(); iter.Inc()) { if (iter.Get() == syncable::PASSWORDS || iter.Get() == syncable::NIGORI || @@ -1349,7 +1349,7 @@ void SyncManager::SyncInternal::OnServerConnectionEvent( } void SyncManager::SyncInternal::HandleTransactionCompleteChangeEvent( - ModelEnumSet models_with_changes) { + ModelTypeSet models_with_changes) { // This notification happens immediately after the transaction mutex is // released. This allows work to be performed without blocking other threads // from acquiring a transaction. @@ -1357,7 +1357,7 @@ void SyncManager::SyncInternal::HandleTransactionCompleteChangeEvent( return; // Call commit. - for (ModelEnumSet::Iterator it = models_with_changes.First(); + for (ModelTypeSet::Iterator it = models_with_changes.First(); it.Good(); it.Inc()) { change_delegate_->OnChangesComplete(it.Get()); change_observer_.Call( @@ -1365,7 +1365,7 @@ void SyncManager::SyncInternal::HandleTransactionCompleteChangeEvent( } } -ModelEnumSet +ModelTypeSet SyncManager::SyncInternal::HandleTransactionEndingChangeEvent( const ImmutableWriteTransactionInfo& write_transaction_info, syncable::BaseTransaction* trans) { @@ -1373,7 +1373,7 @@ ModelEnumSet // falls out of scope. It happens while the channel mutex is still held, // and while the transaction mutex is held, so it cannot be re-entrant. if (!change_delegate_ || ChangeBuffersAreEmpty()) - return ModelEnumSet(); + return ModelTypeSet(); // This will continue the WriteTransaction using a read only wrapper. // This is the last chance for read to occur in the WriteTransaction @@ -1381,7 +1381,7 @@ ModelEnumSet // underlying transaction. ReadTransaction read_trans(GetUserShare(), trans); - ModelEnumSet models_with_changes; + ModelTypeSet models_with_changes; for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { const syncable::ModelType type = syncable::ModelTypeFromInt(i); @@ -1536,7 +1536,7 @@ void SyncManager::SyncInternal::RequestNudge( if (scheduler()) scheduler()->ScheduleNudge( TimeDelta::FromMilliseconds(0), browser_sync::NUDGE_SOURCE_LOCAL, - ModelEnumSet(), location); + ModelTypeSet(), location); } void SyncManager::SyncInternal::RequestNudgeForDataType( @@ -1562,7 +1562,7 @@ void SyncManager::SyncInternal::RequestNudgeForDataType( } scheduler()->ScheduleNudge(nudge_delay, browser_sync::NUDGE_SOURCE_LOCAL, - ModelEnumSet(type), + ModelTypeSet(type), nudge_location); } @@ -1624,7 +1624,7 @@ void SyncManager::SyncInternal::OnSyncEngineEvent( if (is_notifiable_commit) { allstatus_.IncrementNotifiableCommits(); if (sync_notifier_.get()) { - const ModelEnumSet changed_types = + const ModelTypeSet changed_types = syncable::ModelTypePayloadMapToEnumSet( event.snapshot->source.types); sync_notifier_->SendNotification(changed_types); @@ -1852,7 +1852,7 @@ JsArgList SyncManager::SyncInternal::FindNodesContainingString( } void SyncManager::SyncInternal::OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) { // NOTE: We're in a transaction. FOR_EACH_OBSERVER( @@ -1981,12 +1981,12 @@ void SyncManager::RefreshEncryption() { data_->RefreshEncryption(); } -syncable::ModelEnumSet SyncManager::GetEncryptedDataTypesForTest() const { +syncable::ModelTypeSet SyncManager::GetEncryptedDataTypesForTest() const { ReadTransaction trans(FROM_HERE, GetUserShare()); return GetEncryptedTypes(&trans); } -bool SyncManager::ReceivedExperimentalTypes(syncable::ModelEnumSet* to_add) +bool SyncManager::ReceivedExperimentalTypes(syncable::ModelTypeSet* to_add) const { ReadTransaction trans(FROM_HERE, GetUserShare()); ReadNode node(&trans); @@ -2013,7 +2013,7 @@ void SyncManager::TriggerOnNotificationStateChangeForTest( } void SyncManager::TriggerOnIncomingNotificationForTest( - ModelEnumSet model_types) { + ModelTypeSet model_types) { DCHECK(thread_checker_.CalledOnValidThread()); syncable::ModelTypePayloadMap model_types_with_payloads = syncable::ModelTypePayloadMapFromEnumSet(model_types, @@ -2041,7 +2041,7 @@ std::string PassphraseRequiredReasonToString( } // Helper function to determine if initial sync had ended for types. -bool InitialSyncEndedForTypes(syncable::ModelEnumSet types, +bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, sync_api::UserShare* share) { syncable::ScopedDirLookup lookup(share->dir_manager.get(), share->name); @@ -2050,7 +2050,7 @@ bool InitialSyncEndedForTypes(syncable::ModelEnumSet types, return false; } - for (syncable::ModelEnumSet::Iterator i = types.First(); + for (syncable::ModelTypeSet::Iterator i = types.First(); i.Good(); i.Inc()) { if (!lookup->initial_sync_ended_for_type(i.Get())) return false; @@ -2058,19 +2058,19 @@ bool InitialSyncEndedForTypes(syncable::ModelEnumSet types, return true; } -syncable::ModelEnumSet GetTypesWithEmptyProgressMarkerToken( - syncable::ModelEnumSet types, +syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( + syncable::ModelTypeSet types, sync_api::UserShare* share) { syncable::ScopedDirLookup lookup(share->dir_manager.get(), share->name); if (!lookup.good()) { NOTREACHED() << "ScopedDirLookup failed for " << "GetTypesWithEmptyProgressMarkerToken"; - return syncable::ModelEnumSet(); + return syncable::ModelTypeSet(); } - syncable::ModelEnumSet result; - for (syncable::ModelEnumSet::Iterator i = types.First(); + syncable::ModelTypeSet result; + for (syncable::ModelTypeSet::Iterator i = types.First(); i.Good(); i.Inc()) { sync_pb::DataTypeProgressMarker marker; lookup->GetDownloadProgress(i.Get(), &marker); diff --git a/chrome/browser/sync/internal_api/sync_manager.h b/chrome/browser/sync/internal_api/sync_manager.h index 14f82e8..1a5d014 100644 --- a/chrome/browser/sync/internal_api/sync_manager.h +++ b/chrome/browser/sync/internal_api/sync_manager.h @@ -158,7 +158,7 @@ class SyncManager { int useful_sync_cycles; // Encryption related. - syncable::ModelEnumSet encrypted_types; + syncable::ModelTypeSet encrypted_types; bool cryptographer_ready; bool crypto_has_pending_keys; @@ -390,7 +390,7 @@ class SyncManager { // // Called from within a transaction. virtual void OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) = 0; // Called after we finish encrypting the current set of encrypted @@ -457,7 +457,7 @@ class SyncManager { // Conditionally sets the flag in the Nigori node which instructs other // clients to start syncing tabs. - void MaybeSetSyncTabsInNigoriNode(syncable::ModelEnumSet enabled_types); + void MaybeSetSyncTabsInNigoriNode(syncable::ModelTypeSet enabled_types); // Put the syncer in normal mode ready to perform nudges and polls. void StartSyncingNormally(); @@ -483,7 +483,7 @@ class SyncManager { // Switches the mode of operation to CONFIGURATION_MODE and // schedules a config task to fetch updates for |types|. - void RequestConfig(syncable::ModelEnumSet types, + void RequestConfig(syncable::ModelTypeSet types, sync_api::ConfigureReason reason); void RequestCleanupDisabledTypes(); @@ -559,12 +559,12 @@ class SyncManager { // Gets the set of encrypted types from the cryptographer // Note: opens a transaction. May be called from any thread. - syncable::ModelEnumSet GetEncryptedDataTypesForTest() const; + syncable::ModelTypeSet GetEncryptedDataTypesForTest() const; // Reads the nigori node to determine if any experimental types should be // enabled. // Note: opens a transaction. May be called on any thread. - bool ReceivedExperimentalTypes(syncable::ModelEnumSet* to_add) const; + bool ReceivedExperimentalTypes(syncable::ModelTypeSet* to_add) const; // Uses a read-only transaction to determine if the directory being synced has // any remaining unsynced items. May be called on any thread. @@ -576,7 +576,7 @@ class SyncManager { bool notifications_enabled); void TriggerOnIncomingNotificationForTest( - syncable::ModelEnumSet model_types); + syncable::ModelTypeSet model_types); private: base::ThreadChecker thread_checker_; @@ -587,10 +587,10 @@ class SyncManager { DISALLOW_COPY_AND_ASSIGN(SyncManager); }; -bool InitialSyncEndedForTypes(syncable::ModelEnumSet types, UserShare* share); +bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, UserShare* share); -syncable::ModelEnumSet GetTypesWithEmptyProgressMarkerToken( - syncable::ModelEnumSet types, +syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( + syncable::ModelTypeSet types, sync_api::UserShare* share); // Returns the string representation of a PassphraseRequiredReason value. diff --git a/chrome/browser/sync/internal_api/syncapi_unittest.cc b/chrome/browser/sync/internal_api/syncapi_unittest.cc index 86e2a83..8105b3a 100644 --- a/chrome/browser/sync/internal_api/syncapi_unittest.cc +++ b/chrome/browser/sync/internal_api/syncapi_unittest.cc @@ -74,7 +74,7 @@ using browser_sync::sessions::SyncSessionSnapshot; using browser_sync::WeakHandle; using content::BrowserThread; using syncable::kEncryptedString; -using syncable::ModelEnumSet; +using syncable::ModelTypeSet; using syncable::ModelType; using test::ExpectDictStringValue; using testing::_; @@ -632,7 +632,7 @@ class SyncManagerObserverMock : public SyncManager::Observer { MOCK_METHOD0(OnClearServerDataFailed, void()); // NOLINT MOCK_METHOD0(OnClearServerDataSucceeded, void()); // NOLINT MOCK_METHOD2(OnEncryptedTypesChanged, - void(ModelEnumSet, bool)); // NOLINT + void(ModelTypeSet, bool)); // NOLINT MOCK_METHOD0(OnEncryptionComplete, void()); // NOLINT MOCK_METHOD1(OnActionableError, void(const browser_sync::SyncProtocolError&)); // NOLINT @@ -647,8 +647,8 @@ class SyncNotifierMock : public sync_notifier::SyncNotifier { MOCK_METHOD2(UpdateCredentials, void(const std::string&, const std::string&)); MOCK_METHOD1(UpdateEnabledTypes, - void(syncable::ModelEnumSet)); - MOCK_METHOD1(SendNotification, void(syncable::ModelEnumSet)); + void(syncable::ModelTypeSet)); + MOCK_METHOD1(SendNotification, void(syncable::ModelTypeSet)); }; class SyncManagerTest : public testing::Test, @@ -801,10 +801,10 @@ class SyncManagerTest : public testing::Test, sync_notifier_observer_ = NULL; } - void SyncNotifierUpdateEnabledTypes(syncable::ModelEnumSet types) { + void SyncNotifierUpdateEnabledTypes(syncable::ModelTypeSet types) { ModelSafeRoutingInfo routes; GetModelSafeRoutingInfo(&routes); - const syncable::ModelEnumSet expected_types = + const syncable::ModelTypeSet expected_types = GetRoutingInfoTypes(routes); EXPECT_TRUE(types.Equals(expected_types)); ++update_enabled_types_call_count_; @@ -854,7 +854,7 @@ TEST_F(SyncManagerTest, UpdateEnabledTypes) { } TEST_F(SyncManagerTest, DoNotSyncTabsInNigoriNode) { - const syncable::ModelEnumSet encrypted_types(syncable::TYPED_URLS); + const syncable::ModelTypeSet encrypted_types(syncable::TYPED_URLS); sync_manager_.MaybeSetSyncTabsInNigoriNode(encrypted_types); ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); @@ -864,7 +864,7 @@ TEST_F(SyncManagerTest, DoNotSyncTabsInNigoriNode) { } TEST_F(SyncManagerTest, SyncTabsInNigoriNode) { - const syncable::ModelEnumSet encrypted_types(syncable::SESSIONS); + const syncable::ModelTypeSet encrypted_types(syncable::SESSIONS); sync_manager_.MaybeSetSyncTabsInNigoriNode(encrypted_types); ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); @@ -1158,8 +1158,8 @@ TEST_F(SyncManagerTest, OnNotificationStateChange) { TEST_F(SyncManagerTest, OnIncomingNotification) { StrictMock<MockJsEventHandler> event_handler; - const syncable::ModelEnumSet empty_model_types; - const syncable::ModelEnumSet model_types( + const syncable::ModelTypeSet empty_model_types; + const syncable::ModelTypeSet model_types( syncable::BOOKMARKS, syncable::THEMES); // Build expected_args to have a single argument with the string @@ -1168,7 +1168,7 @@ TEST_F(SyncManagerTest, OnIncomingNotification) { { ListValue* model_type_list = new ListValue(); expected_details.Set("changedTypes", model_type_list); - for (syncable::ModelEnumSet::Iterator it = model_types.First(); + for (syncable::ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { model_type_list->Append( Value::CreateStringValue( @@ -1198,7 +1198,7 @@ TEST_F(SyncManagerTest, RefreshEncryptionReady) { EXPECT_TRUE(SetUpEncryption(true)); EXPECT_CALL(observer_, OnEncryptionComplete()); sync_manager_.RefreshEncryption(); - const syncable::ModelEnumSet encrypted_types = + const syncable::ModelTypeSet encrypted_types = sync_manager_.GetEncryptedDataTypesForTest(); EXPECT_TRUE(encrypted_types.Has(syncable::PASSWORDS)); EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest()); @@ -1218,7 +1218,7 @@ TEST_F(SyncManagerTest, RefreshEncryptionReady) { TEST_F(SyncManagerTest, RefreshEncryptionNotReady) { // Don't set up encryption (no nigori node created). sync_manager_.RefreshEncryption(); // Should fail. - const syncable::ModelEnumSet encrypted_types = + const syncable::ModelTypeSet encrypted_types = sync_manager_.GetEncryptedDataTypesForTest(); EXPECT_TRUE(encrypted_types.Has(syncable::PASSWORDS)); // Hardcoded. EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest()); @@ -1229,7 +1229,7 @@ TEST_F(SyncManagerTest, RefreshEncryptionEmptyNigori) { EXPECT_TRUE(SetUpEncryption(false)); EXPECT_CALL(observer_, OnEncryptionComplete()); sync_manager_.RefreshEncryption(); // Should write to nigori. - const syncable::ModelEnumSet encrypted_types = + const syncable::ModelTypeSet encrypted_types = sync_manager_.GetEncryptedDataTypesForTest(); EXPECT_TRUE(encrypted_types.Has(syncable::PASSWORDS)); // Hardcoded. EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest()); @@ -1249,7 +1249,7 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithNoData) { EXPECT_TRUE(SetUpEncryption(true)); EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelEnumSet::All()), true)); + HasModelTypes(syncable::ModelTypeSet::All()), true)); EXPECT_CALL(observer_, OnEncryptionComplete()); sync_manager_.EnableEncryptEverything(); EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest()); @@ -1306,14 +1306,14 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) { EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelEnumSet::All()), true)); + HasModelTypes(syncable::ModelTypeSet::All()), true)); EXPECT_CALL(observer_, OnEncryptionComplete()); sync_manager_.EnableEncryptEverything(); EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); EXPECT_TRUE(GetEncryptedTypes(&trans).Equals( - syncable::ModelEnumSet::All())); + syncable::ModelTypeSet::All())); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), @@ -1340,7 +1340,7 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) { { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); EXPECT_TRUE(GetEncryptedTypes(&trans).Equals( - syncable::ModelEnumSet::All())); + syncable::ModelTypeSet::All())); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), @@ -1501,7 +1501,7 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelEnumSet::All()), true)); + HasModelTypes(syncable::ModelTypeSet::All()), true)); EXPECT_CALL(observer_, OnEncryptionComplete()); sync_manager_.EnableEncryptEverything(); EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest()); @@ -1509,7 +1509,7 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); EXPECT_TRUE(GetEncryptedTypes(&trans).Equals( - syncable::ModelEnumSet::All())); + syncable::ModelTypeSet::All())); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), diff --git a/chrome/browser/sync/internal_api/write_node.cc b/chrome/browser/sync/internal_api/write_node.cc index c693eac..e673a78 100644 --- a/chrome/browser/sync/internal_api/write_node.cc +++ b/chrome/browser/sync/internal_api/write_node.cc @@ -38,7 +38,7 @@ bool WriteNode::UpdateEntryWithEncryption( syncable::MutableEntry* entry) { syncable::ModelType type = syncable::GetModelTypeFromSpecifics(new_specifics); DCHECK_GE(type, syncable::FIRST_REAL_MODEL_TYPE); - const syncable::ModelEnumSet encrypted_types = + const syncable::ModelTypeSet encrypted_types = cryptographer->GetEncryptedTypes(); sync_pb::EntitySpecifics generated_specifics; if (!SpecificsNeedsEncryption(encrypted_types, new_specifics) || diff --git a/chrome/browser/sync/js/js_mutation_event_observer.cc b/chrome/browser/sync/js/js_mutation_event_observer.cc index 5d085c0..d54ddd7 100644 --- a/chrome/browser/sync/js/js_mutation_event_observer.cc +++ b/chrome/browser/sync/js/js_mutation_event_observer.cc @@ -85,7 +85,7 @@ void JsMutationEventObserver::OnChangesComplete( void JsMutationEventObserver::OnTransactionWrite( const syncable::ImmutableWriteTransactionInfo& write_transaction_info, - syncable::ModelEnumSet models_with_changes) { + syncable::ModelTypeSet models_with_changes) { DCHECK(non_thread_safe_.CalledOnValidThread()); if (!event_handler_.IsInitialized()) { return; @@ -94,7 +94,7 @@ void JsMutationEventObserver::OnTransactionWrite( details.Set("writeTransactionInfo", write_transaction_info.Get().ToValue(kChangeLimit)); details.Set("modelsWithChanges", - syncable::ModelEnumSetToValue(models_with_changes)); + syncable::ModelTypeSetToValue(models_with_changes)); HandleJsEvent(FROM_HERE, "onTransactionWrite", JsEventDetails(&details)); } diff --git a/chrome/browser/sync/js/js_mutation_event_observer.h b/chrome/browser/sync/js/js_mutation_event_observer.h index 4209bf2..a0e347b 100644 --- a/chrome/browser/sync/js/js_mutation_event_observer.h +++ b/chrome/browser/sync/js/js_mutation_event_observer.h @@ -51,7 +51,7 @@ class JsMutationEventObserver // syncable::TransactionObserver implementation. virtual void OnTransactionWrite( const syncable::ImmutableWriteTransactionInfo& write_transaction_info, - syncable::ModelEnumSet models_with_changes) OVERRIDE; + syncable::ModelTypeSet models_with_changes) OVERRIDE; private: base::NonThreadSafe non_thread_safe_; diff --git a/chrome/browser/sync/js/js_sync_manager_observer.cc b/chrome/browser/sync/js/js_sync_manager_observer.cc index 0a19ff9..a4e9335 100644 --- a/chrome/browser/sync/js/js_sync_manager_observer.cc +++ b/chrome/browser/sync/js/js_sync_manager_observer.cc @@ -81,14 +81,14 @@ void JsSyncManagerObserver::OnPassphraseAccepted( } void JsSyncManagerObserver::OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) { if (!event_handler_.IsInitialized()) { return; } DictionaryValue details; details.Set("encryptedTypes", - syncable::ModelEnumSetToValue(encrypted_types)); + syncable::ModelTypeSetToValue(encrypted_types)); details.SetBoolean("encryptEverything", encrypt_everything); HandleJsEvent(FROM_HERE, "onEncryptedTypesChanged", JsEventDetails(&details)); diff --git a/chrome/browser/sync/js/js_sync_manager_observer.h b/chrome/browser/sync/js/js_sync_manager_observer.h index 6a848f7..18ef905 100644 --- a/chrome/browser/sync/js/js_sync_manager_observer.h +++ b/chrome/browser/sync/js/js_sync_manager_observer.h @@ -41,7 +41,7 @@ class JsSyncManagerObserver : public sync_api::SyncManager::Observer { virtual void OnPassphraseAccepted( const std::string& bootstrap_token) OVERRIDE; virtual void OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) OVERRIDE; virtual void OnEncryptionComplete() OVERRIDE; virtual void OnInitializationComplete( diff --git a/chrome/browser/sync/js/js_sync_manager_observer_unittest.cc b/chrome/browser/sync/js/js_sync_manager_observer_unittest.cc index b12af66..9b8aaa7 100644 --- a/chrome/browser/sync/js/js_sync_manager_observer_unittest.cc +++ b/chrome/browser/sync/js/js_sync_manager_observer_unittest.cc @@ -77,7 +77,7 @@ TEST_F(JsSyncManagerObserverTest, OnSyncCycleCompleted) { sessions::ErrorCounters(), 100, false, - syncable::ModelEnumSet(), + syncable::ModelTypeSet(), download_progress_markers, false, true, @@ -200,7 +200,7 @@ TEST_F(JsSyncManagerObserverTest, OnEncryptedTypesChanged) { const bool encrypt_everything = false; expected_details.Set("encryptedTypes", encrypted_type_values); expected_details.SetBoolean("encryptEverything", encrypt_everything); - syncable::ModelEnumSet encrypted_types; + syncable::ModelTypeSet encrypted_types; for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { diff --git a/chrome/browser/sync/notifier/chrome_invalidation_client.cc b/chrome/browser/sync/notifier/chrome_invalidation_client.cc index 2aa072b..86fe094 100644 --- a/chrome/browser/sync/notifier/chrome_invalidation_client.cc +++ b/chrome/browser/sync/notifier/chrome_invalidation_client.cc @@ -129,7 +129,7 @@ void ChromeInvalidationClient::Stop() { max_invalidation_versions_.clear(); } -void ChromeInvalidationClient::RegisterTypes(syncable::ModelEnumSet types) { +void ChromeInvalidationClient::RegisterTypes(syncable::ModelTypeSet types) { DCHECK(non_thread_safe_.CalledOnValidThread()); registered_types_ = types; if (ticl_ready_ && registration_manager_.get()) { @@ -189,7 +189,7 @@ void ChromeInvalidationClient::Invalidate( if (invalidation.has_payload()) payload = invalidation.payload(); - EmitInvalidation(syncable::ModelEnumSet(model_type), payload); + EmitInvalidation(syncable::ModelTypeSet(model_type), payload); // TODO(akalin): We should really acknowledge only after we get the // updates from the sync server. (see http://crbug.com/78462). client->Acknowledge(ack_handle); @@ -211,7 +211,7 @@ void ChromeInvalidationClient::InvalidateUnknownVersion( return; } - EmitInvalidation(syncable::ModelEnumSet(model_type), ""); + EmitInvalidation(syncable::ModelTypeSet(model_type), ""); // TODO(akalin): We should really acknowledge only after we get the // updates from the sync server. (see http://crbug.com/78462). client->Acknowledge(ack_handle); @@ -231,7 +231,7 @@ void ChromeInvalidationClient::InvalidateAll( } void ChromeInvalidationClient::EmitInvalidation( - syncable::ModelEnumSet types, const std::string& payload) { + syncable::ModelTypeSet types, const std::string& payload) { DCHECK(non_thread_safe_.CalledOnValidThread()); syncable::ModelTypePayloadMap type_payloads = syncable::ModelTypePayloadMapFromEnumSet(types, payload); diff --git a/chrome/browser/sync/notifier/chrome_invalidation_client.h b/chrome/browser/sync/notifier/chrome_invalidation_client.h index a3b8ed8..921b8d8 100644 --- a/chrome/browser/sync/notifier/chrome_invalidation_client.h +++ b/chrome/browser/sync/notifier/chrome_invalidation_client.h @@ -83,7 +83,7 @@ class ChromeInvalidationClient // Register the sync types that we're interested in getting // notifications for. May be called at any time. - void RegisterTypes(syncable::ModelEnumSet types); + void RegisterTypes(syncable::ModelTypeSet types); virtual void WriteState(const std::string& state) OVERRIDE; @@ -122,7 +122,7 @@ class ChromeInvalidationClient friend class ChromeInvalidationClientTest; void EmitInvalidation( - syncable::ModelEnumSet types, const std::string& payload); + syncable::ModelTypeSet types, const std::string& payload); base::NonThreadSafe non_thread_safe_; ChromeSystemResources chrome_system_resources_; @@ -138,7 +138,7 @@ class ChromeInvalidationClient cache_invalidation_packet_handler_; scoped_ptr<RegistrationManager> registration_manager_; // Stored to pass to |registration_manager_| on start. - syncable::ModelEnumSet registered_types_; + syncable::ModelTypeSet registered_types_; bool ticl_ready_; DISALLOW_COPY_AND_ASSIGN(ChromeInvalidationClient); diff --git a/chrome/browser/sync/notifier/chrome_invalidation_client_unittest.cc b/chrome/browser/sync/notifier/chrome_invalidation_client_unittest.cc index 0c12863..a3555ca 100644 --- a/chrome/browser/sync/notifier/chrome_invalidation_client_unittest.cc +++ b/chrome/browser/sync/notifier/chrome_invalidation_client_unittest.cc @@ -142,7 +142,7 @@ syncable::ModelTypePayloadMap MakeMap(syncable::ModelType model_type, return type_payloads; } -syncable::ModelTypePayloadMap MakeMapFromSet(syncable::ModelEnumSet types, +syncable::ModelTypePayloadMap MakeMapFromSet(syncable::ModelTypeSet types, const std::string& payload) { return syncable::ModelTypePayloadMapFromEnumSet(types, payload); } @@ -150,7 +150,7 @@ syncable::ModelTypePayloadMap MakeMapFromSet(syncable::ModelEnumSet types, } // namespace TEST_F(ChromeInvalidationClientTest, InvalidateBadObjectId) { - syncable::ModelEnumSet types(syncable::BOOKMARKS, syncable::APPS); + syncable::ModelTypeSet types(syncable::BOOKMARKS, syncable::APPS); client_.RegisterTypes(types); EXPECT_CALL(mock_listener_, OnInvalidate(MakeMapFromSet(types, ""))); FireInvalidate("bad", 1, NULL); @@ -203,7 +203,7 @@ TEST_F(ChromeInvalidationClientTest, InvalidateUnknownVersion) { TEST_F(ChromeInvalidationClientTest, InvalidateVersionMultipleTypes) { using ::testing::Mock; - syncable::ModelEnumSet types(syncable::BOOKMARKS, syncable::APPS); + syncable::ModelTypeSet types(syncable::BOOKMARKS, syncable::APPS); client_.RegisterTypes(types); EXPECT_CALL(mock_listener_, @@ -258,14 +258,14 @@ TEST_F(ChromeInvalidationClientTest, InvalidateVersionMultipleTypes) { } TEST_F(ChromeInvalidationClientTest, InvalidateAll) { - syncable::ModelEnumSet types(syncable::PREFERENCES, syncable::EXTENSIONS); + syncable::ModelTypeSet types(syncable::PREFERENCES, syncable::EXTENSIONS); client_.RegisterTypes(types); EXPECT_CALL(mock_listener_, OnInvalidate(MakeMapFromSet(types, ""))); FireInvalidateAll(); } TEST_F(ChromeInvalidationClientTest, RegisterTypes) { - syncable::ModelEnumSet types(syncable::PREFERENCES, syncable::EXTENSIONS); + syncable::ModelTypeSet types(syncable::PREFERENCES, syncable::EXTENSIONS); client_.RegisterTypes(types); // Registered types should be preserved across Stop/Start. TearDown(); diff --git a/chrome/browser/sync/notifier/invalidation_notifier.cc b/chrome/browser/sync/notifier/invalidation_notifier.cc index 97bff34..9a69048 100644 --- a/chrome/browser/sync/notifier/invalidation_notifier.cc +++ b/chrome/browser/sync/notifier/invalidation_notifier.cc @@ -92,14 +92,14 @@ void InvalidationNotifier::UpdateCredentials( } void InvalidationNotifier::UpdateEnabledTypes( - syncable::ModelEnumSet enabled_types) { + syncable::ModelTypeSet enabled_types) { DCHECK(non_thread_safe_.CalledOnValidThread()); CHECK(!invalidation_client_id_.empty()); invalidation_client_.RegisterTypes(enabled_types); } void InvalidationNotifier::SendNotification( - syncable::ModelEnumSet changed_types) { + syncable::ModelTypeSet changed_types) { DCHECK(non_thread_safe_.CalledOnValidThread()); // Do nothing. } diff --git a/chrome/browser/sync/notifier/invalidation_notifier.h b/chrome/browser/sync/notifier/invalidation_notifier.h index 973e09b..ff6fe92 100644 --- a/chrome/browser/sync/notifier/invalidation_notifier.h +++ b/chrome/browser/sync/notifier/invalidation_notifier.h @@ -56,9 +56,9 @@ class InvalidationNotifier virtual void UpdateCredentials( const std::string& email, const std::string& token) OVERRIDE; virtual void UpdateEnabledTypes( - syncable::ModelEnumSet enabled_types) OVERRIDE; + syncable::ModelTypeSet enabled_types) OVERRIDE; virtual void SendNotification( - syncable::ModelEnumSet changed_types) OVERRIDE; + syncable::ModelTypeSet changed_types) OVERRIDE; // notifier::LoginDelegate implementation. virtual void OnConnect( diff --git a/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.cc b/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.cc index 48f07d2..6aff10c 100644 --- a/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.cc +++ b/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.cc @@ -33,7 +33,7 @@ class NonBlockingInvalidationNotifier::Core void SetUniqueId(const std::string& unique_id); void SetState(const std::string& state); void UpdateCredentials(const std::string& email, const std::string& token); - void UpdateEnabledTypes(syncable::ModelEnumSet enabled_types); + void UpdateEnabledTypes(syncable::ModelTypeSet enabled_types); // SyncNotifierObserver implementation (all called on I/O thread). virtual void OnIncomingNotification( @@ -113,7 +113,7 @@ void NonBlockingInvalidationNotifier::Core::UpdateCredentials( } void NonBlockingInvalidationNotifier::Core::UpdateEnabledTypes( - syncable::ModelEnumSet enabled_types) { + syncable::ModelTypeSet enabled_types) { DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); invalidation_notifier_->UpdateEnabledTypes(enabled_types); } @@ -223,7 +223,7 @@ void NonBlockingInvalidationNotifier::UpdateCredentials( } void NonBlockingInvalidationNotifier::UpdateEnabledTypes( - syncable::ModelEnumSet enabled_types) { + syncable::ModelTypeSet enabled_types) { DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); if (!io_message_loop_proxy_->PostTask( FROM_HERE, @@ -234,7 +234,7 @@ void NonBlockingInvalidationNotifier::UpdateEnabledTypes( } void NonBlockingInvalidationNotifier::SendNotification( - syncable::ModelEnumSet changed_types) { + syncable::ModelTypeSet changed_types) { DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); // InvalidationClient doesn't implement SendNotification(), so no // need to forward on the call. diff --git a/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.h b/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.h index 5b955cd..9299b3b 100644 --- a/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.h +++ b/chrome/browser/sync/notifier/non_blocking_invalidation_notifier.h @@ -50,9 +50,9 @@ class NonBlockingInvalidationNotifier virtual void UpdateCredentials( const std::string& email, const std::string& token) OVERRIDE; virtual void UpdateEnabledTypes( - syncable::ModelEnumSet enabled_types) OVERRIDE; + syncable::ModelTypeSet enabled_types) OVERRIDE; virtual void SendNotification( - syncable::ModelEnumSet changed_types) OVERRIDE; + syncable::ModelTypeSet changed_types) OVERRIDE; // SyncNotifierObserver implementation. virtual void OnIncomingNotification( diff --git a/chrome/browser/sync/notifier/p2p_notifier.cc b/chrome/browser/sync/notifier/p2p_notifier.cc index dc380f2..60555a3 100644 --- a/chrome/browser/sync/notifier/p2p_notifier.cc +++ b/chrome/browser/sync/notifier/p2p_notifier.cc @@ -65,7 +65,7 @@ P2PNotificationData::P2PNotificationData() : target_(NOTIFY_SELF) {} P2PNotificationData::P2PNotificationData( const std::string& sender_id, P2PNotificationTarget target, - syncable::ModelEnumSet changed_types) + syncable::ModelTypeSet changed_types) : sender_id_(sender_id), target_(target), changed_types_(changed_types) {} @@ -86,7 +86,7 @@ bool P2PNotificationData::IsTargeted(const std::string& id) const { } } -syncable::ModelEnumSet P2PNotificationData::GetChangedTypes() const { +syncable::ModelTypeSet P2PNotificationData::GetChangedTypes() const { return changed_types_; } @@ -102,7 +102,7 @@ std::string P2PNotificationData::ToString() const { dict->SetString(kSenderIdKey, sender_id_); dict->SetString(kNotificationTypeKey, P2PNotificationTargetToString(target_)); - dict->Set(kChangedTypesKey, syncable::ModelEnumSetToValue(changed_types_)); + dict->Set(kChangedTypesKey, syncable::ModelTypeSetToValue(changed_types_)); std::string json; base::JSONWriter::Write(dict.get(), false /* pretty_print */, &json); return json; @@ -138,7 +138,7 @@ bool P2PNotificationData::ResetFromString(const std::string& str) { << kChangedTypesKey; return false; } - changed_types_ = syncable::ModelEnumSetFromValue(*changed_types_list); + changed_types_ = syncable::ModelTypeSetFromValue(*changed_types_list); return true; } @@ -212,9 +212,9 @@ void P2PNotifier::UpdateCredentials( } void P2PNotifier::UpdateEnabledTypes( - syncable::ModelEnumSet enabled_types) { + syncable::ModelTypeSet enabled_types) { DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); - const syncable::ModelEnumSet new_enabled_types = + const syncable::ModelTypeSet new_enabled_types = Difference(enabled_types, enabled_types_); enabled_types_ = enabled_types; const P2PNotificationData notification_data( @@ -223,7 +223,7 @@ void P2PNotifier::UpdateEnabledTypes( } void P2PNotifier::SendNotification( - syncable::ModelEnumSet changed_types) { + syncable::ModelTypeSet changed_types) { DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); const P2PNotificationData notification_data( unique_id_, send_notification_target_, changed_types); diff --git a/chrome/browser/sync/notifier/p2p_notifier.h b/chrome/browser/sync/notifier/p2p_notifier.h index 6a8a376..6ff0053 100644 --- a/chrome/browser/sync/notifier/p2p_notifier.h +++ b/chrome/browser/sync/notifier/p2p_notifier.h @@ -53,14 +53,14 @@ class P2PNotificationData { P2PNotificationData(); P2PNotificationData(const std::string& sender_id, P2PNotificationTarget target, - syncable::ModelEnumSet changed_types); + syncable::ModelTypeSet changed_types); ~P2PNotificationData(); // Returns true if the given ID is targeted by this notification. bool IsTargeted(const std::string& id) const; - syncable::ModelEnumSet GetChangedTypes() const; + syncable::ModelTypeSet GetChangedTypes() const; bool Equals(const P2PNotificationData& other) const; @@ -76,7 +76,7 @@ class P2PNotificationData { // The intendent recipient(s) of the notification. P2PNotificationTarget target_; // The types the notification is for. - syncable::ModelEnumSet changed_types_; + syncable::ModelTypeSet changed_types_; }; class P2PNotifier @@ -104,9 +104,9 @@ class P2PNotifier virtual void UpdateCredentials( const std::string& email, const std::string& token) OVERRIDE; virtual void UpdateEnabledTypes( - syncable::ModelEnumSet enabled_types) OVERRIDE; + syncable::ModelTypeSet enabled_types) OVERRIDE; virtual void SendNotification( - syncable::ModelEnumSet changed_types) OVERRIDE; + syncable::ModelTypeSet changed_types) OVERRIDE; // TalkMediator::Delegate implementation. virtual void OnNotificationStateChange(bool notifications_enabled) OVERRIDE; @@ -135,7 +135,7 @@ class P2PNotifier // Which set of clients should be sent notifications. P2PNotificationTarget send_notification_target_; - syncable::ModelEnumSet enabled_types_; + syncable::ModelTypeSet enabled_types_; scoped_refptr<base::MessageLoopProxy> parent_message_loop_proxy_; }; diff --git a/chrome/browser/sync/notifier/p2p_notifier_unittest.cc b/chrome/browser/sync/notifier/p2p_notifier_unittest.cc index 7036381..51344ba 100644 --- a/chrome/browser/sync/notifier/p2p_notifier_unittest.cc +++ b/chrome/browser/sync/notifier/p2p_notifier_unittest.cc @@ -75,7 +75,7 @@ class P2PNotifierTest : public testing::Test { } syncable::ModelTypePayloadMap MakePayloadMap( - syncable::ModelEnumSet types) { + syncable::ModelTypeSet types) { return syncable::ModelTypePayloadMapFromEnumSet(types, ""); } @@ -100,21 +100,21 @@ TEST_F(P2PNotifierTest, P2PNotificationTarget) { TEST_F(P2PNotifierTest, P2PNotificationDataIsTargeted) { { const P2PNotificationData notification_data( - "sender", NOTIFY_SELF, syncable::ModelEnumSet()); + "sender", NOTIFY_SELF, syncable::ModelTypeSet()); EXPECT_TRUE(notification_data.IsTargeted("sender")); EXPECT_FALSE(notification_data.IsTargeted("other1")); EXPECT_FALSE(notification_data.IsTargeted("other2")); } { const P2PNotificationData notification_data( - "sender", NOTIFY_OTHERS, syncable::ModelEnumSet()); + "sender", NOTIFY_OTHERS, syncable::ModelTypeSet()); EXPECT_FALSE(notification_data.IsTargeted("sender")); EXPECT_TRUE(notification_data.IsTargeted("other1")); EXPECT_TRUE(notification_data.IsTargeted("other2")); } { const P2PNotificationData notification_data( - "sender", NOTIFY_ALL, syncable::ModelEnumSet()); + "sender", NOTIFY_ALL, syncable::ModelTypeSet()); EXPECT_TRUE(notification_data.IsTargeted("sender")); EXPECT_TRUE(notification_data.IsTargeted("other1")); EXPECT_TRUE(notification_data.IsTargeted("other2")); @@ -138,7 +138,7 @@ TEST_F(P2PNotifierTest, P2PNotificationDataDefault) { } TEST_F(P2PNotifierTest, P2PNotificationDataNonDefault) { - const syncable::ModelEnumSet changed_types( + const syncable::ModelTypeSet changed_types( syncable::BOOKMARKS, syncable::THEMES); const P2PNotificationData notification_data( "sender", NOTIFY_ALL, changed_types); @@ -158,7 +158,7 @@ TEST_F(P2PNotifierTest, P2PNotificationDataNonDefault) { } TEST_F(P2PNotifierTest, NotificationsBasic) { - syncable::ModelEnumSet enabled_types( + syncable::ModelTypeSet enabled_types( syncable::BOOKMARKS, syncable::PREFERENCES); EXPECT_CALL(mock_observer_, OnNotificationStateChange(true)); @@ -171,17 +171,17 @@ TEST_F(P2PNotifierTest, NotificationsBasic) { // Sent with target NOTIFY_OTHERS so should not be propagated to // |mock_observer_|. { - syncable::ModelEnumSet changed_types( + syncable::ModelTypeSet changed_types( syncable::THEMES, syncable::APPS); p2p_notifier_->SendNotification(changed_types); } } TEST_F(P2PNotifierTest, SendNotificationData) { - syncable::ModelEnumSet enabled_types( + syncable::ModelTypeSet enabled_types( syncable::BOOKMARKS, syncable::PREFERENCES); - syncable::ModelEnumSet changed_types( + syncable::ModelTypeSet changed_types( syncable::THEMES, syncable::APPS); const syncable::ModelTypePayloadMap& changed_payload_map = @@ -213,7 +213,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) { // Should be dropped. Mock::VerifyAndClearExpectations(&mock_observer_); p2p_notifier_->SendNotificationDataForTest( - P2PNotificationData("sender", NOTIFY_SELF, syncable::ModelEnumSet())); + P2PNotificationData("sender", NOTIFY_SELF, syncable::ModelTypeSet())); // Should be dropped. p2p_notifier_->SendNotificationDataForTest( @@ -228,7 +228,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) { // Should be dropped. Mock::VerifyAndClearExpectations(&mock_observer_); p2p_notifier_->SendNotificationDataForTest( - P2PNotificationData("sender2", NOTIFY_OTHERS, syncable::ModelEnumSet())); + P2PNotificationData("sender2", NOTIFY_OTHERS, syncable::ModelTypeSet())); // Should be propagated. Mock::VerifyAndClearExpectations(&mock_observer_); @@ -245,7 +245,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) { // Should be dropped. Mock::VerifyAndClearExpectations(&mock_observer_); p2p_notifier_->SendNotificationDataForTest( - P2PNotificationData("sender2", NOTIFY_ALL, syncable::ModelEnumSet())); + P2PNotificationData("sender2", NOTIFY_ALL, syncable::ModelTypeSet())); } } // namespace diff --git a/chrome/browser/sync/notifier/registration_manager.cc b/chrome/browser/sync/notifier/registration_manager.cc index d510012..1adb167 100644 --- a/chrome/browser/sync/notifier/registration_manager.cc +++ b/chrome/browser/sync/notifier/registration_manager.cc @@ -70,7 +70,7 @@ RegistrationManager::~RegistrationManager() { } void RegistrationManager::SetRegisteredTypes( - syncable::ModelEnumSet types) { + syncable::ModelTypeSet types) { DCHECK(non_thread_safe_.CalledOnValidThread()); for (int i = syncable::FIRST_REAL_MODEL_TYPE; @@ -118,9 +118,9 @@ void RegistrationManager::DisableType(syncable::ModelType model_type) { status->Disable(); } -syncable::ModelEnumSet RegistrationManager::GetRegisteredTypes() const { +syncable::ModelTypeSet RegistrationManager::GetRegisteredTypes() const { DCHECK(non_thread_safe_.CalledOnValidThread()); - syncable::ModelEnumSet registered_types; + syncable::ModelTypeSet registered_types; for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { syncable::ModelType model_type = syncable::ModelTypeFromInt(i); diff --git a/chrome/browser/sync/notifier/registration_manager.h b/chrome/browser/sync/notifier/registration_manager.h index 272cda6..bc853a7 100644 --- a/chrome/browser/sync/notifier/registration_manager.h +++ b/chrome/browser/sync/notifier/registration_manager.h @@ -67,7 +67,7 @@ class RegistrationManager { // Registers all types included in the given set (that are not // already disabled) and sets all other types to be unregistered. - void SetRegisteredTypes(syncable::ModelEnumSet types); + void SetRegisteredTypes(syncable::ModelTypeSet types); // Marks the registration for the |model_type| lost and re-registers // it (unless it's disabled). @@ -84,7 +84,7 @@ class RegistrationManager { // The functions below should only be used in tests. // Gets all currently-registered types. - syncable::ModelEnumSet GetRegisteredTypes() const; + syncable::ModelTypeSet GetRegisteredTypes() const; // Gets all pending registrations and their next min delays. PendingRegistrationMap GetPendingRegistrations() const; diff --git a/chrome/browser/sync/notifier/registration_manager_unittest.cc b/chrome/browser/sync/notifier/registration_manager_unittest.cc index be2d0d9..2fba6fc 100644 --- a/chrome/browser/sync/notifier/registration_manager_unittest.cc +++ b/chrome/browser/sync/notifier/registration_manager_unittest.cc @@ -95,12 +95,12 @@ class FakeInvalidationClient : public invalidation::InvalidationClient { // Unused for now. } - const syncable::ModelEnumSet GetRegisteredTypes() const { + const syncable::ModelTypeSet GetRegisteredTypes() const { return registered_types_; } private: - syncable::ModelEnumSet registered_types_; + syncable::ModelTypeSet registered_types_; DISALLOW_COPY_AND_ASSIGN(FakeInvalidationClient); }; @@ -114,9 +114,9 @@ const syncable::ModelType kModelTypes[] = { }; const size_t kModelTypeCount = arraysize(kModelTypes); -syncable::ModelEnumSet FromPtr( +syncable::ModelTypeSet FromPtr( const syncable::ModelType* types, size_t count) { - syncable::ModelEnumSet type_set; + syncable::ModelTypeSet type_set; for (size_t i = 0; i < count; ++i) { type_set.Put(types[i]); } @@ -124,10 +124,10 @@ syncable::ModelEnumSet FromPtr( } void ExpectPendingRegistrations( - syncable::ModelEnumSet expected_pending_types, + syncable::ModelTypeSet expected_pending_types, double expected_delay_seconds, const RegistrationManager::PendingRegistrationMap& pending_registrations) { - syncable::ModelEnumSet pending_types; + syncable::ModelTypeSet pending_types; for (RegistrationManager::PendingRegistrationMap::const_iterator it = pending_registrations.begin(); it != pending_registrations.end(); ++it) { @@ -160,16 +160,16 @@ class RegistrationManagerTest : public testing::Test { virtual ~RegistrationManagerTest() {} - void LoseRegistrations(syncable::ModelEnumSet types) { - for (syncable::ModelEnumSet::Iterator it = types.First(); + void LoseRegistrations(syncable::ModelTypeSet types) { + for (syncable::ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) { fake_invalidation_client_.LoseRegistration(it.Get()); fake_registration_manager_.MarkRegistrationLost(it.Get()); } } - void DisableTypes(syncable::ModelEnumSet types) { - for (syncable::ModelEnumSet::Iterator it = types.First(); + void DisableTypes(syncable::ModelTypeSet types) { + for (syncable::ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) { fake_invalidation_client_.LoseRegistration(it.Get()); fake_registration_manager_.DisableType(it.Get()); @@ -179,11 +179,11 @@ class RegistrationManagerTest : public testing::Test { // Used by MarkRegistrationLostBackoff* tests. void RunBackoffTest(double jitter) { fake_registration_manager_.SetJitter(jitter); - syncable::ModelEnumSet types = FromPtr(kModelTypes, kModelTypeCount); + syncable::ModelTypeSet types = FromPtr(kModelTypes, kModelTypeCount); fake_registration_manager_.SetRegisteredTypes(types); // Lose some types. - syncable::ModelEnumSet lost_types = FromPtr(kModelTypes, 2); + syncable::ModelTypeSet lost_types = FromPtr(kModelTypes, 2); LoseRegistrations(lost_types); ExpectPendingRegistrations( lost_types, 0.0, @@ -239,7 +239,7 @@ class RegistrationManagerTest : public testing::Test { }; TEST_F(RegistrationManagerTest, SetRegisteredTypes) { - syncable::ModelEnumSet types = FromPtr(kModelTypes, kModelTypeCount); + syncable::ModelTypeSet types = FromPtr(kModelTypes, kModelTypeCount); EXPECT_TRUE(fake_registration_manager_.GetRegisteredTypes().Empty()); EXPECT_TRUE(fake_invalidation_client_.GetRegisteredTypes().Empty()); @@ -294,15 +294,15 @@ TEST_F(RegistrationManagerTest, CalculateBackoff) { } TEST_F(RegistrationManagerTest, MarkRegistrationLost) { - syncable::ModelEnumSet types = FromPtr(kModelTypes, kModelTypeCount); + syncable::ModelTypeSet types = FromPtr(kModelTypes, kModelTypeCount); fake_registration_manager_.SetRegisteredTypes(types); EXPECT_TRUE(fake_registration_manager_.GetPendingRegistrations().empty()); // Lose some types. - syncable::ModelEnumSet lost_types = FromPtr( + syncable::ModelTypeSet lost_types = FromPtr( kModelTypes, 3); - syncable::ModelEnumSet non_lost_types = FromPtr( + syncable::ModelTypeSet non_lost_types = FromPtr( kModelTypes + 3, kModelTypeCount - 3); LoseRegistrations(lost_types); ExpectPendingRegistrations( @@ -334,12 +334,12 @@ TEST_F(RegistrationManagerTest, MarkRegistrationLostBackoffHigh) { } TEST_F(RegistrationManagerTest, MarkRegistrationLostBackoffReset) { - syncable::ModelEnumSet types = FromPtr(kModelTypes, kModelTypeCount); + syncable::ModelTypeSet types = FromPtr(kModelTypes, kModelTypeCount); fake_registration_manager_.SetRegisteredTypes(types); // Lose some types. - syncable::ModelEnumSet lost_types = FromPtr(kModelTypes, 2); + syncable::ModelTypeSet lost_types = FromPtr(kModelTypes, 2); LoseRegistrations(lost_types); ExpectPendingRegistrations( lost_types, 0.0, @@ -357,19 +357,19 @@ TEST_F(RegistrationManagerTest, MarkRegistrationLostBackoffReset) { // Set types again. fake_registration_manager_.SetRegisteredTypes(types); ExpectPendingRegistrations( - syncable::ModelEnumSet(), 0.0, + syncable::ModelTypeSet(), 0.0, fake_registration_manager_.GetPendingRegistrations()); } TEST_F(RegistrationManagerTest, MarkAllRegistrationsLost) { - syncable::ModelEnumSet types = FromPtr(kModelTypes, kModelTypeCount); + syncable::ModelTypeSet types = FromPtr(kModelTypes, kModelTypeCount); fake_registration_manager_.SetRegisteredTypes(types); fake_invalidation_client_.LoseAllRegistrations(); fake_registration_manager_.MarkAllRegistrationsLost(); - syncable::ModelEnumSet expected_types; + syncable::ModelTypeSet expected_types; EXPECT_TRUE( fake_registration_manager_.GetRegisteredTypes().Equals(expected_types)); EXPECT_TRUE( @@ -398,19 +398,19 @@ TEST_F(RegistrationManagerTest, MarkAllRegistrationsLost) { } TEST_F(RegistrationManagerTest, DisableType) { - syncable::ModelEnumSet types = FromPtr(kModelTypes, kModelTypeCount); + syncable::ModelTypeSet types = FromPtr(kModelTypes, kModelTypeCount); fake_registration_manager_.SetRegisteredTypes(types); EXPECT_TRUE(fake_registration_manager_.GetPendingRegistrations().empty()); // Disable some types. - syncable::ModelEnumSet disabled_types = FromPtr( + syncable::ModelTypeSet disabled_types = FromPtr( kModelTypes, 3); - syncable::ModelEnumSet enabled_types = FromPtr( + syncable::ModelTypeSet enabled_types = FromPtr( kModelTypes + 3, kModelTypeCount - 3); DisableTypes(disabled_types); ExpectPendingRegistrations( - syncable::ModelEnumSet(), 0.0, + syncable::ModelTypeSet(), 0.0, fake_registration_manager_.GetPendingRegistrations()); EXPECT_TRUE( fake_registration_manager_.GetRegisteredTypes().Equals(enabled_types)); @@ -424,7 +424,7 @@ TEST_F(RegistrationManagerTest, DisableType) { fake_registration_manager_.MarkRegistrationLost( disabled_types.First().Get()); ExpectPendingRegistrations( - syncable::ModelEnumSet(), 0.0, + syncable::ModelTypeSet(), 0.0, fake_registration_manager_.GetPendingRegistrations()); fake_registration_manager_.MarkAllRegistrationsLost(); diff --git a/chrome/browser/sync/notifier/sync_notifier.h b/chrome/browser/sync/notifier/sync_notifier.h index a484dea..a4f535e 100644 --- a/chrome/browser/sync/notifier/sync_notifier.h +++ b/chrome/browser/sync/notifier/sync_notifier.h @@ -40,14 +40,14 @@ class SyncNotifier { const std::string& email, const std::string& token) = 0; virtual void UpdateEnabledTypes( - syncable::ModelEnumSet enabled_types) = 0; + syncable::ModelTypeSet enabled_types) = 0; // This is here only to support the old p2p notification implementation, // which is still used by sync integration tests. // TODO(akalin): Remove this once we move the integration tests off p2p // notifications. virtual void SendNotification( - syncable::ModelEnumSet changed_types) = 0; + syncable::ModelTypeSet changed_types) = 0; }; } // namespace sync_notifier diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index a421d0f..ec607a3 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -306,7 +306,7 @@ void ProfileSyncService::InitializeBackend(bool delete_stale_data) { return; } - syncable::ModelEnumSet initial_types; + syncable::ModelTypeSet initial_types; // If sync setup hasn't finished, we don't want to initialize routing info // for any data types so that we don't download updates for types that the // user chooses not to sync on the first DownloadUpdatesCommand. @@ -340,8 +340,8 @@ void ProfileSyncService::CreateBackend() { bool ProfileSyncService::IsEncryptedDatatypeEnabled() const { if (encryption_pending()) return true; - const syncable::ModelEnumSet preferred_types = GetPreferredDataTypes(); - const syncable::ModelEnumSet encrypted_types = GetEncryptedDataTypes(); + const syncable::ModelTypeSet preferred_types = GetPreferredDataTypes(); + const syncable::ModelTypeSet encrypted_types = GetEncryptedDataTypes(); DCHECK(encrypted_types.Has(syncable::PASSWORDS)); return !Intersection(preferred_types, encrypted_types).Empty(); } @@ -630,7 +630,7 @@ void ProfileSyncService::OnSyncCycleCompleted() { // TODO(sync): eventually support removing datatypes too. void ProfileSyncService::OnDataTypesChanged( - syncable::ModelEnumSet to_add) { + syncable::ModelTypeSet to_add) { // If this is a first time sync for a client, this will be called before // OnBackendInitialized() to ensure the new datatypes are available at sync // setup. As a result, the migrator won't exist yet. This is fine because for @@ -643,16 +643,16 @@ void ProfileSyncService::OnDataTypesChanged( } DVLOG(2) << "OnDataTypesChanged called with types: " - << syncable::ModelEnumSetToString(to_add); + << syncable::ModelTypeSetToString(to_add); - const syncable::ModelEnumSet registered_types = GetRegisteredDataTypes(); + const syncable::ModelTypeSet registered_types = GetRegisteredDataTypes(); - const syncable::ModelEnumSet to_register = + const syncable::ModelTypeSet to_register = Difference(to_add, registered_types); - DVLOG(2) << "Enabling types: " << syncable::ModelEnumSetToString(to_register); + DVLOG(2) << "Enabling types: " << syncable::ModelTypeSetToString(to_register); - for (syncable::ModelEnumSet::Iterator it = to_register.First(); + for (syncable::ModelTypeSet::Iterator it = to_register.First(); it.Good(); it.Inc()) { // Received notice to enable experimental type. Check if the type is // registered, and if not register a new datatype controller. @@ -683,7 +683,7 @@ void ProfileSyncService::OnDataTypesChanged( // Otherwise, just leave the experimental types on by default. if (!to_register.Empty() && HasSyncSetupCompleted() && migrator_.get()) { DVLOG(1) << "Dynamically enabling new datatypes: " - << syncable::ModelEnumSetToString(to_register); + << syncable::ModelTypeSetToString(to_register); OnMigrationNeededForTypes(to_register); } } @@ -825,7 +825,7 @@ void ProfileSyncService::OnPassphraseAccepted() { // Make sure the data types that depend on the passphrase are started at // this time. - const syncable::ModelEnumSet types = GetPreferredDataTypes(); + const syncable::ModelTypeSet types = GetPreferredDataTypes(); if (data_type_manager_.get()) { // Unblock the data type manager if necessary. @@ -852,12 +852,12 @@ void ProfileSyncService::ResolvePassphraseRequired() { } void ProfileSyncService::OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) { encrypted_types_ = encrypted_types; encrypt_everything_ = encrypt_everything; DVLOG(1) << "Encrypted types changed to " - << syncable::ModelEnumSetToString(encrypted_types_) + << syncable::ModelTypeSetToString(encrypted_types_) << " (encrypt everything is set to " << (encrypt_everything_ ? "true" : "false") << ")"; DCHECK(encrypted_types_.Has(syncable::PASSWORDS)); @@ -877,7 +877,7 @@ void ProfileSyncService::OnEncryptionComplete() { } void ProfileSyncService::OnMigrationNeededForTypes( - syncable::ModelEnumSet types) { + syncable::ModelTypeSet types) { DCHECK(backend_initialized_); DCHECK(data_type_manager_.get()); @@ -1097,7 +1097,7 @@ void ProfileSyncService::OnUserSubmittedOAuth( } void ProfileSyncService::OnUserChoseDatatypes(bool sync_everything, - syncable::ModelEnumSet chosen_types) { + syncable::ModelTypeSet chosen_types) { if (!backend_.get() && unrecoverable_error_detected_ == false) { NOTREACHED(); @@ -1137,11 +1137,11 @@ void ProfileSyncService::OnUserCancelledDialog() { } void ProfileSyncService::ChangePreferredDataTypes( - syncable::ModelEnumSet preferred_types) { + syncable::ModelTypeSet preferred_types) { DVLOG(1) << "ChangePreferredDataTypes invoked"; - const syncable::ModelEnumSet registered_types = GetRegisteredDataTypes(); - const syncable::ModelEnumSet registered_preferred_types = + const syncable::ModelTypeSet registered_types = GetRegisteredDataTypes(); + const syncable::ModelTypeSet registered_preferred_types = Intersection(registered_types, preferred_types); sync_prefs_.SetPreferredDataTypes(registered_types, registered_preferred_types); @@ -1150,17 +1150,17 @@ void ProfileSyncService::ChangePreferredDataTypes( ReconfigureDatatypeManager(); } -syncable::ModelEnumSet ProfileSyncService::GetPreferredDataTypes() const { - const syncable::ModelEnumSet registered_types = GetRegisteredDataTypes(); - const syncable::ModelEnumSet preferred_types = +syncable::ModelTypeSet ProfileSyncService::GetPreferredDataTypes() const { + const syncable::ModelTypeSet registered_types = GetRegisteredDataTypes(); + const syncable::ModelTypeSet preferred_types = sync_prefs_.GetPreferredDataTypes(registered_types); - const syncable::ModelEnumSet failed_types = + const syncable::ModelTypeSet failed_types = failed_datatypes_handler_.GetFailedTypes(); return Difference(preferred_types, failed_types); } -syncable::ModelEnumSet ProfileSyncService::GetRegisteredDataTypes() const { - syncable::ModelEnumSet registered_types; +syncable::ModelTypeSet ProfileSyncService::GetRegisteredDataTypes() const { + syncable::ModelTypeSet registered_types; // The data_type_controllers_ are determined by command-line flags; that's // effectively what controls the values returned here. for (DataTypeController::TypeMap::const_iterator it = @@ -1215,7 +1215,7 @@ void ProfileSyncService::ConfigureDataTypeManager() { this, data_type_manager_.get())); } - const syncable::ModelEnumSet types = GetPreferredDataTypes(); + const syncable::ModelTypeSet types = GetPreferredDataTypes(); if (IsPassphraseRequiredForDecryption()) { // We need a passphrase still. We don't bother to attempt to configure // until we receive an OnPassphraseAccepted (which triggers a configure). @@ -1329,7 +1329,7 @@ bool ProfileSyncService::EncryptEverythingEnabled() const { return encrypt_everything_; } -syncable::ModelEnumSet ProfileSyncService::GetEncryptedDataTypes() const { +syncable::ModelTypeSet ProfileSyncService::GetEncryptedDataTypes() const { DCHECK(encrypted_types_.Has(syncable::PASSWORDS)); // We may be called during the setup process before we're // initialized. In this case, we default to the sensitive types. diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index 79e1a94..4b94fc5 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -212,13 +212,13 @@ class ProfileSyncService : public browser_sync::SyncFrontend, sync_api::PassphraseRequiredReason reason) OVERRIDE; virtual void OnPassphraseAccepted() OVERRIDE; virtual void OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) OVERRIDE; virtual void OnEncryptionComplete() OVERRIDE; virtual void OnMigrationNeededForTypes( - syncable::ModelEnumSet types) OVERRIDE; + syncable::ModelTypeSet types) OVERRIDE; virtual void OnDataTypesChanged( - syncable::ModelEnumSet to_add) OVERRIDE; + syncable::ModelTypeSet to_add) OVERRIDE; virtual void OnActionableError( const browser_sync::SyncProtocolError& error) OVERRIDE; @@ -242,7 +242,7 @@ class ProfileSyncService : public browser_sync::SyncFrontend, // and all data types will be synced. |sync_everything| means "sync all // current and future data types." virtual void OnUserChoseDatatypes(bool sync_everything, - syncable::ModelEnumSet chosen_types); + syncable::ModelTypeSet chosen_types); // Called when a user cancels any setup dialog (login, etc). virtual void OnUserCancelledDialog(); @@ -410,18 +410,18 @@ class ProfileSyncService : public browser_sync::SyncFrontend, // the sync backend so that exactly these datatypes are actively synced. See // class comment for more on what it means for a datatype to be Preferred. virtual void ChangePreferredDataTypes( - syncable::ModelEnumSet preferred_types); + syncable::ModelTypeSet preferred_types); // Get the set of currently enabled data types (as chosen or configured by // the user). See class comment for more on what it means for a datatype // to be Preferred. - virtual syncable::ModelEnumSet GetPreferredDataTypes() const; + virtual syncable::ModelTypeSet GetPreferredDataTypes() const; // Gets the set of all data types that could be allowed (the set that // should be advertised to the user). These will typically only change // via a command-line option. See class comment for more on what it means // for a datatype to be Registered. - virtual syncable::ModelEnumSet GetRegisteredDataTypes() const; + virtual syncable::ModelTypeSet GetRegisteredDataTypes() const; // Checks whether the Cryptographer is ready to encrypt and decrypt updates // for sensitive data types. Caller must be holding a @@ -456,7 +456,7 @@ class ProfileSyncService : public browser_sync::SyncFrontend, // Fills |encrypted_types| with the set of currently encrypted types. Does // not account for types pending encryption. - virtual syncable::ModelEnumSet GetEncryptedDataTypes() const; + virtual syncable::ModelTypeSet GetEncryptedDataTypes() const; // Returns true if the syncer is waiting for new datatypes to be encrypted. virtual bool encryption_pending() const; @@ -676,7 +676,7 @@ class ProfileSyncService : public browser_sync::SyncFrontend, // The current set of encrypted types. Always a superset of // Cryptographer::SensitiveTypes(). - syncable::ModelEnumSet encrypted_types_; + syncable::ModelTypeSet encrypted_types_; // Whether we want to encrypt everything. bool encrypt_everything_; diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc index 50c7b32..c172556 100644 --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc @@ -605,7 +605,7 @@ class WriteTransactionTest: public WriteTransaction { wait_for_syncapi_(wait_for_syncapi) { } virtual void NotifyTransactionComplete( - syncable::ModelEnumSet types) OVERRIDE { + syncable::ModelTypeSet types) OVERRIDE { // This is where we differ. Force a thread change here, giving another // thread a chance to create a WriteTransaction (*wait_for_syncapi_)->Wait(); diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc index 05bb5fe..1a8d3cb 100644 --- a/chrome/browser/sync/profile_sync_service_harness.cc +++ b/chrome/browser/sync/profile_sync_service_harness.cc @@ -137,7 +137,7 @@ bool ProfileSyncServiceHarness::IsSyncAlreadySetup() { } bool ProfileSyncServiceHarness::SetupSync() { - bool result = SetupSync(syncable::ModelEnumSet::All()); + bool result = SetupSync(syncable::ModelTypeSet::All()); if (result == false) { std::string status = GetServiceStatus(); LOG(ERROR) << profile_debug_name_ @@ -149,7 +149,7 @@ bool ProfileSyncServiceHarness::SetupSync() { } bool ProfileSyncServiceHarness::SetupSync( - syncable::ModelEnumSet synced_datatypes) { + syncable::ModelTypeSet synced_datatypes) { // Initialize the sync client's profile sync service object. service_ = profile_->GetProfileSyncService(""); if (service_ == NULL) { @@ -175,7 +175,7 @@ bool ProfileSyncServiceHarness::SetupSync( // Choose the datatypes to be synced. If all datatypes are to be synced, // set sync_everything to true; otherwise, set it to false. bool sync_everything = - synced_datatypes.Equals(syncable::ModelEnumSet::All()); + synced_datatypes.Equals(syncable::ModelTypeSet::All()); service()->OnUserChoseDatatypes(sync_everything, synced_datatypes); // Subscribe sync client to notifications from the backend migrator @@ -452,14 +452,14 @@ void ProfileSyncServiceHarness::OnMigrationStateChange() { service()->GetBackendMigratorForTest()-> GetPendingMigrationTypesForTest()); DVLOG(1) << profile_debug_name_ << ": new pending migration types " - << syncable::ModelEnumSetToString(pending_migration_types_); + << syncable::ModelTypeSetToString(pending_migration_types_); } else { // Merge just-finished pending migration types into // |migration_types_|. migrated_types_.PutAll(pending_migration_types_); pending_migration_types_.Clear(); DVLOG(1) << profile_debug_name_ << ": new migrated types " - << syncable::ModelEnumSetToString(migrated_types_); + << syncable::ModelTypeSetToString(migrated_types_); } RunStateChangeMachine(); } @@ -624,16 +624,16 @@ bool ProfileSyncServiceHarness::AwaitActionableError() { } bool ProfileSyncServiceHarness::AwaitMigration( - syncable::ModelEnumSet expected_migrated_types) { + syncable::ModelTypeSet expected_migrated_types) { DVLOG(1) << GetClientInfoString("AwaitMigration"); DVLOG(1) << profile_debug_name_ << ": waiting until migration is done for " - << syncable::ModelEnumSetToString(expected_migrated_types); + << syncable::ModelTypeSetToString(expected_migrated_types); while (true) { bool migration_finished = migrated_types_.HasAll(expected_migrated_types); DVLOG(1) << "Migrated types " - << syncable::ModelEnumSetToString(migrated_types_) + << syncable::ModelTypeSetToString(migrated_types_) << (migration_finished ? " contains " : " does not contain ") - << syncable::ModelEnumSetToString(expected_migrated_types); + << syncable::ModelTypeSetToString(expected_migrated_types); if (migration_finished) { return true; } @@ -823,13 +823,13 @@ bool ProfileSyncServiceHarness::MatchesOtherClient( // Only look for a match if we have at least one enabled datatype in // common with the partner client. - const syncable::ModelEnumSet common_types = + const syncable::ModelTypeSet common_types = Intersection(service()->GetPreferredDataTypes(), partner->service()->GetPreferredDataTypes()); DVLOG(2) << profile_debug_name_ << ", " << partner->profile_debug_name_ << ": common types are " - << syncable::ModelEnumSetToString(common_types); + << syncable::ModelTypeSetToString(common_types); if (!common_types.Empty() && !partner->IsFullySynced()) { DVLOG(2) << "non-empty common types and " @@ -837,7 +837,7 @@ bool ProfileSyncServiceHarness::MatchesOtherClient( return false; } - for (syncable::ModelEnumSet::Iterator i = common_types.First(); + for (syncable::ModelTypeSet::Iterator i = common_types.First(); i.Good(); i.Inc()) { const std::string timestamp = GetUpdatedTimestamp(i.Get()); const std::string partner_timestamp = partner->GetUpdatedTimestamp(i.Get()); @@ -880,7 +880,7 @@ bool ProfileSyncServiceHarness::EnableSyncForDatatype( + std::string(syncable::ModelTypeToString(datatype)) + ")"); if (wait_state_ == SYNC_DISABLED) { - return SetupSync(syncable::ModelEnumSet(datatype)); + return SetupSync(syncable::ModelTypeSet(datatype)); } if (service() == NULL) { @@ -888,7 +888,7 @@ bool ProfileSyncServiceHarness::EnableSyncForDatatype( return false; } - syncable::ModelEnumSet synced_datatypes = + syncable::ModelTypeSet synced_datatypes = service()->GetPreferredDataTypes(); if (synced_datatypes.Has(datatype)) { DVLOG(1) << "EnableSyncForDatatype(): Sync already enabled for datatype " @@ -921,7 +921,7 @@ bool ProfileSyncServiceHarness::DisableSyncForDatatype( return false; } - syncable::ModelEnumSet synced_datatypes = + syncable::ModelTypeSet synced_datatypes = service()->GetPreferredDataTypes(); if (!synced_datatypes.Has(datatype)) { DVLOG(1) << "DisableSyncForDatatype(): Sync already disabled for datatype " @@ -955,7 +955,7 @@ bool ProfileSyncServiceHarness::EnableSyncForAllDatatypes() { return false; } - service()->OnUserChoseDatatypes(true, syncable::ModelEnumSet::All()); + service()->OnUserChoseDatatypes(true, syncable::ModelTypeSet::All()); if (AwaitFullSyncCompletion("Datatype reconfiguration.")) { DVLOG(1) << "EnableSyncForAllDatatypes(): Enabled sync for all datatypes " << "on " << profile_debug_name_ << "."; @@ -1031,7 +1031,7 @@ std::string ProfileSyncServiceHarness::GetClientInfoString( // encryption for individual types but for all. bool ProfileSyncServiceHarness::EnableEncryptionForType( syncable::ModelType type) { - const syncable::ModelEnumSet encrypted_types = + const syncable::ModelTypeSet encrypted_types = service_->GetEncryptedDataTypes(); if (encrypted_types.Has(type)) return true; @@ -1039,10 +1039,10 @@ bool ProfileSyncServiceHarness::EnableEncryptionForType( // In order to kick off the encryption we have to reconfigure. Just grab the // currently synced types and use them. - const syncable::ModelEnumSet synced_datatypes = + const syncable::ModelTypeSet synced_datatypes = service_->GetPreferredDataTypes(); bool sync_everything = - synced_datatypes.Equals(syncable::ModelEnumSet::All()); + synced_datatypes.Equals(syncable::ModelTypeSet::All()); service_->OnUserChoseDatatypes(sync_everything, synced_datatypes); // Wait some time to let the enryption finish. @@ -1074,13 +1074,13 @@ bool ProfileSyncServiceHarness::WaitForTypeEncryption( } bool ProfileSyncServiceHarness::IsTypeEncrypted(syncable::ModelType type) { - const syncable::ModelEnumSet encrypted_types = + const syncable::ModelTypeSet encrypted_types = service_->GetEncryptedDataTypes(); bool is_type_encrypted = service_->GetEncryptedDataTypes().Has(type); DVLOG(2) << syncable::ModelTypeToString(type) << " is " << (is_type_encrypted ? "" : "not ") << "encrypted; " << "encrypted types = " - << syncable::ModelEnumSetToString(encrypted_types); + << syncable::ModelTypeSetToString(encrypted_types); return is_type_encrypted; } diff --git a/chrome/browser/sync/profile_sync_service_harness.h b/chrome/browser/sync/profile_sync_service_harness.h index 4317e34..609998c 100644 --- a/chrome/browser/sync/profile_sync_service_harness.h +++ b/chrome/browser/sync/profile_sync_service_harness.h @@ -59,7 +59,7 @@ class ProfileSyncServiceHarness // Same as the above method, but enables sync only for the datatypes contained // in |synced_datatypes|. - bool SetupSync(syncable::ModelEnumSet synced_datatypes); + bool SetupSync(syncable::ModelTypeSet synced_datatypes); // ProfileSyncServiceObserver implementation. virtual void OnStateChanged() OVERRIDE; @@ -102,7 +102,7 @@ class ProfileSyncServiceHarness bool AwaitActionableError(); // Blocks until the given set of data types are migrated. - bool AwaitMigration(syncable::ModelEnumSet expected_migrated_types); + bool AwaitMigration(syncable::ModelTypeSet expected_migrated_types); // Blocks the caller until this harness has observed that the sync engine // has downloaded all the changes seen by the |partner| harness's client. @@ -335,11 +335,11 @@ class ProfileSyncServiceHarness // The current set of data types pending migration. Used by // AwaitMigration(). - syncable::ModelEnumSet pending_migration_types_; + syncable::ModelTypeSet pending_migration_types_; // The set of data types that have undergone migration. Used by // AwaitMigration(). - syncable::ModelEnumSet migrated_types_; + syncable::ModelTypeSet migrated_types_; // Used for logging. const std::string profile_debug_name_; diff --git a/chrome/browser/sync/profile_sync_service_mock.h b/chrome/browser/sync/profile_sync_service_mock.h index 49cd7b1..7c1d6c1 100644 --- a/chrome/browser/sync/profile_sync_service_mock.h +++ b/chrome/browser/sync/profile_sync_service_mock.h @@ -57,9 +57,9 @@ class ProfileSyncServiceMock : public ProfileSyncService { MOCK_CONST_METHOD0(HasSyncSetupCompleted, bool()); MOCK_METHOD1(ChangePreferredDataTypes, - void(syncable::ModelEnumSet preferred_types)); - MOCK_CONST_METHOD0(GetPreferredDataTypes, syncable::ModelEnumSet()); - MOCK_CONST_METHOD0(GetRegisteredDataTypes, syncable::ModelEnumSet()); + void(syncable::ModelTypeSet preferred_types)); + MOCK_CONST_METHOD0(GetPreferredDataTypes, syncable::ModelTypeSet()); + MOCK_CONST_METHOD0(GetRegisteredDataTypes, syncable::ModelTypeSet()); MOCK_CONST_METHOD0(GetLastSessionSnapshot, const browser_sync::sessions::SyncSessionSnapshot*()); diff --git a/chrome/browser/sync/profile_sync_service_password_unittest.cc b/chrome/browser/sync/profile_sync_service_password_unittest.cc index 4ee02c4..a2b35c9 100644 --- a/chrome/browser/sync/profile_sync_service_password_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_password_unittest.cc @@ -215,7 +215,7 @@ class ProfileSyncServicePasswordTest : public AbstractProfileSyncServiceTest { service_.reset(new PasswordTestProfileSyncService( &factory_, &profile_, "test_user", false, root_callback, node_callback)); - syncable::ModelEnumSet preferred_types = + syncable::ModelTypeSet preferred_types = service_->GetPreferredDataTypes(); preferred_types.Put(syncable::PASSWORDS); service_->ChangePreferredDataTypes(preferred_types); diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc index b5a773b..07812ce 100644 --- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc @@ -128,7 +128,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) { GaiaConstants::kGaiaOAuth2LoginRefreshToken, "oauth2_login_token"); service_->OnUserChoseDatatypes( - false, syncable::ModelEnumSet(syncable::BOOKMARKS)); + false, syncable::ModelTypeSet(syncable::BOOKMARKS)); EXPECT_TRUE(service_->ShouldPushChanges()); } @@ -277,7 +277,7 @@ TEST_F(ProfileSyncServiceStartupTest, StartFailure) { errors.push_back(error); browser_sync::DataTypeManager::ConfigureResult result( status, - syncable::ModelEnumSet(), + syncable::ModelTypeSet(), errors); EXPECT_CALL(*data_type_manager, Configure(_, _)). WillRepeatedly( diff --git a/chrome/browser/sync/protocol/sync_protocol_error.h b/chrome/browser/sync/protocol/sync_protocol_error.h index 9121ff0..0729989 100644 --- a/chrome/browser/sync/protocol/sync_protocol_error.h +++ b/chrome/browser/sync/protocol/sync_protocol_error.h @@ -68,7 +68,7 @@ struct SyncProtocolError { std::string error_description; std::string url; ClientAction action; - syncable::ModelEnumSet error_data_types; + syncable::ModelTypeSet error_data_types; SyncProtocolError(); ~SyncProtocolError(); DictionaryValue* ToValue() const; diff --git a/chrome/browser/sync/sessions/session_state.cc b/chrome/browser/sync/sessions/session_state.cc index fbb9210..3dabec9 100644 --- a/chrome/browser/sync/sessions/session_state.cc +++ b/chrome/browser/sync/sessions/session_state.cc @@ -114,7 +114,7 @@ SyncSessionSnapshot::SyncSessionSnapshot( const ErrorCounters& errors, int64 num_server_changes_remaining, bool is_share_usable, - syncable::ModelEnumSet initial_sync_ended, + syncable::ModelTypeSet initial_sync_ended, const std::string (&download_progress_markers)[syncable::MODEL_TYPE_COUNT], bool more_to_sync, @@ -159,7 +159,7 @@ DictionaryValue* SyncSessionSnapshot::ToValue() const { static_cast<int>(num_server_changes_remaining)); value->SetBoolean("isShareUsable", is_share_usable); value->Set("initialSyncEnded", - syncable::ModelEnumSetToValue(initial_sync_ended)); + syncable::ModelTypeSetToValue(initial_sync_ended)); value->Set("downloadProgressMarkers", DownloadProgressMarkersToValue(download_progress_markers)); value->SetBoolean("hasMoreToSync", has_more_to_sync); diff --git a/chrome/browser/sync/sessions/session_state.h b/chrome/browser/sync/sessions/session_state.h index 711ef3e6..aa5f6b6 100644 --- a/chrome/browser/sync/sessions/session_state.h +++ b/chrome/browser/sync/sessions/session_state.h @@ -78,7 +78,7 @@ struct SyncerStatus { // If the syncer encountered a MIGRATION_DONE code, these are the types that // the client must now "migrate", by purging and re-downloading all updates. - syncable::ModelEnumSet types_needing_local_migration; + syncable::ModelTypeSet types_needing_local_migration; // Overwrites due to conflict resolution counters. int num_local_overwrites; @@ -121,7 +121,7 @@ struct SyncSessionSnapshot { const ErrorCounters& errors, int64 num_server_changes_remaining, bool is_share_usable, - syncable::ModelEnumSet initial_sync_ended, + syncable::ModelTypeSet initial_sync_ended, const std::string (&download_progress_markers)[syncable::MODEL_TYPE_COUNT], bool more_to_sync, @@ -144,7 +144,7 @@ struct SyncSessionSnapshot { const ErrorCounters errors; const int64 num_server_changes_remaining; const bool is_share_usable; - const syncable::ModelEnumSet initial_sync_ended; + const syncable::ModelTypeSet initial_sync_ended; const std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; const bool has_more_to_sync; const bool is_silenced; @@ -319,7 +319,7 @@ struct AllModelTypeState { ClientToServerResponse commit_response; // We GetUpdates for some combination of types at once. // requested_update_types stores the set of types which were requested. - syncable::ModelEnumSet updates_request_types; + syncable::ModelTypeSet updates_request_types; ClientToServerResponse updates_response; // Used to build the shared commit message. DirtyOnWrite<std::vector<int64> > unsynced_handles; diff --git a/chrome/browser/sync/sessions/session_state_unittest.cc b/chrome/browser/sync/sessions/session_state_unittest.cc index a6a0dd8..f7132da 100644 --- a/chrome/browser/sync/sessions/session_state_unittest.cc +++ b/chrome/browser/sync/sessions/session_state_unittest.cc @@ -126,10 +126,10 @@ TEST_F(SessionStateTest, SyncSessionSnapshotToValue) { const int kNumServerChangesRemaining = 105; const bool kIsShareUsable = true; - const syncable::ModelEnumSet initial_sync_ended( + const syncable::ModelTypeSet initial_sync_ended( syncable::BOOKMARKS, syncable::PREFERENCES); scoped_ptr<ListValue> expected_initial_sync_ended_value( - syncable::ModelEnumSetToValue(initial_sync_ended)); + syncable::ModelTypeSetToValue(initial_sync_ended)); std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; download_progress_markers[syncable::BOOKMARKS] = "test"; diff --git a/chrome/browser/sync/sessions/status_controller.cc b/chrome/browser/sync/sessions/status_controller.cc index a5907f1..49955f3 100644 --- a/chrome/browser/sync/sessions/status_controller.cc +++ b/chrome/browser/sync/sessions/status_controller.cc @@ -112,7 +112,7 @@ void StatusController::increment_num_updates_downloaded_by(int value) { } void StatusController::set_types_needing_local_migration( - syncable::ModelEnumSet types) { + syncable::ModelTypeSet types) { shared_.syncer_status.mutate()->types_needing_local_migration = types; } diff --git a/chrome/browser/sync/sessions/status_controller.h b/chrome/browser/sync/sessions/status_controller.h index c8af420..0140e14 100644 --- a/chrome/browser/sync/sessions/status_controller.h +++ b/chrome/browser/sync/sessions/status_controller.h @@ -83,10 +83,10 @@ class StatusController { ClientToServerResponse* mutable_commit_response() { return &shared_.commit_response; } - const syncable::ModelEnumSet updates_request_types() const { + const syncable::ModelTypeSet updates_request_types() const { return shared_.updates_request_types; } - void set_updates_request_types(syncable::ModelEnumSet value) { + void set_updates_request_types(syncable::ModelTypeSet value) { shared_.updates_request_types = value; } const ClientToServerResponse& updates_response() const { @@ -223,7 +223,7 @@ class StatusController { void increment_num_successful_bookmark_commits(); void increment_num_updates_downloaded_by(int value); void increment_num_tombstone_updates_downloaded_by(int value); - void set_types_needing_local_migration(syncable::ModelEnumSet types); + void set_types_needing_local_migration(syncable::ModelTypeSet types); void set_unsynced_handles(const std::vector<int64>& unsynced_handles); void increment_num_local_overwrites(); void increment_num_server_overwrites(); diff --git a/chrome/browser/sync/sessions/sync_session.cc b/chrome/browser/sync/sessions/sync_session.cc index a7ac5ae..e8c4da1 100644 --- a/chrome/browser/sync/sessions/sync_session.cc +++ b/chrome/browser/sync/sessions/sync_session.cc @@ -136,7 +136,7 @@ SyncSessionSnapshot SyncSession::TakeSnapshot() const { LOG(ERROR) << "Scoped dir lookup failed!"; bool is_share_useable = true; - syncable::ModelEnumSet initial_sync_ended; + syncable::ModelTypeSet initial_sync_ended; std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { diff --git a/chrome/browser/sync/sessions/sync_session_context.cc b/chrome/browser/sync/sessions/sync_session_context.cc index fdc9e7d..922dd89 100644 --- a/chrome/browser/sync/sessions/sync_session_context.cc +++ b/chrome/browser/sync/sessions/sync_session_context.cc @@ -49,9 +49,9 @@ SyncSessionContext::~SyncSessionContext() { } } -void SyncSessionContext::SetUnthrottleTime(syncable::ModelEnumSet types, +void SyncSessionContext::SetUnthrottleTime(syncable::ModelTypeSet types, const base::TimeTicks& time) { - for (syncable::ModelEnumSet::Iterator it = types.First(); + for (syncable::ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) { unthrottle_times_[it.Get()] = time; } @@ -74,8 +74,8 @@ void SyncSessionContext::PruneUnthrottledTypes(const base::TimeTicks& time) { // TODO(lipalani): Call this function and fill the return values in snapshot // so it could be shown in the about:sync page. -syncable::ModelEnumSet SyncSessionContext::GetThrottledTypes() const { - syncable::ModelEnumSet types; +syncable::ModelTypeSet SyncSessionContext::GetThrottledTypes() const { + syncable::ModelTypeSet types; for (UnthrottleTimes::const_iterator it = unthrottle_times_.begin(); it != unthrottle_times_.end(); ++it) { diff --git a/chrome/browser/sync/sessions/sync_session_context.h b/chrome/browser/sync/sessions/sync_session_context.h index a5324bc..fcd0f52 100644 --- a/chrome/browser/sync/sessions/sync_session_context.h +++ b/chrome/browser/sync/sessions/sync_session_context.h @@ -110,7 +110,7 @@ class SyncSessionContext { } // This is virtual for unit tests. - virtual void SetUnthrottleTime(syncable::ModelEnumSet types, + virtual void SetUnthrottleTime(syncable::ModelTypeSet types, const base::TimeTicks& time); // This prunes the |unthrottle_time_| map based on the |time| passed in. This @@ -119,7 +119,7 @@ class SyncSessionContext { // This returns the list of currently throttled types. Unless server returns // new throttled types this will remain constant through out the sync cycle. - syncable::ModelEnumSet GetThrottledTypes() const; + syncable::ModelTypeSet GetThrottledTypes() const; private: typedef std::map<syncable::ModelType, base::TimeTicks> UnthrottleTimes; diff --git a/chrome/browser/sync/sessions/sync_session_context_unittest.cc b/chrome/browser/sync/sessions/sync_session_context_unittest.cc index 4a43752..931937cfd5 100644 --- a/chrome/browser/sync/sessions/sync_session_context_unittest.cc +++ b/chrome/browser/sync/sessions/sync_session_context_unittest.cc @@ -10,7 +10,7 @@ namespace browser_sync { namespace sessions { TEST(SyncSessionContextTest, AddUnthrottleTimeTest) { - const syncable::ModelEnumSet types( + const syncable::ModelTypeSet types( syncable::BOOKMARKS, syncable::PASSWORDS); SyncSessionContext context; @@ -23,7 +23,7 @@ TEST(SyncSessionContextTest, AddUnthrottleTimeTest) { } TEST(SyncSessionContextTest, GetCurrentlyThrottledTypesTest) { - const syncable::ModelEnumSet types( + const syncable::ModelTypeSet types( syncable::BOOKMARKS, syncable::PASSWORDS); SyncSessionContext context; diff --git a/chrome/browser/sync/sessions/sync_session_unittest.cc b/chrome/browser/sync/sessions/sync_session_unittest.cc index d78ab4c..660729a 100644 --- a/chrome/browser/sync/sessions/sync_session_unittest.cc +++ b/chrome/browser/sync/sessions/sync_session_unittest.cc @@ -108,14 +108,14 @@ class SyncSessionTest : public testing::Test, FAIL() << msg; } - syncable::ModelEnumSet ParamsMeaningAllEnabledTypes() { - syncable::ModelEnumSet request_params( + syncable::ModelTypeSet ParamsMeaningAllEnabledTypes() { + syncable::ModelTypeSet request_params( syncable::BOOKMARKS, syncable::AUTOFILL); return request_params; } - syncable::ModelEnumSet ParamsMeaningJustOneEnabledType() { - return syncable::ModelEnumSet(syncable::AUTOFILL); + syncable::ModelTypeSet ParamsMeaningJustOneEnabledType() { + return syncable::ModelTypeSet(syncable::AUTOFILL); } MessageLoop message_loop_; @@ -537,7 +537,7 @@ TEST_F(SyncSessionTest, RebaseRoutingInfoWithLatestWithSameType) { TEST_F(SyncSessionTest, MakeTypePayloadMapFromBitSet) { - syncable::ModelEnumSet types; + syncable::ModelTypeSet types; std::string payload = "test"; syncable::ModelTypePayloadMap types_with_payloads = syncable::ModelTypePayloadMapFromEnumSet(types, payload); diff --git a/chrome/browser/sync/sync_prefs.cc b/chrome/browser/sync/sync_prefs.cc index bbaa8ec..867fa33 100644 --- a/chrome/browser/sync/sync_prefs.cc +++ b/chrome/browser/sync/sync_prefs.cc @@ -123,11 +123,11 @@ void SyncPrefs::SetKeepEverythingSynced(bool keep_everything_synced) { pref_service_->ScheduleSavePersistentPrefs(); } -syncable::ModelEnumSet SyncPrefs::GetPreferredDataTypes( - syncable::ModelEnumSet registered_types) const { +syncable::ModelTypeSet SyncPrefs::GetPreferredDataTypes( + syncable::ModelTypeSet registered_types) const { DCHECK(non_thread_safe_.CalledOnValidThread()); if (!pref_service_) { - return syncable::ModelEnumSet(); + return syncable::ModelTypeSet(); } if (pref_service_->GetBoolean(prefs::kSyncKeepEverythingSynced)) { @@ -136,7 +136,7 @@ syncable::ModelEnumSet SyncPrefs::GetPreferredDataTypes( // Remove autofill_profile since it's controlled by autofill, and // search_engines since it's controlled by preferences (see code below). - syncable::ModelEnumSet user_selectable_types(registered_types); + syncable::ModelTypeSet user_selectable_types(registered_types); DCHECK(!user_selectable_types.Has(syncable::NIGORI)); user_selectable_types.Remove(syncable::AUTOFILL_PROFILE); user_selectable_types.Remove(syncable::SEARCH_ENGINES); @@ -146,9 +146,9 @@ syncable::ModelEnumSet SyncPrefs::GetPreferredDataTypes( // TODO(akalin): Centralize notion of all user selectable data types. user_selectable_types.Remove(syncable::APP_NOTIFICATIONS); - syncable::ModelEnumSet preferred_types; + syncable::ModelTypeSet preferred_types; - for (syncable::ModelEnumSet::Iterator it = user_selectable_types.First(); + for (syncable::ModelTypeSet::Iterator it = user_selectable_types.First(); it.Good(); it.Inc()) { if (GetDataTypePreferred(it.Get())) { preferred_types.Put(it.Get()); @@ -181,12 +181,12 @@ syncable::ModelEnumSet SyncPrefs::GetPreferredDataTypes( } void SyncPrefs::SetPreferredDataTypes( - syncable::ModelEnumSet registered_types, - syncable::ModelEnumSet preferred_types) { + syncable::ModelTypeSet registered_types, + syncable::ModelTypeSet preferred_types) { DCHECK(non_thread_safe_.CalledOnValidThread()); CHECK(pref_service_); DCHECK(registered_types.HasAll(preferred_types)); - syncable::ModelEnumSet preferred_types_with_dependents(preferred_types); + syncable::ModelTypeSet preferred_types_with_dependents(preferred_types); // Set autofill_profile to the same enabled/disabled state as // autofill (since only autofill is shown in the UI). if (registered_types.Has(syncable::AUTOFILL) && @@ -218,7 +218,7 @@ void SyncPrefs::SetPreferredDataTypes( } } - for (syncable::ModelEnumSet::Iterator it = registered_types.First(); + for (syncable::ModelTypeSet::Iterator it = registered_types.First(); it.Good(); it.Inc()) { SetDataTypePreferred( it.Get(), preferred_types_with_dependents.Has(it.Get())); @@ -313,18 +313,18 @@ void SyncPrefs::SetMaxVersion(syncable::ModelType model_type, } void SyncPrefs::AcknowledgeSyncedTypes( - syncable::ModelEnumSet types) { + syncable::ModelTypeSet types) { DCHECK(non_thread_safe_.CalledOnValidThread()); CHECK(pref_service_); // Add the types to the current set of acknowledged // types, and then store the resulting set in prefs. - const syncable::ModelEnumSet acknowledged_types = + const syncable::ModelTypeSet acknowledged_types = Union(types, - syncable::ModelEnumSetFromValue( + syncable::ModelTypeSetFromValue( *pref_service_->GetList(prefs::kSyncAcknowledgedSyncTypes))); scoped_ptr<ListValue> value( - syncable::ModelEnumSetToValue(acknowledged_types)); + syncable::ModelTypeSetToValue(acknowledged_types)); pref_service_->Set(prefs::kSyncAcknowledgedSyncTypes, *value); pref_service_->ScheduleSavePersistentPrefs(); } @@ -357,12 +357,12 @@ void SyncPrefs::SetManagedForTest(bool is_managed) { pref_service_->ScheduleSavePersistentPrefs(); } -syncable::ModelEnumSet SyncPrefs::GetAcknowledgeSyncedTypesForTest() const { +syncable::ModelTypeSet SyncPrefs::GetAcknowledgeSyncedTypesForTest() const { DCHECK(non_thread_safe_.CalledOnValidThread()); if (!pref_service_) { - return syncable::ModelEnumSet(); + return syncable::ModelTypeSet(); } - return syncable::ModelEnumSetFromValue( + return syncable::ModelTypeSetFromValue( *pref_service_->GetList(prefs::kSyncAcknowledgedSyncTypes)); } @@ -460,7 +460,7 @@ void SyncPrefs::RegisterPreferences() { // We will start prompting people about new data types after the launch of // SESSIONS - all previously launched data types are treated as if they are // already acknowledged. - syncable::ModelEnumSet model_set; + syncable::ModelTypeSet model_set; model_set.Put(syncable::BOOKMARKS); model_set.Put(syncable::PREFERENCES); model_set.Put(syncable::PASSWORDS); @@ -474,7 +474,7 @@ void SyncPrefs::RegisterPreferences() { model_set.Put(syncable::TYPED_URLS); model_set.Put(syncable::SESSIONS); pref_service_->RegisterListPref(prefs::kSyncAcknowledgedSyncTypes, - syncable::ModelEnumSetToValue(model_set), + syncable::ModelTypeSetToValue(model_set), PrefService::UNSYNCABLE_PREF); pref_service_->RegisterDictionaryPref(prefs::kSyncMaxInvalidationVersions, diff --git a/chrome/browser/sync/sync_prefs.h b/chrome/browser/sync/sync_prefs.h index 7369da2..bb67b1c 100644 --- a/chrome/browser/sync/sync_prefs.h +++ b/chrome/browser/sync/sync_prefs.h @@ -80,8 +80,8 @@ class SyncPrefs : public base::SupportsWeakPtr<SyncPrefs>, // The returned set is guaranteed to be a subset of // |registered_types|. Returns |registered_types| directly if // HasKeepEverythingSynced() is true. - syncable::ModelEnumSet GetPreferredDataTypes( - syncable::ModelEnumSet registered_types) const; + syncable::ModelTypeSet GetPreferredDataTypes( + syncable::ModelTypeSet registered_types) const; // |preferred_types| should be a subset of |registered_types|. All // types in |preferred_types| are marked preferred, and all types in // |registered_types| \ |preferred_types| are marked not preferred. @@ -89,8 +89,8 @@ class SyncPrefs : public base::SupportsWeakPtr<SyncPrefs>, // HasKeepEverythingSynced() is true, but won't be visible until // SetKeepEverythingSynced(false) is called. void SetPreferredDataTypes( - syncable::ModelEnumSet registered_types, - syncable::ModelEnumSet preferred_types); + syncable::ModelTypeSet registered_types, + syncable::ModelTypeSet preferred_types); // This pref is set outside of sync. bool IsManaged() const; @@ -105,7 +105,7 @@ class SyncPrefs : public base::SupportsWeakPtr<SyncPrefs>, int64 max_version) OVERRIDE; // Merges the given set of types with the set of acknowledged types. - void AcknowledgeSyncedTypes(syncable::ModelEnumSet types); + void AcknowledgeSyncedTypes(syncable::ModelTypeSet types); // content::NotificationObserver implementation. virtual void Observe(int type, @@ -115,7 +115,7 @@ class SyncPrefs : public base::SupportsWeakPtr<SyncPrefs>, // For testing. void SetManagedForTest(bool is_managed); - syncable::ModelEnumSet GetAcknowledgeSyncedTypesForTest() const; + syncable::ModelTypeSet GetAcknowledgeSyncedTypesForTest() const; private: void RegisterPreferences(); diff --git a/chrome/browser/sync/sync_prefs_unittest.cc b/chrome/browser/sync/sync_prefs_unittest.cc index 21ceffa..0064137 100644 --- a/chrome/browser/sync/sync_prefs_unittest.cc +++ b/chrome/browser/sync/sync_prefs_unittest.cc @@ -27,15 +27,15 @@ class SyncPrefsTest : public testing::Test { }; // Get all types with a user-facing component. -syncable::ModelEnumSet GetNonPassiveTypes() { - syncable::ModelEnumSet non_passive_types = syncable::ModelEnumSet::All(); +syncable::ModelTypeSet GetNonPassiveTypes() { + syncable::ModelTypeSet non_passive_types = syncable::ModelTypeSet::All(); non_passive_types.Remove(syncable::NIGORI); return non_passive_types; } // Returns all types visible from the setup UI. -syncable::ModelEnumSet GetUserVisibleTypes() { - syncable::ModelEnumSet user_visible_types(GetNonPassiveTypes()); +syncable::ModelTypeSet GetUserVisibleTypes() { + syncable::ModelTypeSet user_visible_types(GetNonPassiveTypes()); user_visible_types.Remove(syncable::AUTOFILL_PROFILE); user_visible_types.Remove(syncable::SEARCH_ENGINES); user_visible_types.Remove(syncable::APP_NOTIFICATIONS); @@ -76,13 +76,13 @@ TEST_F(SyncPrefsTest, PreferredTypesKeepEverythingSynced) { EXPECT_TRUE(sync_prefs.HasKeepEverythingSynced()); - const syncable::ModelEnumSet non_passive_types = GetNonPassiveTypes(); + const syncable::ModelTypeSet non_passive_types = GetNonPassiveTypes(); EXPECT_TRUE(non_passive_types.Equals( sync_prefs.GetPreferredDataTypes(non_passive_types))); - const syncable::ModelEnumSet user_visible_types = GetUserVisibleTypes(); - for (syncable::ModelEnumSet::Iterator it = user_visible_types.First(); + const syncable::ModelTypeSet user_visible_types = GetUserVisibleTypes(); + for (syncable::ModelTypeSet::Iterator it = user_visible_types.First(); it.Good(); it.Inc()) { - syncable::ModelEnumSet preferred_types; + syncable::ModelTypeSet preferred_types; preferred_types.Put(it.Get()); sync_prefs.SetPreferredDataTypes(non_passive_types, preferred_types); EXPECT_TRUE(non_passive_types.Equals( @@ -95,15 +95,15 @@ TEST_F(SyncPrefsTest, PreferredTypesNotKeepEverythingSynced) { sync_prefs.SetKeepEverythingSynced(false); - const syncable::ModelEnumSet non_passive_types = GetNonPassiveTypes(); + const syncable::ModelTypeSet non_passive_types = GetNonPassiveTypes(); EXPECT_TRUE(non_passive_types.Equals( sync_prefs.GetPreferredDataTypes(non_passive_types))); - const syncable::ModelEnumSet user_visible_types = GetUserVisibleTypes(); - for (syncable::ModelEnumSet::Iterator it = user_visible_types.First(); + const syncable::ModelTypeSet user_visible_types = GetUserVisibleTypes(); + for (syncable::ModelTypeSet::Iterator it = user_visible_types.First(); it.Good(); it.Inc()) { - syncable::ModelEnumSet preferred_types; + syncable::ModelTypeSet preferred_types; preferred_types.Put(it.Get()); - syncable::ModelEnumSet expected_preferred_types(preferred_types); + syncable::ModelTypeSet expected_preferred_types(preferred_types); if (it.Get() == syncable::AUTOFILL) { expected_preferred_types.Put(syncable::AUTOFILL_PROFILE); } @@ -170,12 +170,12 @@ TEST_F(SyncPrefsTest, ObservedPrefs) { TEST_F(SyncPrefsTest, AcknowledgeSyncedTypes) { SyncPrefs sync_prefs(&pref_service_); - syncable::ModelEnumSet expected_acknowledge_synced_types = + syncable::ModelTypeSet expected_acknowledge_synced_types = sync_prefs.GetAcknowledgeSyncedTypesForTest(); for (int i = syncable::EXTENSION_SETTINGS; i < syncable::MODEL_TYPE_COUNT; ++i) { const syncable::ModelType type = syncable::ModelTypeFromInt(i); - syncable::ModelEnumSet acknowledge_synced_types(type); + syncable::ModelTypeSet acknowledge_synced_types(type); expected_acknowledge_synced_types.Put(type); sync_prefs.AcknowledgeSyncedTypes(acknowledge_synced_types); EXPECT_TRUE(expected_acknowledge_synced_types.Equals( @@ -220,7 +220,7 @@ TEST_F(SyncPrefsTest, NullPrefService) { EXPECT_FALSE(sync_prefs.IsStartSuppressed()); EXPECT_EQ(base::Time(), sync_prefs.GetLastSyncedTime()); EXPECT_FALSE(sync_prefs.HasKeepEverythingSynced()); - const syncable::ModelEnumSet non_passive_types = GetNonPassiveTypes(); + const syncable::ModelTypeSet non_passive_types = GetNonPassiveTypes(); EXPECT_TRUE(sync_prefs.GetPreferredDataTypes(non_passive_types).Empty()); EXPECT_FALSE(sync_prefs.IsManaged()); EXPECT_TRUE(sync_prefs.GetEncryptionBootstrapToken().empty()); diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc index 2cd8aa2..df27d79 100644 --- a/chrome/browser/sync/sync_setup_flow.cc +++ b/chrome/browser/sync/sync_setup_flow.cc @@ -29,7 +29,7 @@ namespace { // Helper function to disable password sync. void DisablePasswordSync(ProfileSyncService* service) { - syncable::ModelEnumSet types = service->GetPreferredDataTypes(); + syncable::ModelTypeSet types = service->GetPreferredDataTypes(); types.Remove(syncable::PASSWORDS); service->OnUserChoseDatatypes(false, types); } @@ -123,9 +123,9 @@ void SyncSetupFlow::GetArgsForConfigure(ProfileSyncService* service, // Bookmarks, Preferences, and Themes are launched for good, there's no // going back now. Check if the other data types are registered though. - const syncable::ModelEnumSet registered_types = + const syncable::ModelTypeSet registered_types = service->GetRegisteredDataTypes(); - const syncable::ModelEnumSet preferred_types = + const syncable::ModelTypeSet preferred_types = service->GetPreferredDataTypes(); args->SetBoolean("passwordsRegistered", registered_types.Has(syncable::PASSWORDS)); diff --git a/chrome/browser/sync/sync_setup_flow.h b/chrome/browser/sync/sync_setup_flow.h index 712df92..4fb9a93 100644 --- a/chrome/browser/sync/sync_setup_flow.h +++ b/chrome/browser/sync/sync_setup_flow.h @@ -30,7 +30,7 @@ struct SyncConfiguration { bool encrypt_all; bool sync_everything; - syncable::ModelEnumSet data_types; + syncable::ModelTypeSet data_types; // We pass a separate |set_xxxxx_passphrase| flag because sometimes the UI // wants to set an empty gaia/secondary passphrase (for example, when the user // doesn't enter a passphrase, but we still want the ProfileSyncService to diff --git a/chrome/browser/sync/sync_setup_wizard_unittest.cc b/chrome/browser/sync/sync_setup_wizard_unittest.cc index 879f465..f183880 100644 --- a/chrome/browser/sync/sync_setup_wizard_unittest.cc +++ b/chrome/browser/sync/sync_setup_wizard_unittest.cc @@ -81,7 +81,7 @@ class ProfileSyncServiceForWizardTest : public ProfileSyncService { } virtual void OnUserChoseDatatypes(bool sync_everything, - syncable::ModelEnumSet chosen_types) { + syncable::ModelTypeSet chosen_types) { user_chose_data_types_ = true; chosen_data_types_ = chosen_types; } @@ -169,7 +169,7 @@ class ProfileSyncServiceForWizardTest : public ProfileSyncService { bool keep_everything_synced_; bool is_using_secondary_passphrase_; bool encrypt_everything_; - syncable::ModelEnumSet chosen_data_types_; + syncable::ModelTypeSet chosen_data_types_; std::string passphrase_; private: diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc index 6e4ae48..7cc2091 100644 --- a/chrome/browser/sync/sync_ui_util.cc +++ b/chrome/browser/sync/sync_ui_util.cc @@ -613,7 +613,7 @@ void ConstructAboutInformation(ProfileSyncService* service, full_status.crypto_has_pending_keys); sync_ui_util::AddStringSyncDetails(details, "Encrypted Types", - syncable::ModelEnumSetToString(full_status.encrypted_types)); + syncable::ModelTypeSetToString(full_status.encrypted_types)); const browser_sync::sessions::SyncSessionSnapshot* snapshot = service->sync_initialized() ? diff --git a/chrome/browser/sync/syncable/directory_change_delegate.h b/chrome/browser/sync/syncable/directory_change_delegate.h index 3ccae2c..c6552cd 100644 --- a/chrome/browser/sync/syncable/directory_change_delegate.h +++ b/chrome/browser/sync/syncable/directory_change_delegate.h @@ -31,11 +31,11 @@ class DirectoryChangeDelegate { BaseTransaction* trans) = 0; // Must return the set of all ModelTypes that were modified in the // transaction. - virtual ModelEnumSet HandleTransactionEndingChangeEvent( + virtual ModelTypeSet HandleTransactionEndingChangeEvent( const ImmutableWriteTransactionInfo& write_transaction_info, BaseTransaction* trans) = 0; virtual void HandleTransactionCompleteChangeEvent( - ModelEnumSet models_with_changes) = 0; + ModelTypeSet models_with_changes) = 0; protected: virtual ~DirectoryChangeDelegate() {} }; diff --git a/chrome/browser/sync/syncable/model_type.cc b/chrome/browser/sync/syncable/model_type.cc index 4bbadbf..6620275 100644 --- a/chrome/browser/sync/syncable/model_type.cc +++ b/chrome/browser/sync/syncable/model_type.cc @@ -339,9 +339,9 @@ ModelType ModelTypeFromString(const std::string& model_type_string) { return UNSPECIFIED; } -std::string ModelEnumSetToString(ModelEnumSet model_types) { +std::string ModelTypeSetToString(ModelTypeSet model_types) { std::string result; - for (ModelEnumSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { + for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { if (!result.empty()) { result += ", "; } @@ -350,17 +350,17 @@ std::string ModelEnumSetToString(ModelEnumSet model_types) { return result; } -base::ListValue* ModelEnumSetToValue(ModelEnumSet model_types) { +base::ListValue* ModelTypeSetToValue(ModelTypeSet model_types) { ListValue* value = new ListValue(); - for (ModelEnumSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { + for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { value->Append( Value::CreateStringValue(ModelTypeToString(it.Get()))); } return value; } -ModelEnumSet ModelEnumSetFromValue(const base::ListValue& value) { - ModelEnumSet result; +ModelTypeSet ModelTypeSetFromValue(const base::ListValue& value) { + ModelTypeSet result; for (ListValue::const_iterator i = value.begin(); i != value.end(); ++i) { result.Put(ModelTypeFromValue(**i)); } diff --git a/chrome/browser/sync/syncable/model_type.h b/chrome/browser/sync/syncable/model_type.h index a532e02..0573ac8 100644 --- a/chrome/browser/sync/syncable/model_type.h +++ b/chrome/browser/sync/syncable/model_type.h @@ -86,9 +86,9 @@ enum ModelType { }; typedef browser_sync::EnumSet< - ModelType, FIRST_REAL_MODEL_TYPE, LAST_REAL_MODEL_TYPE> ModelEnumSet; + ModelType, FIRST_REAL_MODEL_TYPE, LAST_REAL_MODEL_TYPE> ModelTypeSet; typedef browser_sync::EnumSet< - ModelType, UNSPECIFIED, LAST_REAL_MODEL_TYPE> FullModelEnumSet; + ModelType, UNSPECIFIED, LAST_REAL_MODEL_TYPE> FullModelTypeSet; inline ModelType ModelTypeFromInt(int i) { DCHECK_GE(i, 0); @@ -139,12 +139,12 @@ ModelType ModelTypeFromValue(const base::Value& value); // Returns the ModelType corresponding to the name |model_type_string|. ModelType ModelTypeFromString(const std::string& model_type_string); -std::string ModelEnumSetToString(ModelEnumSet model_types); +std::string ModelTypeSetToString(ModelTypeSet model_types); // Caller takes ownership of returned list. -base::ListValue* ModelEnumSetToValue(ModelEnumSet model_types); +base::ListValue* ModelTypeSetToValue(ModelTypeSet model_types); -ModelEnumSet ModelEnumSetFromValue(const base::ListValue& value); +ModelTypeSet ModelTypeSetFromValue(const base::ListValue& value); // Returns a string corresponding to the syncable tag for this datatype. std::string ModelTypeToRootTag(ModelType type); diff --git a/chrome/browser/sync/syncable/model_type_payload_map.cc b/chrome/browser/sync/syncable/model_type_payload_map.cc index 737dd21..7c73ba9 100644 --- a/chrome/browser/sync/syncable/model_type_payload_map.cc +++ b/chrome/browser/sync/syncable/model_type_payload_map.cc @@ -14,19 +14,19 @@ using browser_sync::ModelSafeRoutingInfo; namespace syncable { ModelTypePayloadMap ModelTypePayloadMapFromEnumSet( - syncable::ModelEnumSet types, + syncable::ModelTypeSet types, const std::string& payload) { ModelTypePayloadMap types_with_payloads; - for (syncable::ModelEnumSet::Iterator it = types.First(); + for (syncable::ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) { types_with_payloads[it.Get()] = payload; } return types_with_payloads; } -ModelEnumSet ModelTypePayloadMapToEnumSet( +ModelTypeSet ModelTypePayloadMapToEnumSet( const ModelTypePayloadMap& payload_map) { - ModelEnumSet types; + ModelTypeSet types; for (ModelTypePayloadMap::const_iterator it = payload_map.begin(); it != payload_map.end(); ++it) { types.Put(it->first); diff --git a/chrome/browser/sync/syncable/model_type_payload_map.h b/chrome/browser/sync/syncable/model_type_payload_map.h index cdf9ca7..c390d20a 100644 --- a/chrome/browser/sync/syncable/model_type_payload_map.h +++ b/chrome/browser/sync/syncable/model_type_payload_map.h @@ -26,12 +26,12 @@ typedef std::map<ModelType, std::string> ModelTypePayloadMap; // Helper functions for building ModelTypePayloadMaps. -// Make a TypePayloadMap from all the types in a ModelEnumSet using a +// Make a TypePayloadMap from all the types in a ModelTypeSet using a // default payload. ModelTypePayloadMap ModelTypePayloadMapFromEnumSet( - ModelEnumSet model_types, const std::string& payload); + ModelTypeSet model_types, const std::string& payload); -ModelEnumSet ModelTypePayloadMapToEnumSet( +ModelTypeSet ModelTypePayloadMapToEnumSet( const ModelTypePayloadMap& payload_map); // Make a TypePayloadMap for all the enabled types in a diff --git a/chrome/browser/sync/syncable/model_type_payload_map_unittest.cc b/chrome/browser/sync/syncable/model_type_payload_map_unittest.cc index 189bf03..ddddc67 100644 --- a/chrome/browser/sync/syncable/model_type_payload_map_unittest.cc +++ b/chrome/browser/sync/syncable/model_type_payload_map_unittest.cc @@ -23,7 +23,7 @@ TEST_F(ModelTypePayloadMapTest, TypePayloadMapToSet) { payloads[BOOKMARKS] = "bookmarkpayload"; payloads[APPS] = ""; - const ModelEnumSet types(BOOKMARKS, APPS); + const ModelTypeSet types(BOOKMARKS, APPS); EXPECT_TRUE(ModelTypePayloadMapToEnumSet(payloads).Equals(types)); } diff --git a/chrome/browser/sync/syncable/model_type_test_util.cc b/chrome/browser/sync/syncable/model_type_test_util.cc index f3cdfe8..49d0b73 100644 --- a/chrome/browser/sync/syncable/model_type_test_util.cc +++ b/chrome/browser/sync/syncable/model_type_test_util.cc @@ -6,46 +6,46 @@ namespace syncable { -void PrintTo(ModelEnumSet model_types, ::std::ostream* os) { - *os << ModelEnumSetToString(model_types); +void PrintTo(ModelTypeSet model_types, ::std::ostream* os) { + *os << ModelTypeSetToString(model_types); } namespace { // Matcher implementation for HasModelTypes(). class HasModelTypesMatcher - : public ::testing::MatcherInterface<ModelEnumSet> { + : public ::testing::MatcherInterface<ModelTypeSet> { public: - explicit HasModelTypesMatcher(ModelEnumSet expected_types) + explicit HasModelTypesMatcher(ModelTypeSet expected_types) : expected_types_(expected_types) {} virtual ~HasModelTypesMatcher() {} virtual bool MatchAndExplain( - ModelEnumSet model_types, + ModelTypeSet model_types, ::testing::MatchResultListener* listener) const { // No need to annotate listener since we already define PrintTo(). return model_types.Equals(expected_types_); } virtual void DescribeTo(::std::ostream* os) const { - *os << "has model types " << ModelEnumSetToString(expected_types_); + *os << "has model types " << ModelTypeSetToString(expected_types_); } virtual void DescribeNegationTo(::std::ostream* os) const { *os << "doesn't have model types " - << ModelEnumSetToString(expected_types_); + << ModelTypeSetToString(expected_types_); } private: - const ModelEnumSet expected_types_; + const ModelTypeSet expected_types_; DISALLOW_COPY_AND_ASSIGN(HasModelTypesMatcher); }; } // namespace -::testing::Matcher<ModelEnumSet> HasModelTypes(ModelEnumSet expected_types) { +::testing::Matcher<ModelTypeSet> HasModelTypes(ModelTypeSet expected_types) { return ::testing::MakeMatcher(new HasModelTypesMatcher(expected_types)); } diff --git a/chrome/browser/sync/syncable/model_type_test_util.h b/chrome/browser/sync/syncable/model_type_test_util.h index bd9eb53..a3b707e 100644 --- a/chrome/browser/sync/syncable/model_type_test_util.h +++ b/chrome/browser/sync/syncable/model_type_test_util.h @@ -13,13 +13,13 @@ namespace syncable { -// Defined for googletest. Forwards to ModelEnumSetToString(). -void PrintTo(ModelEnumSet model_types, ::std::ostream* os); +// Defined for googletest. Forwards to ModelTypeSetToString(). +void PrintTo(ModelTypeSet model_types, ::std::ostream* os); -// A gmock matcher for ModelEnumSet. Use like: +// A gmock matcher for ModelTypeSet. Use like: // // EXPECT_CALL(mock, ProcessModelTypes(HasModelTypes(expected_types))); -::testing::Matcher<ModelEnumSet> HasModelTypes(ModelEnumSet expected_types); +::testing::Matcher<ModelTypeSet> HasModelTypes(ModelTypeSet expected_types); } // namespace syncable diff --git a/chrome/browser/sync/syncable/model_type_unittest.cc b/chrome/browser/sync/syncable/model_type_unittest.cc index c5b9196..2ade768 100644 --- a/chrome/browser/sync/syncable/model_type_unittest.cc +++ b/chrome/browser/sync/syncable/model_type_unittest.cc @@ -38,10 +38,10 @@ TEST_F(ModelTypeTest, ModelTypeFromValue) { } } -TEST_F(ModelTypeTest, ModelEnumSetToValue) { - const ModelEnumSet model_types(syncable::BOOKMARKS, syncable::APPS); +TEST_F(ModelTypeTest, ModelTypeSetToValue) { + const ModelTypeSet model_types(syncable::BOOKMARKS, syncable::APPS); - scoped_ptr<ListValue> value(ModelEnumSetToValue(model_types)); + scoped_ptr<ListValue> value(ModelTypeSetToValue(model_types)); EXPECT_EQ(2u, value->GetSize()); std::string types[2]; EXPECT_TRUE(value->GetString(0, &types[0])); @@ -50,17 +50,17 @@ TEST_F(ModelTypeTest, ModelEnumSetToValue) { EXPECT_EQ("Apps", types[1]); } -TEST_F(ModelTypeTest, ModelEnumSetFromValue) { +TEST_F(ModelTypeTest, ModelTypeSetFromValue) { // Try empty set first. - ModelEnumSet model_types; - scoped_ptr<ListValue> value(ModelEnumSetToValue(model_types)); - EXPECT_TRUE(model_types.Equals(ModelEnumSetFromValue(*value))); + ModelTypeSet model_types; + scoped_ptr<ListValue> value(ModelTypeSetToValue(model_types)); + EXPECT_TRUE(model_types.Equals(ModelTypeSetFromValue(*value))); // Now try with a few random types. model_types.Put(BOOKMARKS); model_types.Put(APPS); - value.reset(ModelEnumSetToValue(model_types)); - EXPECT_TRUE(model_types.Equals(ModelEnumSetFromValue(*value))); + value.reset(ModelTypeSetToValue(model_types)); + EXPECT_TRUE(model_types.Equals(ModelTypeSetFromValue(*value))); } TEST_F(ModelTypeTest, IsRealDataType) { diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc index f6889f5..bf6eb8e 100644 --- a/chrome/browser/sync/syncable/syncable.cc +++ b/chrome/browser/sync/syncable/syncable.cc @@ -819,7 +819,7 @@ void Directory::VacuumAfterSaveChanges(const SaveChangesSnapshot& snapshot) { } } -void Directory::PurgeEntriesWithTypeIn(ModelEnumSet types) { +void Directory::PurgeEntriesWithTypeIn(ModelTypeSet types) { if (types.Empty()) return; @@ -863,7 +863,7 @@ void Directory::PurgeEntriesWithTypeIn(ModelEnumSet types) { } // Ensure meta tracking for these data types reflects the deleted state. - for (syncable::ModelEnumSet::Iterator it = types.First(); + for (syncable::ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) { set_initial_sync_ended_for_type_unsafe(it.Get(), false); kernel_->persisted_info.reset_download_progress(it.Get()); @@ -1025,9 +1025,9 @@ int64 Directory::unsynced_entity_count() const { return kernel_->unsynced_metahandles->size(); } -FullModelEnumSet Directory::GetServerTypesWithUnappliedUpdates( +FullModelTypeSet Directory::GetServerTypesWithUnappliedUpdates( BaseTransaction* trans) const { - syncable::FullModelEnumSet server_types; + syncable::FullModelTypeSet server_types; ScopedKernelLock lock(this); for (int i = UNSPECIFIED; i < MODEL_TYPE_COUNT; ++i) { const ModelType type = ModelTypeFromInt(i); @@ -1040,7 +1040,7 @@ FullModelEnumSet Directory::GetServerTypesWithUnappliedUpdates( void Directory::GetUnappliedUpdateMetaHandles( BaseTransaction* trans, - FullModelEnumSet server_types, + FullModelTypeSet server_types, UnappliedUpdateMetaHandles* result) { result->clear(); ScopedKernelLock lock(this); @@ -1308,7 +1308,7 @@ ImmutableEntryKernelMutationMap WriteTransaction::RecordMutations() { void WriteTransaction::UnlockAndNotify( const ImmutableEntryKernelMutationMap& mutations) { // Work while transaction mutex is held. - ModelEnumSet models_with_changes; + ModelTypeSet models_with_changes; bool has_mutations = !mutations.Get().empty(); if (has_mutations) { models_with_changes = NotifyTransactionChangingAndEnding(mutations); @@ -1321,7 +1321,7 @@ void WriteTransaction::UnlockAndNotify( } } -ModelEnumSet WriteTransaction::NotifyTransactionChangingAndEnding( +ModelTypeSet WriteTransaction::NotifyTransactionChangingAndEnding( const ImmutableEntryKernelMutationMap& mutations) { dirkernel_->transaction_mutex.AssertAcquired(); DCHECK(!mutations.Get().empty()); @@ -1341,7 +1341,7 @@ ModelEnumSet WriteTransaction::NotifyTransactionChangingAndEnding( immutable_write_transaction_info, this); } - ModelEnumSet models_with_changes = + ModelTypeSet models_with_changes = delegate->HandleTransactionEndingChangeEvent( immutable_write_transaction_info, this); @@ -1353,7 +1353,7 @@ ModelEnumSet WriteTransaction::NotifyTransactionChangingAndEnding( } void WriteTransaction::NotifyTransactionComplete( - ModelEnumSet models_with_changes) { + ModelTypeSet models_with_changes) { dirkernel_->delegate->HandleTransactionCompleteChangeEvent( models_with_changes); } diff --git a/chrome/browser/sync/syncable/syncable.h b/chrome/browser/sync/syncable/syncable.h index 0f9fc84..3ab7e3f 100644 --- a/chrome/browser/sync/syncable/syncable.h +++ b/chrome/browser/sync/syncable/syncable.h @@ -773,7 +773,7 @@ class Directory { // Last sync timestamp fetched from the server. sync_pb::DataTypeProgressMarker download_progress[MODEL_TYPE_COUNT]; // true iff we ever reached the end of the changelog. - ModelEnumSet initial_sync_ended; + ModelTypeSet initial_sync_ended; // The store birthday we were given by the server. Contents are opaque to // the client. std::string store_birthday; @@ -971,14 +971,14 @@ class Directory { // Returns all server types with unapplied updates. A subset of // those types can then be passed into // GetUnappliedUpdateMetaHandles() below. - FullModelEnumSet GetServerTypesWithUnappliedUpdates( + FullModelTypeSet GetServerTypesWithUnappliedUpdates( BaseTransaction* trans) const; // Get all the metahandles for unapplied updates for a given set of // server types. typedef std::vector<int64> UnappliedUpdateMetaHandles; void GetUnappliedUpdateMetaHandles(BaseTransaction* trans, - FullModelEnumSet server_types, + FullModelTypeSet server_types, UnappliedUpdateMetaHandles* result); // Checks tree metadata consistency. @@ -1004,7 +1004,7 @@ class Directory { // entries, which means something different in the syncable namespace. // WARNING! This can be real slow, as it iterates over all entries. // WARNING! Performs synchronous I/O. - virtual void PurgeEntriesWithTypeIn(ModelEnumSet types); + virtual void PurgeEntriesWithTypeIn(ModelTypeSet types); private: // Helper to prime ids_index, parent_id_and_names_index, unsynced_metahandles @@ -1259,7 +1259,7 @@ class WriteTransaction : public BaseTransaction { protected: // Overridden by tests. - virtual void NotifyTransactionComplete(ModelEnumSet models_with_changes); + virtual void NotifyTransactionComplete(ModelTypeSet models_with_changes); private: // Clears |mutations_|. @@ -1267,7 +1267,7 @@ class WriteTransaction : public BaseTransaction { void UnlockAndNotify(const ImmutableEntryKernelMutationMap& mutations); - ModelEnumSet NotifyTransactionChangingAndEnding( + ModelTypeSet NotifyTransactionChangingAndEnding( const ImmutableEntryKernelMutationMap& mutations); // Only the original fields are filled in until |RecordMutations()|. diff --git a/chrome/browser/sync/syncable/syncable_unittest.cc b/chrome/browser/sync/syncable/syncable_unittest.cc index 6348c7f..453d819 100644 --- a/chrome/browser/sync/syncable/syncable_unittest.cc +++ b/chrome/browser/sync/syncable/syncable_unittest.cc @@ -446,7 +446,7 @@ class SyncableDirectoryTest : public testing::Test { return 1 == dir_->kernel_->metahandles_to_purge->count(metahandle); } - void CheckPurgeEntriesWithTypeInSucceeded(ModelEnumSet types_to_purge, + void CheckPurgeEntriesWithTypeInSucceeded(ModelTypeSet types_to_purge, bool before_reload) { SCOPED_TRACE(testing::Message("Before reload: ") << before_reload); { @@ -472,7 +472,7 @@ class SyncableDirectoryTest : public testing::Test { } } - for (ModelEnumSet::Iterator it = types_to_purge.First(); + for (ModelTypeSet::Iterator it = types_to_purge.First(); it.Good(); it.Inc()) { EXPECT_FALSE(dir_->initial_sync_ended_for_type(it.Get())); } @@ -533,7 +533,7 @@ TEST_F(SyncableDirectoryTest, TakeSnapshotGetsMetahandlesToPurge) { } } - syncable::ModelEnumSet to_purge(BOOKMARKS); + syncable::ModelTypeSet to_purge(BOOKMARKS); dir_->PurgeEntriesWithTypeIn(to_purge); Directory::SaveChangesSnapshot snapshot1; @@ -623,7 +623,7 @@ TEST_F(SyncableDirectoryTest, TestPurgeEntriesWithTypeIn) { dir_->set_initial_sync_ended_for_type(PREFERENCES, true); dir_->set_initial_sync_ended_for_type(AUTOFILL, true); - syncable::ModelEnumSet types_to_purge(PREFERENCES, AUTOFILL); + syncable::ModelTypeSet types_to_purge(PREFERENCES, AUTOFILL); TestIdFactory id_factory; // Create some items for each type. @@ -885,8 +885,8 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { Directory::UnappliedUpdateMetaHandles handles; int64 handle1, handle2; - const syncable::FullModelEnumSet all_types = - syncable::FullModelEnumSet::All(); + const syncable::FullModelTypeSet all_types = + syncable::FullModelTypeSet::All(); { WriteTransaction trans(FROM_HERE, UNITTEST, dir_.get()); @@ -1379,7 +1379,7 @@ TEST_F(SyncableDirectoryTest, TestSaveChangesFailureWithPurge) { &delegate_, NullTransactionObserver())); ASSERT_TRUE(dir_->good()); - syncable::ModelEnumSet set(BOOKMARKS); + syncable::ModelTypeSet set(BOOKMARKS); dir_->PurgeEntriesWithTypeIn(set); EXPECT_TRUE(IsInMetahandlesToPurge(handle1)); ASSERT_FALSE(dir_->SaveChanges()); diff --git a/chrome/browser/sync/syncable/transaction_observer.h b/chrome/browser/sync/syncable/transaction_observer.h index 591f27b..3d1f6e2 100644 --- a/chrome/browser/sync/syncable/transaction_observer.h +++ b/chrome/browser/sync/syncable/transaction_observer.h @@ -15,7 +15,7 @@ class TransactionObserver { public: virtual void OnTransactionWrite( const ImmutableWriteTransactionInfo& write_transaction_info, - ModelEnumSet models_with_changes) = 0; + ModelTypeSet models_with_changes) = 0; protected: virtual ~TransactionObserver() {} }; diff --git a/chrome/browser/sync/test/engine/mock_connection_manager.h b/chrome/browser/sync/test/engine/mock_connection_manager.h index 786672d..d83dd7d 100644 --- a/chrome/browser/sync/test/engine/mock_connection_manager.h +++ b/chrome/browser/sync/test/engine/mock_connection_manager.h @@ -207,7 +207,7 @@ class MockConnectionManager : public browser_sync::ServerConnectionManager { // Expect that GetUpdates will request exactly the types indicated in // the bitset. void ExpectGetUpdatesRequestTypes( - syncable::ModelEnumSet expected_filter) { + syncable::ModelTypeSet expected_filter) { expected_filter_ = expected_filter; } @@ -344,7 +344,7 @@ class MockConnectionManager : public browser_sync::ServerConnectionManager { // use the older sync_pb::SyncEntity_BookmarkData-style protocol. bool use_legacy_bookmarks_protocol_; - syncable::ModelEnumSet expected_filter_; + syncable::ModelTypeSet expected_filter_; syncable::ModelTypePayloadMap expected_payloads_; diff --git a/chrome/browser/sync/test/engine/test_directory_setter_upper.h b/chrome/browser/sync/test/engine/test_directory_setter_upper.h index 50bc240..f595cf2 100644 --- a/chrome/browser/sync/test/engine/test_directory_setter_upper.h +++ b/chrome/browser/sync/test/engine/test_directory_setter_upper.h @@ -123,7 +123,7 @@ class MockDirectorySetterUpper : public TestDirectorySetterUpper { public: explicit MockDirectory(const std::string& name); virtual ~MockDirectory(); - MOCK_METHOD1(PurgeEntriesWithTypeIn, void(syncable::ModelEnumSet)); + MOCK_METHOD1(PurgeEntriesWithTypeIn, void(syncable::ModelTypeSet)); private: syncable::NullDirectoryChangeDelegate delegate_; diff --git a/chrome/browser/sync/test/integration/enable_disable_test.cc b/chrome/browser/sync/test/integration/enable_disable_test.cc index 7acbfb6..dafcbb6 100644 --- a/chrome/browser/sync/test/integration/enable_disable_test.cc +++ b/chrome/browser/sync/test/integration/enable_disable_test.cc @@ -43,12 +43,12 @@ IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, EnableOneAtATime) { DisableNotifications(); // Setup sync with no enabled types. - ASSERT_TRUE(GetClient(0)->SetupSync(syncable::ModelEnumSet())); + ASSERT_TRUE(GetClient(0)->SetupSync(syncable::ModelTypeSet())); - const syncable::ModelEnumSet registered_types = + const syncable::ModelTypeSet registered_types = GetClient(0)->service()->GetRegisteredDataTypes(); sync_api::UserShare* user_share = GetClient(0)->service()->GetUserShare(); - for (syncable::ModelEnumSet::Iterator it = registered_types.First(); + for (syncable::ModelTypeSet::Iterator it = registered_types.First(); it.Good(); it.Inc()) { ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(it.Get())); @@ -78,18 +78,18 @@ IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, DisableOneAtATime) { // Setup sync with no disabled types. ASSERT_TRUE(GetClient(0)->SetupSync()); - const syncable::ModelEnumSet registered_types = + const syncable::ModelTypeSet registered_types = GetClient(0)->service()->GetRegisteredDataTypes(); sync_api::UserShare* user_share = GetClient(0)->service()->GetUserShare(); // Make sure all top-level nodes exist first. - for (syncable::ModelEnumSet::Iterator it = registered_types.First(); + for (syncable::ModelTypeSet::Iterator it = registered_types.First(); it.Good(); it.Inc()) { ASSERT_TRUE(DoesTopLevelNodeExist(user_share, it.Get())); } - for (syncable::ModelEnumSet::Iterator it = registered_types.First(); + for (syncable::ModelTypeSet::Iterator it = registered_types.First(); it.Good(); it.Inc()) { ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(it.Get())); diff --git a/chrome/browser/sync/test/integration/migration_errors_test.cc b/chrome/browser/sync/test/integration/migration_errors_test.cc index 399787e..04d24e3 100644 --- a/chrome/browser/sync/test/integration/migration_errors_test.cc +++ b/chrome/browser/sync/test/integration/migration_errors_test.cc @@ -27,28 +27,28 @@ namespace { // Utility functions to make a model type set out of a small number of // model types. -syncable::ModelEnumSet MakeSet(syncable::ModelType type) { - return syncable::ModelEnumSet(type); +syncable::ModelTypeSet MakeSet(syncable::ModelType type) { + return syncable::ModelTypeSet(type); } -syncable::ModelEnumSet MakeSet(syncable::ModelType type1, +syncable::ModelTypeSet MakeSet(syncable::ModelType type1, syncable::ModelType type2) { - return syncable::ModelEnumSet(type1, type2); + return syncable::ModelTypeSet(type1, type2); } // An ordered list of model types sets to migrate. Used by // RunMigrationTest(). -typedef std::deque<syncable::ModelEnumSet> MigrationList; +typedef std::deque<syncable::ModelTypeSet> MigrationList; // Utility functions to make a MigrationList out of a small number of // model types / model type sets. -MigrationList MakeList(syncable::ModelEnumSet model_types) { +MigrationList MakeList(syncable::ModelTypeSet model_types) { return MigrationList(1, model_types); } -MigrationList MakeList(syncable::ModelEnumSet model_types1, - syncable::ModelEnumSet model_types2) { +MigrationList MakeList(syncable::ModelTypeSet model_types1, + syncable::ModelTypeSet model_types2) { MigrationList migration_list; migration_list.push_back(model_types1); migration_list.push_back(model_types2); @@ -73,12 +73,12 @@ class MigrationTest : public SyncTest { // well as a poll-based trigger method. enum TriggerMethod { MODIFY_PREF, MODIFY_BOOKMARK, TRIGGER_NOTIFICATION }; - syncable::ModelEnumSet GetPreferredDataTypes() { - const syncable::ModelEnumSet preferred_data_types = + syncable::ModelTypeSet GetPreferredDataTypes() { + const syncable::ModelTypeSet preferred_data_types = GetClient(0)->service()->GetPreferredDataTypes(); // Make sure all clients have the same preferred data types. for (int i = 1; i < num_clients(); ++i) { - const syncable::ModelEnumSet other_preferred_data_types = + const syncable::ModelTypeSet other_preferred_data_types = GetClient(i)->service()->GetPreferredDataTypes(); EXPECT_TRUE(preferred_data_types.Equals(other_preferred_data_types)); } @@ -89,9 +89,9 @@ class MigrationTest : public SyncTest { // set. MigrationList GetPreferredDataTypesList() { MigrationList migration_list; - const syncable::ModelEnumSet preferred_data_types = + const syncable::ModelTypeSet preferred_data_types = GetPreferredDataTypes(); - for (syncable::ModelEnumSet::Iterator it = + for (syncable::ModelTypeSet::Iterator it = preferred_data_types.First(); it.Good(); it.Inc()) { migration_list.push_back(MakeSet(it.Get())); } @@ -99,7 +99,7 @@ class MigrationTest : public SyncTest { } // Trigger a migration for the given types with the given method. - void TriggerMigration(syncable::ModelEnumSet model_types, + void TriggerMigration(syncable::ModelTypeSet model_types, TriggerMethod trigger_method) { switch (trigger_method) { case MODIFY_PREF: @@ -124,7 +124,7 @@ class MigrationTest : public SyncTest { // Block until all clients have completed migration for the given // types. - void AwaitMigration(syncable::ModelEnumSet migrate_types) { + void AwaitMigration(syncable::ModelTypeSet migrate_types) { for (int i = 0; i < num_clients(); ++i) { ASSERT_TRUE(GetClient(i)->AwaitMigration(migrate_types)); } @@ -293,7 +293,7 @@ IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, AllTypesWithNigoriAtOnce) { ASSERT_TRUE(SetupClients()); - syncable::ModelEnumSet all_types = GetPreferredDataTypes(); + syncable::ModelTypeSet all_types = GetPreferredDataTypes(); all_types.Put(syncable::NIGORI); RunSingleClientMigrationTest(MakeList(all_types), MODIFY_PREF); } diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index 9c83bfd..911bcbe 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -567,7 +567,7 @@ void SyncTest::EnableNotifications() { } void SyncTest::TriggerNotification( - syncable::ModelEnumSet changed_types) { + syncable::ModelTypeSet changed_types) { ASSERT_TRUE(ServerSupportsNotificationControl()); const std::string& data = sync_notifier::P2PNotificationData("from_server", @@ -589,11 +589,11 @@ bool SyncTest::ServerSupportsErrorTriggering() const { } void SyncTest::TriggerMigrationDoneError( - syncable::ModelEnumSet model_types) { + syncable::ModelTypeSet model_types) { ASSERT_TRUE(ServerSupportsErrorTriggering()); std::string path = "chromiumsync/migrate"; char joiner = '?'; - for (syncable::ModelEnumSet::Iterator it = model_types.First(); + for (syncable::ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { path.append( base::StringPrintf( diff --git a/chrome/browser/sync/test/integration/sync_test.h b/chrome/browser/sync/test/integration/sync_test.h index 6b46f21..af5ca0b 100644 --- a/chrome/browser/sync/test/integration/sync_test.h +++ b/chrome/browser/sync/test/integration/sync_test.h @@ -154,7 +154,7 @@ class SyncTest : public InProcessBrowserTest { // Trigger a notification to be sent to all clients. This operation // is available only if ServerSupportsNotificationControl() returned // true. - void TriggerNotification(syncable::ModelEnumSet changed_types); + void TriggerNotification(syncable::ModelTypeSet changed_types); // Returns true if the server being used supports injecting errors. bool ServerSupportsErrorTriggering() const; @@ -162,7 +162,7 @@ class SyncTest : public InProcessBrowserTest { // Triggers a migration for one or more datatypes, and waits // for the server to complete it. This operation is available // only if ServerSupportsErrorTriggering() returned true. - void TriggerMigrationDoneError(syncable::ModelEnumSet model_types); + void TriggerMigrationDoneError(syncable::ModelTypeSet model_types); // Triggers the server to set its birthday to a random value thereby // the server would return a birthday error on next sync. diff --git a/chrome/browser/sync/test/null_directory_change_delegate.cc b/chrome/browser/sync/test/null_directory_change_delegate.cc index 2b977ef..15d3cc1 100644 --- a/chrome/browser/sync/test/null_directory_change_delegate.cc +++ b/chrome/browser/sync/test/null_directory_change_delegate.cc @@ -16,14 +16,14 @@ void NullDirectoryChangeDelegate::HandleCalculateChangesChangeEventFromSyncer( const ImmutableWriteTransactionInfo& write_transaction_info, BaseTransaction* trans) {} -ModelEnumSet +ModelTypeSet NullDirectoryChangeDelegate::HandleTransactionEndingChangeEvent( const ImmutableWriteTransactionInfo& write_transaction_info, BaseTransaction* trans) { - return ModelEnumSet(); + return ModelTypeSet(); } void NullDirectoryChangeDelegate::HandleTransactionCompleteChangeEvent( - ModelEnumSet models_with_changes) {} + ModelTypeSet models_with_changes) {} } // namespace syncable diff --git a/chrome/browser/sync/test/null_directory_change_delegate.h b/chrome/browser/sync/test/null_directory_change_delegate.h index 27ff1da..3ced158 100644 --- a/chrome/browser/sync/test/null_directory_change_delegate.h +++ b/chrome/browser/sync/test/null_directory_change_delegate.h @@ -22,11 +22,11 @@ class NullDirectoryChangeDelegate : public DirectoryChangeDelegate { virtual void HandleCalculateChangesChangeEventFromSyncer( const ImmutableWriteTransactionInfo& write_transaction_info, BaseTransaction* trans) OVERRIDE; - virtual ModelEnumSet HandleTransactionEndingChangeEvent( + virtual ModelTypeSet HandleTransactionEndingChangeEvent( const ImmutableWriteTransactionInfo& write_transaction_info, BaseTransaction* trans) OVERRIDE; virtual void HandleTransactionCompleteChangeEvent( - ModelEnumSet models_with_changes) OVERRIDE; + ModelTypeSet models_with_changes) OVERRIDE; }; } // namespace syncable diff --git a/chrome/browser/sync/test_profile_sync_service.cc b/chrome/browser/sync/test_profile_sync_service.cc index bfbbe32..655aa42 100644 --- a/chrome/browser/sync/test_profile_sync_service.cc +++ b/chrome/browser/sync/test_profile_sync_service.cc @@ -62,9 +62,9 @@ SyncBackendHostForProfileSyncTest::~SyncBackendHostForProfileSyncTest() {} void SyncBackendHostForProfileSyncTest:: SimulateSyncCycleCompletedInitialSyncEnded( const tracked_objects::Location& location) { - syncable::ModelEnumSet sync_ended; + syncable::ModelTypeSet sync_ended; if (!fail_initial_download_) - sync_ended = syncable::ModelEnumSet::All(); + sync_ended = syncable::ModelTypeSet::All(); std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; core_->HandleSyncCycleCompletedOnFrontendLoop(new SyncSessionSnapshot( SyncerStatus(), ErrorCounters(), 0, false, @@ -98,7 +98,7 @@ void SyncBackendHostForProfileSyncTest::StartConfiguration( const base::Closure& callback) { SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop(); if (initialization_state_ == DOWNLOADING_NIGORI) { - syncable::ModelEnumSet sync_ended; + syncable::ModelTypeSet sync_ended; if (!fail_initial_download_) sync_ended.Put(syncable::NIGORI); diff --git a/chrome/browser/sync/tools/sync_listen_notifications.cc b/chrome/browser/sync/tools/sync_listen_notifications.cc index 720914c..fa1c099 100644 --- a/chrome/browser/sync/tools/sync_listen_notifications.cc +++ b/chrome/browser/sync/tools/sync_listen_notifications.cc @@ -137,7 +137,7 @@ int main(int argc, char* argv[]) { sync_notifier->SetState(""); sync_notifier->UpdateCredentials(email, token); // Listen for notifications for all known types. - sync_notifier->UpdateEnabledTypes(syncable::ModelEnumSet::All()); + sync_notifier->UpdateEnabledTypes(syncable::ModelTypeSet::All()); ui_loop.Run(); diff --git a/chrome/browser/sync/util/cryptographer.cc b/chrome/browser/sync/util/cryptographer.cc index 0f04a01..a24e9cf 100644 --- a/chrome/browser/sync/util/cryptographer.cc +++ b/chrome/browser/sync/util/cryptographer.cc @@ -273,10 +273,10 @@ Cryptographer::UpdateResult Cryptographer::Update( } // Static -syncable::ModelEnumSet Cryptographer::SensitiveTypes() { +syncable::ModelTypeSet Cryptographer::SensitiveTypes() { // Both of these have their own encryption schemes, but we include them // anyways. - syncable::ModelEnumSet types; + syncable::ModelTypeSet types; types.Put(syncable::PASSWORDS); types.Put(syncable::NIGORI); return types; @@ -289,7 +289,7 @@ void Cryptographer::UpdateEncryptedTypesFromNigori( return; } - syncable::ModelEnumSet encrypted_types(SensitiveTypes()); + syncable::ModelTypeSet encrypted_types(SensitiveTypes()); if (nigori.encrypt_bookmarks()) encrypted_types.Put(syncable::BOOKMARKS); if (nigori.encrypt_preferences()) @@ -358,13 +358,13 @@ void Cryptographer::UpdateNigoriFromEncryptedTypes( void Cryptographer::set_encrypt_everything() { if (encrypt_everything_) { - DCHECK(encrypted_types_.Equals(syncable::ModelEnumSet::All())); + DCHECK(encrypted_types_.Equals(syncable::ModelTypeSet::All())); return; } encrypt_everything_ = true; // Change |encrypted_types_| directly to avoid sending more than one // notification. - encrypted_types_ = syncable::ModelEnumSet::All(); + encrypted_types_ = syncable::ModelTypeSet::All(); EmitEncryptedTypesChangedNotification(); } @@ -372,17 +372,17 @@ bool Cryptographer::encrypt_everything() const { return encrypt_everything_; } -syncable::ModelEnumSet Cryptographer::GetEncryptedTypes() const { +syncable::ModelTypeSet Cryptographer::GetEncryptedTypes() const { return encrypted_types_; } void Cryptographer::MergeEncryptedTypesForTest( - syncable::ModelEnumSet encrypted_types) { + syncable::ModelTypeSet encrypted_types) { MergeEncryptedTypes(encrypted_types); } void Cryptographer::MergeEncryptedTypes( - syncable::ModelEnumSet encrypted_types) { + syncable::ModelTypeSet encrypted_types) { if (encrypted_types_.HasAll(encrypted_types)) { return; } diff --git a/chrome/browser/sync/util/cryptographer.h b/chrome/browser/sync/util/cryptographer.h index b370296..2c66bbe 100644 --- a/chrome/browser/sync/util/cryptographer.h +++ b/chrome/browser/sync/util/cryptographer.h @@ -62,7 +62,7 @@ class Cryptographer { // set of encrypted types is SensitiveTypes() and that the encrypt // everything flag is false. virtual void OnEncryptedTypesChanged( - syncable::ModelEnumSet encrypted_types, + syncable::ModelTypeSet encrypted_types, bool encrypt_everything) = 0; protected: @@ -163,7 +163,7 @@ class Cryptographer { UpdateResult Update(const sync_pb::NigoriSpecifics& nigori); // The set of types that are always encrypted. - static syncable::ModelEnumSet SensitiveTypes(); + static syncable::ModelTypeSet SensitiveTypes(); // Reset our set of encrypted types based on the contents of the nigori // specifics. @@ -180,11 +180,11 @@ class Cryptographer { bool encrypt_everything() const; // Return the set of encrypted types. - syncable::ModelEnumSet GetEncryptedTypes() const; + syncable::ModelTypeSet GetEncryptedTypes() const; // Forwards to MergeEncryptedTypes. void MergeEncryptedTypesForTest( - syncable::ModelEnumSet encrypted_types); + syncable::ModelTypeSet encrypted_types); private: FRIEND_TEST_ALL_PREFIXES(CryptographerTest, PackUnpack); @@ -192,7 +192,7 @@ class Cryptographer { // Merges the given set of encrypted types with the existing set and emits a // notification if necessary. - void MergeEncryptedTypes(syncable::ModelEnumSet encrypted_types); + void MergeEncryptedTypes(syncable::ModelTypeSet encrypted_types); void EmitEncryptedTypesChangedNotification(); @@ -216,7 +216,7 @@ class Cryptographer { scoped_ptr<sync_pb::EncryptedData> pending_keys_; - syncable::ModelEnumSet encrypted_types_; + syncable::ModelTypeSet encrypted_types_; bool encrypt_everything_; DISALLOW_COPY_AND_ASSIGN(Cryptographer); diff --git a/chrome/browser/sync/util/cryptographer_unittest.cc b/chrome/browser/sync/util/cryptographer_unittest.cc index b596c11..e9110d0 100644 --- a/chrome/browser/sync/util/cryptographer_unittest.cc +++ b/chrome/browser/sync/util/cryptographer_unittest.cc @@ -20,14 +20,14 @@ namespace browser_sync { using ::testing::_; using ::testing::Mock; using ::testing::StrictMock; -using syncable::ModelEnumSet; +using syncable::ModelTypeSet; namespace { class MockObserver : public Cryptographer::Observer { public: MOCK_METHOD2(OnEncryptedTypesChanged, - void(syncable::ModelEnumSet, bool)); + void(syncable::ModelTypeSet, bool)); }; } // namespace @@ -208,7 +208,7 @@ TEST(CryptographerTest, NigoriEncryptionTypes) { // Just set the sensitive types (shouldn't trigger any // notifications). - ModelEnumSet encrypted_types(Cryptographer::SensitiveTypes()); + ModelTypeSet encrypted_types(Cryptographer::SensitiveTypes()); cryptographer.MergeEncryptedTypesForTest(encrypted_types); cryptographer.UpdateNigoriFromEncryptedTypes(&nigori); cryptographer2.UpdateEncryptedTypesFromNigori(nigori); @@ -220,15 +220,15 @@ TEST(CryptographerTest, NigoriEncryptionTypes) { EXPECT_CALL(observer, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelEnumSet::All()), + HasModelTypes(syncable::ModelTypeSet::All()), false)); EXPECT_CALL(observer2, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelEnumSet::All()), + HasModelTypes(syncable::ModelTypeSet::All()), false)); // Set all encrypted types - encrypted_types = syncable::ModelEnumSet::All(); + encrypted_types = syncable::ModelTypeSet::All(); cryptographer.MergeEncryptedTypesForTest(encrypted_types); cryptographer.UpdateNigoriFromEncryptedTypes(&nigori); cryptographer2.UpdateEncryptedTypesFromNigori(nigori); @@ -244,7 +244,7 @@ TEST(CryptographerTest, NigoriEncryptionTypes) { } TEST(CryptographerTest, EncryptEverythingExplicit) { - ModelEnumSet real_types = syncable::ModelEnumSet::All(); + ModelTypeSet real_types = syncable::ModelTypeSet::All(); sync_pb::NigoriSpecifics specifics; specifics.set_encrypt_everything(true); @@ -254,11 +254,11 @@ TEST(CryptographerTest, EncryptEverythingExplicit) { EXPECT_CALL(observer, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelEnumSet::All()), true)); + HasModelTypes(syncable::ModelTypeSet::All()), true)); EXPECT_FALSE(cryptographer.encrypt_everything()); - ModelEnumSet encrypted_types = cryptographer.GetEncryptedTypes(); - for (ModelEnumSet::Iterator iter = real_types.First(); + ModelTypeSet encrypted_types = cryptographer.GetEncryptedTypes(); + for (ModelTypeSet::Iterator iter = real_types.First(); iter.Good(); iter.Inc()) { if (iter.Get() == syncable::PASSWORDS || iter.Get() == syncable::NIGORI) EXPECT_TRUE(encrypted_types.Has(iter.Get())); @@ -270,7 +270,7 @@ TEST(CryptographerTest, EncryptEverythingExplicit) { EXPECT_TRUE(cryptographer.encrypt_everything()); encrypted_types = cryptographer.GetEncryptedTypes(); - for (ModelEnumSet::Iterator iter = real_types.First(); + for (ModelTypeSet::Iterator iter = real_types.First(); iter.Good(); iter.Inc()) { EXPECT_TRUE(encrypted_types.Has(iter.Get())); } @@ -282,7 +282,7 @@ TEST(CryptographerTest, EncryptEverythingExplicit) { } TEST(CryptographerTest, EncryptEverythingImplicit) { - ModelEnumSet real_types = syncable::ModelEnumSet::All(); + ModelTypeSet real_types = syncable::ModelTypeSet::All(); sync_pb::NigoriSpecifics specifics; specifics.set_encrypt_bookmarks(true); // Non-passwords = encrypt everything @@ -292,11 +292,11 @@ TEST(CryptographerTest, EncryptEverythingImplicit) { EXPECT_CALL(observer, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelEnumSet::All()), true)); + HasModelTypes(syncable::ModelTypeSet::All()), true)); EXPECT_FALSE(cryptographer.encrypt_everything()); - ModelEnumSet encrypted_types = cryptographer.GetEncryptedTypes(); - for (ModelEnumSet::Iterator iter = real_types.First(); + ModelTypeSet encrypted_types = cryptographer.GetEncryptedTypes(); + for (ModelTypeSet::Iterator iter = real_types.First(); iter.Good(); iter.Inc()) { if (iter.Get() == syncable::PASSWORDS || iter.Get() == syncable::NIGORI) EXPECT_TRUE(encrypted_types.Has(iter.Get())); @@ -308,7 +308,7 @@ TEST(CryptographerTest, EncryptEverythingImplicit) { EXPECT_TRUE(cryptographer.encrypt_everything()); encrypted_types = cryptographer.GetEncryptedTypes(); - for (ModelEnumSet::Iterator iter = real_types.First(); + for (ModelTypeSet::Iterator iter = real_types.First(); iter.Good(); iter.Inc()) { EXPECT_TRUE(encrypted_types.Has(iter.Get())); } @@ -320,7 +320,7 @@ TEST(CryptographerTest, EncryptEverythingImplicit) { } TEST(CryptographerTest, UnknownSensitiveTypes) { - ModelEnumSet real_types = syncable::ModelEnumSet::All(); + ModelTypeSet real_types = syncable::ModelTypeSet::All(); sync_pb::NigoriSpecifics specifics; // Explicitly setting encrypt everything should override logic for implicit // encrypt everything. @@ -331,7 +331,7 @@ TEST(CryptographerTest, UnknownSensitiveTypes) { StrictMock<MockObserver> observer; cryptographer.AddObserver(&observer); - syncable::ModelEnumSet expected_encrypted_types = + syncable::ModelTypeSet expected_encrypted_types = Cryptographer::SensitiveTypes(); expected_encrypted_types.Put(syncable::BOOKMARKS); @@ -340,8 +340,8 @@ TEST(CryptographerTest, UnknownSensitiveTypes) { HasModelTypes(expected_encrypted_types), false)); EXPECT_FALSE(cryptographer.encrypt_everything()); - ModelEnumSet encrypted_types = cryptographer.GetEncryptedTypes(); - for (ModelEnumSet::Iterator iter = real_types.First(); + ModelTypeSet encrypted_types = cryptographer.GetEncryptedTypes(); + for (ModelTypeSet::Iterator iter = real_types.First(); iter.Good(); iter.Inc()) { if (iter.Get() == syncable::PASSWORDS || iter.Get() == syncable::NIGORI) EXPECT_TRUE(encrypted_types.Has(iter.Get())); @@ -353,7 +353,7 @@ TEST(CryptographerTest, UnknownSensitiveTypes) { EXPECT_FALSE(cryptographer.encrypt_everything()); encrypted_types = cryptographer.GetEncryptedTypes(); - for (ModelEnumSet::Iterator iter = real_types.First(); + for (ModelTypeSet::Iterator iter = real_types.First(); iter.Good(); iter.Inc()) { if (iter.Get() == syncable::PASSWORDS || iter.Get() == syncable::NIGORI || diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc index fdb01a6..e9129aa1 100644 --- a/chrome/browser/ui/webui/sync_setup_handler.cc +++ b/chrome/browser/ui/webui/sync_setup_handler.cc @@ -187,7 +187,7 @@ bool HasConfigurationChanged(const SyncConfiguration& config, // Only check the data types that are explicitly listed on the sync // preferences page. - const syncable::ModelEnumSet types = config.data_types; + const syncable::ModelTypeSet types = config.data_types; if (((types.Has(syncable::BOOKMARKS)) != pref_service->GetBoolean(prefs::kSyncBookmarks)) || ((types.Has(syncable::PREFERENCES)) != @@ -572,7 +572,7 @@ void SyncSetupHandler::HandleConfigure(const ListValue* args) { if (!configuration.sync_everything) { // Only log the data types that are explicitly listed on the sync // preferences page. - const syncable::ModelEnumSet types = configuration.data_types; + const syncable::ModelTypeSet types = configuration.data_types; if (types.Has(syncable::BOOKMARKS)) UMA_HISTOGRAM_ENUMERATION( "Sync.CustomSync", BOOKMARKS, SELECTABLE_DATATYPE_COUNT + 1); |