diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-20 17:25:41 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-20 17:25:41 +0000 |
commit | d45f0d9764d93d8f89564a5df7fa505c6a87a6fe (patch) | |
tree | 89ce4ea823cf922e6955dafcfb275459589cef0a | |
parent | 73e5d26041b0a22e16e383e84a8177930c9fd055 (diff) | |
download | chromium_src-d45f0d9764d93d8f89564a5df7fa505c6a87a6fe.zip chromium_src-d45f0d9764d93d8f89564a5df7fa505c6a87a6fe.tar.gz chromium_src-d45f0d9764d93d8f89564a5df7fa505c6a87a6fe.tar.bz2 |
[Sync] Remove unneeded 'using syncer::' lines and 'syncer::' scopings
Since (almost) everything in sync/ is now in the 'syncer' namespace,
all of these are redundant.
Clean up indentation.
Put sync_{client,listen_notifications} into syncer namespace.
BUG=128060
TEST=
Review URL: https://chromiumcodereview.appspot.com/10795018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147675 0039d316-1c4b-4281-b951-d872f2087c98
169 files changed, 1564 insertions, 1714 deletions
diff --git a/sync/api/fake_syncable_service.cc b/sync/api/fake_syncable_service.cc index 078201b..731b24d 100644 --- a/sync/api/fake_syncable_service.cc +++ b/sync/api/fake_syncable_service.cc @@ -11,7 +11,7 @@ namespace syncer { FakeSyncableService::FakeSyncableService() : syncing_(false), - type_(syncer::UNSPECIFIED) {} + type_(UNSPECIFIED) {} FakeSyncableService::~FakeSyncableService() {} @@ -31,7 +31,7 @@ bool FakeSyncableService::syncing() const { // SyncableService implementation. SyncError FakeSyncableService::MergeDataAndStartSyncing( - syncer::ModelType type, + ModelType type, const SyncDataList& initial_sync_data, scoped_ptr<SyncChangeProcessor> sync_processor, scoped_ptr<SyncErrorFactory> sync_error_factory) { @@ -43,13 +43,12 @@ SyncError FakeSyncableService::MergeDataAndStartSyncing( return merge_data_and_start_syncing_error_; } -void FakeSyncableService::StopSyncing(syncer::ModelType type) { +void FakeSyncableService::StopSyncing(ModelType type) { syncing_ = false; sync_processor_.reset(); } -SyncDataList FakeSyncableService::GetAllSyncData( - syncer::ModelType type) const { +SyncDataList FakeSyncableService::GetAllSyncData(ModelType type) const { return SyncDataList(); } diff --git a/sync/api/fake_syncable_service.h b/sync/api/fake_syncable_service.h index 483325a..5a501ae 100644 --- a/sync/api/fake_syncable_service.h +++ b/sync/api/fake_syncable_service.h @@ -28,12 +28,12 @@ class FakeSyncableService : public SyncableService { // SyncableService implementation. virtual SyncError MergeDataAndStartSyncing( - syncer::ModelType type, + ModelType type, const SyncDataList& initial_sync_data, scoped_ptr<SyncChangeProcessor> sync_processor, scoped_ptr<SyncErrorFactory> sync_error_factory) OVERRIDE; - virtual void StopSyncing(syncer::ModelType type) OVERRIDE; - virtual SyncDataList GetAllSyncData(syncer::ModelType type) const OVERRIDE; + virtual void StopSyncing(ModelType type) OVERRIDE; + virtual SyncDataList GetAllSyncData(ModelType type) const OVERRIDE; virtual SyncError ProcessSyncChanges( const tracked_objects::Location& from_here, const SyncChangeList& change_list) OVERRIDE; @@ -43,7 +43,7 @@ class FakeSyncableService : public SyncableService { SyncError merge_data_and_start_syncing_error_; SyncError process_sync_changes_error_; bool syncing_; - syncer::ModelType type_; + ModelType type_; }; } // namespace syncer diff --git a/sync/api/sync_change.cc b/sync/api/sync_change.cc index ee1cdea..a9b9199 100644 --- a/sync/api/sync_change.cc +++ b/sync/api/sync_change.cc @@ -29,11 +29,11 @@ bool SyncChange::IsValid() const { // Data from the syncer must always have valid specifics. if (!sync_data_.IsLocal()) - return syncer::IsRealDataType(sync_data_.GetDataType()); + return IsRealDataType(sync_data_.GetDataType()); // Local changes must always have a tag and specify a valid datatype. if (sync_data_.GetTag().empty() || - !syncer::IsRealDataType(sync_data_.GetDataType())) { + !IsRealDataType(sync_data_.GetDataType())) { return false; } diff --git a/sync/api/sync_change_unittest.cc b/sync/api/sync_change_unittest.cc index f5aab08..b989e41 100644 --- a/sync/api/sync_change_unittest.cc +++ b/sync/api/sync_change_unittest.cc @@ -27,10 +27,10 @@ TEST_F(SyncChangeTest, LocalDelete) { std::string tag = "client_tag"; SyncChange e(FROM_HERE, change_type, - SyncData::CreateLocalDelete(tag, syncer::PREFERENCES)); + SyncData::CreateLocalDelete(tag, PREFERENCES)); EXPECT_EQ(change_type, e.change_type()); EXPECT_EQ(tag, e.sync_data().GetTag()); - EXPECT_EQ(syncer::PREFERENCES, e.sync_data().GetDataType()); + EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); } TEST_F(SyncChangeTest, LocalUpdate) { @@ -46,7 +46,7 @@ TEST_F(SyncChangeTest, LocalUpdate) { EXPECT_EQ(change_type, e.change_type()); EXPECT_EQ(tag, e.sync_data().GetTag()); EXPECT_EQ(title, e.sync_data().GetTitle()); - EXPECT_EQ(syncer::PREFERENCES, e.sync_data().GetDataType()); + EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); scoped_ptr<DictionaryValue> ref_spec(EntitySpecificsToValue(specifics)); scoped_ptr<DictionaryValue> e_spec(EntitySpecificsToValue( e.sync_data().GetSpecifics())); @@ -66,7 +66,7 @@ TEST_F(SyncChangeTest, LocalAdd) { EXPECT_EQ(change_type, e.change_type()); EXPECT_EQ(tag, e.sync_data().GetTag()); EXPECT_EQ(title, e.sync_data().GetTitle()); - EXPECT_EQ(syncer::PREFERENCES, e.sync_data().GetDataType()); + EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); scoped_ptr<DictionaryValue> ref_spec(EntitySpecificsToValue(specifics)); scoped_ptr<DictionaryValue> e_spec(EntitySpecificsToValue( e.sync_data().GetSpecifics())); @@ -109,7 +109,7 @@ TEST_F(SyncChangeTest, SyncerChanges) { // Verify update. SyncChange e = change_list[0]; EXPECT_EQ(SyncChange::ACTION_UPDATE, e.change_type()); - EXPECT_EQ(syncer::PREFERENCES, e.sync_data().GetDataType()); + EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); scoped_ptr<DictionaryValue> ref_spec(EntitySpecificsToValue( update_specifics)); scoped_ptr<DictionaryValue> e_spec(EntitySpecificsToValue( @@ -119,7 +119,7 @@ TEST_F(SyncChangeTest, SyncerChanges) { // Verify add. e = change_list[1]; EXPECT_EQ(SyncChange::ACTION_ADD, e.change_type()); - EXPECT_EQ(syncer::PREFERENCES, e.sync_data().GetDataType()); + EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); ref_spec.reset(EntitySpecificsToValue(add_specifics)); e_spec.reset(EntitySpecificsToValue(e.sync_data().GetSpecifics())); EXPECT_TRUE(ref_spec->Equals(e_spec.get())); @@ -127,7 +127,7 @@ TEST_F(SyncChangeTest, SyncerChanges) { // Verify delete. e = change_list[2]; EXPECT_EQ(SyncChange::ACTION_DELETE, e.change_type()); - EXPECT_EQ(syncer::PREFERENCES, e.sync_data().GetDataType()); + EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); ref_spec.reset(EntitySpecificsToValue(delete_specifics)); e_spec.reset(EntitySpecificsToValue(e.sync_data().GetSpecifics())); EXPECT_TRUE(ref_spec->Equals(e_spec.get())); diff --git a/sync/api/sync_data.cc b/sync/api/sync_data.cc index a2a4191..b9e2ca9 100644 --- a/sync/api/sync_data.cc +++ b/sync/api/sync_data.cc @@ -44,7 +44,7 @@ void SyncData::ImmutableSyncEntityTraits::Swap(sync_pb::SyncEntity* t1, SyncData::SyncData() : is_valid_(false), - id_(syncer::kInvalidId) {} + id_(kInvalidId) {} SyncData::SyncData(int64 id, sync_pb::SyncEntity* entity) : is_valid_(true), @@ -56,9 +56,9 @@ SyncData::~SyncData() {} // Static. SyncData SyncData::CreateLocalDelete( const std::string& sync_tag, - syncer::ModelType datatype) { + ModelType datatype) { sync_pb::EntitySpecifics specifics; - syncer::AddDefaultFieldValue(datatype, &specifics); + AddDefaultFieldValue(datatype, &specifics); return CreateLocalData(sync_tag, "", specifics); } @@ -71,13 +71,13 @@ SyncData SyncData::CreateLocalData( entity.set_client_defined_unique_tag(sync_tag); entity.set_non_unique_name(non_unique_title); entity.mutable_specifics()->CopyFrom(specifics); - return SyncData(syncer::kInvalidId, &entity); + return SyncData(kInvalidId, &entity); } // Static. SyncData SyncData::CreateRemoteData( int64 id, const sync_pb::EntitySpecifics& specifics) { - DCHECK_NE(id, syncer::kInvalidId); + DCHECK_NE(id, kInvalidId); sync_pb::SyncEntity entity; entity.mutable_specifics()->CopyFrom(specifics); return SyncData(id, &entity); @@ -91,8 +91,8 @@ const sync_pb::EntitySpecifics& SyncData::GetSpecifics() const { return immutable_entity_.Get().specifics(); } -syncer::ModelType SyncData::GetDataType() const { - return syncer::GetModelTypeFromSpecifics(GetSpecifics()); +ModelType SyncData::GetDataType() const { + return GetModelTypeFromSpecifics(GetSpecifics()); } const std::string& SyncData::GetTag() const { @@ -112,17 +112,16 @@ int64 SyncData::GetRemoteId() const { } bool SyncData::IsLocal() const { - return id_ == syncer::kInvalidId; + return id_ == kInvalidId; } std::string SyncData::ToString() const { if (!IsValid()) return "<Invalid SyncData>"; - std::string type = syncer::ModelTypeToString(GetDataType()); + std::string type = ModelTypeToString(GetDataType()); std::string specifics; - scoped_ptr<DictionaryValue> value( - syncer::EntitySpecificsToValue(GetSpecifics())); + scoped_ptr<DictionaryValue> value(EntitySpecificsToValue(GetSpecifics())); base::JSONWriter::WriteWithOptions(value.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &specifics); diff --git a/sync/api/sync_data.h b/sync/api/sync_data.h index 3bad3ae..b88e0e7 100644 --- a/sync/api/sync_data.h +++ b/sync/api/sync_data.h @@ -20,8 +20,6 @@ class SyncEntity; namespace syncer { -typedef syncer::ModelType SyncDataType; - // A light-weight container for immutable sync data. Pass-by-value and storage // in STL containers are supported and encouraged if helpful. class SyncData { @@ -43,7 +41,7 @@ class SyncData { // overwritten if the datatype is encrypted. static SyncData CreateLocalDelete( const std::string& sync_tag, - syncer::ModelType datatype); + ModelType datatype); static SyncData CreateLocalData( const std::string& sync_tag, const std::string& non_unique_title, @@ -59,7 +57,7 @@ class SyncData { // Return the datatype we're holding information about. Derived from the sync // datatype specifics. - SyncDataType GetDataType() const; + ModelType GetDataType() const; // Return the current sync datatype specifics. const sync_pb::EntitySpecifics& GetSpecifics() const; @@ -99,8 +97,7 @@ class SyncData { static void Swap(sync_pb::SyncEntity* t1, sync_pb::SyncEntity* t2); }; - typedef syncer::Immutable< - sync_pb::SyncEntity, ImmutableSyncEntityTraits> + typedef Immutable<sync_pb::SyncEntity, ImmutableSyncEntityTraits> ImmutableSyncEntity; // Clears |entity|. @@ -109,7 +106,7 @@ class SyncData { // Whether this SyncData holds valid data. bool is_valid_; - // Equal to syncer::kInvalidId iff this is local. + // Equal to kInvalidId iff this is local. int64 id_; // The actual shared sync entity being held. diff --git a/sync/api/sync_error.cc b/sync/api/sync_error.cc index 307f339..1209040 100644 --- a/sync/api/sync_error.cc +++ b/sync/api/sync_error.cc @@ -18,7 +18,7 @@ SyncError::SyncError() { SyncError::SyncError(const tracked_objects::Location& location, const std::string& message, - syncer::ModelType type) { + ModelType type) { Init(location, message, type); PrintLogError(); } @@ -51,19 +51,19 @@ void SyncError::Copy(const SyncError& other) { void SyncError::Clear() { location_.reset(); message_ = std::string(); - type_ = syncer::UNSPECIFIED; + type_ = UNSPECIFIED; } void SyncError::Reset(const tracked_objects::Location& location, const std::string& message, - syncer::ModelType type) { + ModelType type) { Init(location, message, type); PrintLogError(); } void SyncError::Init(const tracked_objects::Location& location, const std::string& message, - syncer::ModelType type) { + ModelType type) { location_.reset(new tracked_objects::Location(location)); message_ = message; type_ = type; @@ -84,7 +84,7 @@ const std::string& SyncError::message() const { return message_; } -syncer::ModelType SyncError::type() const { +ModelType SyncError::type() const { CHECK(IsSet()); return type_; } @@ -93,7 +93,7 @@ std::string SyncError::ToString() const { if (!IsSet()) { return std::string(); } - return location_->ToString() + ", " + syncer::ModelTypeToString(type_) + + return location_->ToString() + ", " + ModelTypeToString(type_) + ", Sync Error: " + message_; } @@ -102,7 +102,7 @@ void SyncError::PrintLogError() const { location_->line_number(), logging::LOG_ERROR).stream(), LOG_IS_ON(ERROR)) - << syncer::ModelTypeToString(type_) << ", Sync Error: " << message_; + << ModelTypeToString(type_) << ", Sync Error: " << message_; } void PrintTo(const SyncError& sync_error, std::ostream* os) { diff --git a/sync/api/sync_error.h b/sync/api/sync_error.h index 532b90c..c674993 100644 --- a/sync/api/sync_error.h +++ b/sync/api/sync_error.h @@ -32,7 +32,7 @@ class SyncError { // Will print the new error to LOG(ERROR). SyncError(const tracked_objects::Location& location, const std::string& message, - syncer::ModelType type); + ModelType type); // Copy and assign via deep copy. SyncError(const SyncError& other); @@ -45,7 +45,7 @@ class SyncError { // Will print the new error to LOG(ERROR). void Reset(const tracked_objects::Location& location, const std::string& message, - syncer::ModelType type); + ModelType type); // Whether this is a valid error or not. bool IsSet() const; @@ -53,7 +53,7 @@ class SyncError { // These must only be called if IsSet() is true. const tracked_objects::Location& location() const; const std::string& message() const; - syncer::ModelType type() const; + ModelType type() const; // Returns empty string is IsSet() is false. std::string ToString() const; @@ -69,7 +69,7 @@ class SyncError { // is called, IsSet() will return true. void Init(const tracked_objects::Location& location, const std::string& message, - syncer::ModelType type); + ModelType type); // Reset the error to it's default (unset) values. void Clear(); @@ -77,7 +77,7 @@ class SyncError { // scoped_ptr is necessary because Location objects aren't assignable. scoped_ptr<tracked_objects::Location> location_; std::string message_; - syncer::ModelType type_; + ModelType type_; }; // gmock printer helper. diff --git a/sync/api/sync_error_unittest.cc b/sync/api/sync_error_unittest.cc index d14409f..71a24f1 100644 --- a/sync/api/sync_error_unittest.cc +++ b/sync/api/sync_error_unittest.cc @@ -11,11 +11,10 @@ namespace syncer { -using std::string; -using syncer::ModelType; - namespace { +using std::string; + typedef testing::Test SyncErrorTest; TEST_F(SyncErrorTest, Unset) { @@ -26,7 +25,7 @@ TEST_F(SyncErrorTest, Unset) { TEST_F(SyncErrorTest, Default) { tracked_objects::Location location = FROM_HERE; std::string msg = "test"; - ModelType type = syncer::PREFERENCES; + ModelType type = PREFERENCES; SyncError error(location, msg, type); ASSERT_TRUE(error.IsSet()); EXPECT_EQ(location.line_number(), error.location().line_number()); @@ -37,7 +36,7 @@ TEST_F(SyncErrorTest, Default) { TEST_F(SyncErrorTest, Reset) { tracked_objects::Location location = FROM_HERE; std::string msg = "test"; - ModelType type = syncer::PREFERENCES; + ModelType type = PREFERENCES; SyncError error; EXPECT_FALSE(error.IsSet()); @@ -50,7 +49,7 @@ TEST_F(SyncErrorTest, Reset) { tracked_objects::Location location2 = FROM_HERE; std::string msg2 = "test"; - ModelType type2 = syncer::PREFERENCES; + ModelType type2 = PREFERENCES; error.Reset(location2, msg2, type2); ASSERT_TRUE(error.IsSet()); EXPECT_EQ(location2.line_number(), error.location().line_number()); @@ -61,7 +60,7 @@ TEST_F(SyncErrorTest, Reset) { TEST_F(SyncErrorTest, Copy) { tracked_objects::Location location = FROM_HERE; std::string msg = "test"; - ModelType type = syncer::PREFERENCES; + ModelType type = PREFERENCES; SyncError error1; EXPECT_FALSE(error1.IsSet()); @@ -89,7 +88,7 @@ TEST_F(SyncErrorTest, Copy) { TEST_F(SyncErrorTest, Assign) { tracked_objects::Location location = FROM_HERE; std::string msg = "test"; - ModelType type = syncer::PREFERENCES; + ModelType type = PREFERENCES; SyncError error1; EXPECT_FALSE(error1.IsSet()); @@ -116,7 +115,7 @@ TEST_F(SyncErrorTest, Assign) { TEST_F(SyncErrorTest, ToString) { tracked_objects::Location location = FROM_HERE; std::string msg = "test"; - ModelType type = syncer::PREFERENCES; + ModelType type = PREFERENCES; std::string expected = "Preferences, Sync Error: test"; SyncError error(location, msg, type); EXPECT_TRUE(error.IsSet()); diff --git a/sync/api/syncable_service.h b/sync/api/syncable_service.h index 6118a91..5f84d85 100644 --- a/sync/api/syncable_service.h +++ b/sync/api/syncable_service.h @@ -37,18 +37,18 @@ class SyncableService : public SyncChangeProcessor, // encountered, and a filled SyncError (IsSet() == true) // otherwise. virtual SyncError MergeDataAndStartSyncing( - syncer::ModelType type, + ModelType type, const SyncDataList& initial_sync_data, scoped_ptr<SyncChangeProcessor> sync_processor, scoped_ptr<SyncErrorFactory> error_handler) = 0; // Stop syncing the specified type and reset state. - virtual void StopSyncing(syncer::ModelType type) = 0; + virtual void StopSyncing(ModelType type) = 0; // Fills a list of SyncData from the local data. This should create an up // to date representation of the SyncableService's view of that datatype, and // should match/be a subset of the server's view of that datatype. - virtual SyncDataList GetAllSyncData(syncer::ModelType type) const = 0; + virtual SyncDataList GetAllSyncData(ModelType type) const = 0; // SyncChangeProcessor interface. // Process a list of new SyncChanges and update the local data as necessary. diff --git a/sync/engine/all_status.cc b/sync/engine/all_status.cc index 8f8b649..ffa8311 100644 --- a/sync/engine/all_status.cc +++ b/sync/engine/all_status.cc @@ -24,11 +24,11 @@ AllStatus::AllStatus() { AllStatus::~AllStatus() { } -syncer::SyncStatus AllStatus::CreateBlankStatus() const { +SyncStatus AllStatus::CreateBlankStatus() const { // Status is initialized with the previous status value. Variables // whose values accumulate (e.g. lifetime counters like updates_received) // are not to be cleared here. - syncer::SyncStatus status = status_; + SyncStatus status = status_; status.encryption_conflicts = 0; status.hierarchy_conflicts = 0; status.simple_conflicts = 0; @@ -39,9 +39,8 @@ syncer::SyncStatus AllStatus::CreateBlankStatus() const { return status; } -syncer::SyncStatus AllStatus::CalcSyncing( - const SyncEngineEvent &event) const { - syncer::SyncStatus status = CreateBlankStatus(); +SyncStatus AllStatus::CalcSyncing(const SyncEngineEvent &event) const { + SyncStatus status = CreateBlankStatus(); const sessions::SyncSessionSnapshot& snapshot = event.snapshot; status.encryption_conflicts = snapshot.num_encryption_conflicts(); status.hierarchy_conflicts = snapshot.num_hierarchy_conflicts(); @@ -120,7 +119,7 @@ void AllStatus::OnSyncEngineEvent(const SyncEngineEvent& event) { } } -syncer::SyncStatus AllStatus::status() const { +SyncStatus AllStatus::status() const { base::AutoLock lock(mutex_); return status_; } @@ -135,12 +134,12 @@ void AllStatus::IncrementNotificationsReceived() { ++status_.notifications_received; } -void AllStatus::SetEncryptedTypes(syncer::ModelTypeSet types) { +void AllStatus::SetEncryptedTypes(ModelTypeSet types) { ScopedStatusLock lock(this); status_.encrypted_types = types; } -void AllStatus::SetThrottledTypes(const syncer::ModelTypeSet& types) { +void AllStatus::SetThrottledTypes(const ModelTypeSet& types) { ScopedStatusLock lock(this); status_.throttled_types = types; } diff --git a/sync/engine/all_status.h b/sync/engine/all_status.h index 95efb97..89c1769 100644 --- a/sync/engine/all_status.h +++ b/sync/engine/all_status.h @@ -40,7 +40,7 @@ class AllStatus : public SyncEngineEventListener { virtual void OnSyncEngineEvent(const SyncEngineEvent& event) OVERRIDE; - syncer::SyncStatus status() const; + SyncStatus status() const; void SetNotificationsEnabled(bool notifications_enabled); @@ -48,9 +48,9 @@ class AllStatus : public SyncEngineEventListener { void IncrementNotificationsReceived(); - void SetThrottledTypes(const syncer::ModelTypeSet &types); + void SetThrottledTypes(const ModelTypeSet &types); - void SetEncryptedTypes(syncer::ModelTypeSet types); + void SetEncryptedTypes(ModelTypeSet types); void SetCryptographerReady(bool ready); void SetCryptoHasPendingKeys(bool has_pending_keys); @@ -59,10 +59,10 @@ class AllStatus : public SyncEngineEventListener { protected: // Examines syncer to calculate syncing and the unsynced count, // and returns a Status with new values. - syncer::SyncStatus CalcSyncing(const SyncEngineEvent& event) const; - syncer::SyncStatus CreateBlankStatus() const; + SyncStatus CalcSyncing(const SyncEngineEvent& event) const; + SyncStatus CreateBlankStatus() const; - syncer::SyncStatus status_; + SyncStatus status_; mutable base::Lock mutex_; // Protects all data members. DISALLOW_COPY_AND_ASSIGN(AllStatus); diff --git a/sync/engine/apply_updates_command.cc b/sync/engine/apply_updates_command.cc index 28ad032..da8a1cc 100644 --- a/sync/engine/apply_updates_command.cc +++ b/sync/engine/apply_updates_command.cc @@ -22,7 +22,7 @@ std::set<ModelSafeGroup> ApplyUpdatesCommand::GetGroupsToChange( const sessions::SyncSession& session) const { std::set<ModelSafeGroup> groups_with_unapplied_updates; - syncer::FullModelTypeSet server_types_with_unapplied_updates; + FullModelTypeSet server_types_with_unapplied_updates; { syncable::Directory* dir = session.context()->directory(); syncable::ReadTransaction trans(FROM_HERE, dir); @@ -30,7 +30,7 @@ std::set<ModelSafeGroup> ApplyUpdatesCommand::GetGroupsToChange( dir->GetServerTypesWithUnappliedUpdates(&trans); } - for (syncer::FullModelTypeSet::Iterator it = + for (FullModelTypeSet::Iterator it = server_types_with_unapplied_updates.First(); it.Good(); it.Inc()) { groups_with_unapplied_updates.insert( GetGroupForModelType(it.Get(), session.routing_info())); @@ -46,10 +46,10 @@ SyncerError ApplyUpdatesCommand::ModelChangingExecuteImpl( // Compute server types with unapplied updates that fall under our // group restriction. - const syncer::FullModelTypeSet server_types_with_unapplied_updates = + const FullModelTypeSet server_types_with_unapplied_updates = dir->GetServerTypesWithUnappliedUpdates(&trans); - syncer::FullModelTypeSet server_type_restriction; - for (syncer::FullModelTypeSet::Iterator it = + FullModelTypeSet server_type_restriction; + for (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()) { @@ -75,7 +75,7 @@ SyncerError ApplyUpdatesCommand::ModelChangingExecuteImpl( // some subset of the currently synced datatypes. const sessions::StatusController& status(session->status_controller()); if (status.ServerSaysNothingMoreToDownload()) { - for (syncer::ModelTypeSet::Iterator it = + for (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/sync/engine/apply_updates_command_unittest.cc b/sync/engine/apply_updates_command_unittest.cc index 8f76afd..852bfc0 100644 --- a/sync/engine/apply_updates_command_unittest.cc +++ b/sync/engine/apply_updates_command_unittest.cc @@ -39,7 +39,7 @@ using syncable::WriteTransaction; namespace { sync_pb::EntitySpecifics DefaultBookmarkSpecifics() { sync_pb::EntitySpecifics result; - AddDefaultFieldValue(syncer::BOOKMARKS, &result); + AddDefaultFieldValue(BOOKMARKS, &result); return result; } } // namespace @@ -58,9 +58,9 @@ class ApplyUpdatesCommandTest : public SyncerCommandTest { make_scoped_refptr(new FakeModelWorker(GROUP_UI))); workers()->push_back( make_scoped_refptr(new FakeModelWorker(GROUP_PASSWORD))); - (*mutable_routing_info())[syncer::BOOKMARKS] = GROUP_UI; - (*mutable_routing_info())[syncer::PASSWORDS] = GROUP_PASSWORD; - (*mutable_routing_info())[syncer::NIGORI] = GROUP_PASSIVE; + (*mutable_routing_info())[BOOKMARKS] = GROUP_UI; + (*mutable_routing_info())[PASSWORDS] = GROUP_PASSWORD; + (*mutable_routing_info())[NIGORI] = GROUP_PASSIVE; SyncerCommandTest::SetUp(); entry_factory_.reset(new TestEntryFactory(directory())); ExpectNoGroupsToChange(apply_updates_command_); @@ -138,7 +138,7 @@ TEST_F(ApplyUpdatesCommandTest, UpdateWithChildrenBeforeParents) { // to detect that this update can't be applied because it is in a CONFLICT // state. TEST_F(ApplyUpdatesCommandTest, SimpleConflict) { - entry_factory_->CreateUnappliedAndUnsyncedItem("item", syncer::BOOKMARKS); + entry_factory_->CreateUnappliedAndUnsyncedItem("item", BOOKMARKS); ExpectGroupToChange(apply_updates_command_, GROUP_UI); apply_updates_command_.ExecuteImpl(session()); @@ -158,7 +158,7 @@ TEST_F(ApplyUpdatesCommandTest, SimpleConflict) { TEST_F(ApplyUpdatesCommandTest, HierarchyAndSimpleConflict) { // Create a simply-conflicting item. It will start with valid parent ids. int64 handle = entry_factory_->CreateUnappliedAndUnsyncedItem( - "orphaned_by_server", syncer::BOOKMARKS); + "orphaned_by_server", BOOKMARKS); { // Manually set the SERVER_PARENT_ID to bad value. // A bad parent indicates a hierarchy conflict. @@ -195,8 +195,7 @@ TEST_F(ApplyUpdatesCommandTest, HierarchyConflictDirectoryLoop) { // parent of 'Y'. { // Create it as a child of root node. - int64 handle = entry_factory_->CreateSyncedItem( - "X", syncer::BOOKMARKS, true); + int64 handle = entry_factory_->CreateSyncedItem("X", BOOKMARKS, true); WriteTransaction trans(FROM_HERE, UNITTEST, directory()); MutableEntry entry(&trans, syncable::GET_BY_HANDLE, handle); @@ -211,7 +210,7 @@ TEST_F(ApplyUpdatesCommandTest, HierarchyConflictDirectoryLoop) { // Item 'Y' is child of 'X'. entry_factory_->CreateUnsyncedItem( id_factory_.MakeServer("Y"), id_factory_.MakeServer("X"), "Y", true, - syncer::BOOKMARKS, NULL); + BOOKMARKS, NULL); // If the server's update were applied, we would have X be a child of Y, and Y // as a child of X. That's a directory loop. The UpdateApplicator should @@ -241,7 +240,7 @@ TEST_F(ApplyUpdatesCommandTest, HierarchyConflictDeletedParent) { int64 parent_handle; entry_factory_->CreateUnsyncedItem( Id::CreateFromServerId("parent"), id_factory_.root(), - "parent", true, syncer::BOOKMARKS, &parent_handle); + "parent", true, BOOKMARKS, &parent_handle); { WriteTransaction trans(FROM_HERE, UNITTEST, directory()); MutableEntry entry(&trans, syncable::GET_BY_HANDLE, parent_handle); @@ -276,8 +275,8 @@ TEST_F(ApplyUpdatesCommandTest, HierarchyConflictDeleteNonEmptyDirectory) { // Create a server-deleted directory. { // Create it as a child of root node. - int64 handle = entry_factory_->CreateSyncedItem( - "parent", syncer::BOOKMARKS, true); + int64 handle = + entry_factory_->CreateSyncedItem("parent", BOOKMARKS, true); WriteTransaction trans(FROM_HERE, UNITTEST, directory()); MutableEntry entry(&trans, syncable::GET_BY_HANDLE, handle); @@ -293,7 +292,7 @@ TEST_F(ApplyUpdatesCommandTest, HierarchyConflictDeleteNonEmptyDirectory) { // Create a local child of the server-deleted directory. entry_factory_->CreateUnsyncedItem( id_factory_.MakeServer("child"), id_factory_.MakeServer("parent"), - "child", false, syncer::BOOKMARKS, NULL); + "child", false, BOOKMARKS, NULL); // The server's request to delete the directory must be ignored, otherwise our // unsynced new child would be orphaned. This is a hierarchy conflict. @@ -379,7 +378,7 @@ TEST_F(ApplyUpdatesCommandTest, DecryptablePassword) { cryptographer = directory()->GetCryptographer(&trans); } - syncer::KeyParams params = {"localhost", "dummy", "foobar"}; + KeyParams params = {"localhost", "dummy", "foobar"}; cryptographer->AddKey(params); sync_pb::EntitySpecifics specifics; @@ -409,7 +408,7 @@ TEST_F(ApplyUpdatesCommandTest, UndecryptableData) { // Undecryptable updates should not be applied. sync_pb::EntitySpecifics encrypted_bookmark; encrypted_bookmark.mutable_encrypted(); - AddDefaultFieldValue(syncer::BOOKMARKS, &encrypted_bookmark); + AddDefaultFieldValue(BOOKMARKS, &encrypted_bookmark); string root_server_id = syncable::GetNullId().GetServerId(); entry_factory_->CreateUnappliedNewItemWithParent( "folder", encrypted_bookmark, root_server_id); @@ -518,9 +517,9 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) { // Storing the cryptographer separately is bad, but for this test we // know it's safe. Cryptographer* cryptographer; - syncer::ModelTypeSet encrypted_types; - encrypted_types.Put(syncer::PASSWORDS); - encrypted_types.Put(syncer::NIGORI); + ModelTypeSet encrypted_types; + encrypted_types.Put(PASSWORDS); + encrypted_types.Put(NIGORI); { syncable::ReadTransaction trans(FROM_HERE, directory()); cryptographer = directory()->GetCryptographer(&trans); @@ -536,9 +535,9 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) { sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori(); other_cryptographer.GetKeys(nigori->mutable_encrypted()); nigori->set_encrypt_bookmarks(true); - encrypted_types.Put(syncer::BOOKMARKS); + encrypted_types.Put(BOOKMARKS); entry_factory_->CreateUnappliedNewItem( - syncer::ModelTypeToRootTag(syncer::NIGORI), specifics, true); + ModelTypeToRootTag(NIGORI), specifics, true); EXPECT_FALSE(cryptographer->has_pending_keys()); ExpectGroupToChange(apply_updates_command_, GROUP_PASSIVE); @@ -558,16 +557,16 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) { EXPECT_FALSE(cryptographer->is_ready()); EXPECT_TRUE(cryptographer->has_pending_keys()); EXPECT_TRUE( - cryptographer->GetEncryptedTypes().Equals(syncer::ModelTypeSet::All())); + cryptographer->GetEncryptedTypes().Equals(ModelTypeSet::All())); } TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) { // Storing the cryptographer separately is bad, but for this test we // know it's safe. Cryptographer* cryptographer; - syncer::ModelTypeSet encrypted_types; - encrypted_types.Put(syncer::PASSWORDS); - encrypted_types.Put(syncer::NIGORI); + ModelTypeSet encrypted_types; + encrypted_types.Put(PASSWORDS); + encrypted_types.Put(NIGORI); { syncable::ReadTransaction trans(FROM_HERE, directory()); cryptographer = directory()->GetCryptographer(&trans); @@ -584,10 +583,10 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) { other_cryptographer.GetKeys(nigori->mutable_encrypted()); nigori->set_encrypt_sessions(true); nigori->set_encrypt_themes(true); - encrypted_types.Put(syncer::SESSIONS); - encrypted_types.Put(syncer::THEMES); + encrypted_types.Put(SESSIONS); + encrypted_types.Put(THEMES); entry_factory_->CreateUnappliedNewItem( - syncer::ModelTypeToRootTag(syncer::NIGORI), specifics, true); + ModelTypeToRootTag(NIGORI), specifics, true); EXPECT_FALSE(cryptographer->has_pending_keys()); ExpectGroupToChange(apply_updates_command_, GROUP_PASSIVE); @@ -607,7 +606,7 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) { EXPECT_FALSE(cryptographer->is_ready()); EXPECT_TRUE(cryptographer->has_pending_keys()); EXPECT_TRUE( - cryptographer->GetEncryptedTypes().Equals(syncer::ModelTypeSet::All())); + cryptographer->GetEncryptedTypes().Equals(ModelTypeSet::All())); } // Create some local unsynced and unencrypted data. Apply a nigori update that @@ -619,9 +618,9 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) { // Storing the cryptographer separately is bad, but for this test we // know it's safe. Cryptographer* cryptographer; - syncer::ModelTypeSet encrypted_types; - encrypted_types.Put(syncer::PASSWORDS); - encrypted_types.Put(syncer::NIGORI); + ModelTypeSet encrypted_types; + encrypted_types.Put(PASSWORDS); + encrypted_types.Put(NIGORI); { syncable::ReadTransaction trans(FROM_HERE, directory()); cryptographer = directory()->GetCryptographer(&trans); @@ -639,21 +638,21 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) { // First item is a folder Id folder_id = id_factory_.NewLocalId(); entry_factory_->CreateUnsyncedItem(folder_id, id_factory_.root(), "folder", - true, syncer::BOOKMARKS, NULL); + true, BOOKMARKS, NULL); // Next five items are children of the folder size_t i; size_t batch_s = 5; for (i = 0; i < batch_s; ++i) { entry_factory_->CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id, base::StringPrintf("Item %"PRIuS"", i), - false, syncer::BOOKMARKS, NULL); + false, BOOKMARKS, NULL); } // Next five items are children of the root. for (; i < 2*batch_s; ++i) { entry_factory_->CreateUnsyncedItem( id_factory_.NewLocalId(), id_factory_.root(), base::StringPrintf("Item %"PRIuS"", i), false, - syncer::BOOKMARKS, NULL); + BOOKMARKS, NULL); } KeyParams params = {"localhost", "dummy", "foobar"}; @@ -662,9 +661,9 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) { sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori(); cryptographer->GetKeys(nigori->mutable_encrypted()); nigori->set_encrypt_bookmarks(true); - encrypted_types.Put(syncer::BOOKMARKS); + encrypted_types.Put(BOOKMARKS); entry_factory_->CreateUnappliedNewItem( - syncer::ModelTypeToRootTag(syncer::NIGORI), specifics, true); + ModelTypeToRootTag(NIGORI), specifics, true); EXPECT_FALSE(cryptographer->has_pending_keys()); EXPECT_TRUE(cryptographer->is_ready()); @@ -702,7 +701,7 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) { // If ProcessUnsyncedChangesForEncryption worked, all our unsynced changes // should be encrypted now. - EXPECT_TRUE(syncer::ModelTypeSet::All().Equals( + EXPECT_TRUE(ModelTypeSet::All().Equals( cryptographer->GetEncryptedTypes())); EXPECT_TRUE(VerifyUnsyncedChangesAreEncrypted(&trans, encrypted_types)); @@ -715,7 +714,7 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) { { WriteTransaction trans(FROM_HERE, UNITTEST, directory()); MutableEntry entry(&trans, syncable::GET_BY_SERVER_TAG, - syncer::ModelTypeToRootTag(syncer::NIGORI)); + ModelTypeToRootTag(NIGORI)); ASSERT_TRUE(entry.good()); entry.Put(syncable::SERVER_VERSION, entry_factory_->GetNextRevision()); entry.Put(syncable::IS_UNAPPLIED_UPDATE, true); @@ -742,7 +741,7 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) { syncable::ReadTransaction trans(FROM_HERE, directory()); // All our changes should still be encrypted. - EXPECT_TRUE(syncer::ModelTypeSet::All().Equals( + EXPECT_TRUE(ModelTypeSet::All().Equals( cryptographer->GetEncryptedTypes())); EXPECT_TRUE(VerifyUnsyncedChangesAreEncrypted(&trans, encrypted_types)); @@ -756,9 +755,9 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) { // Storing the cryptographer separately is bad, but for this test we // know it's safe. Cryptographer* cryptographer; - syncer::ModelTypeSet encrypted_types; - encrypted_types.Put(syncer::PASSWORDS); - encrypted_types.Put(syncer::NIGORI); + ModelTypeSet encrypted_types; + encrypted_types.Put(PASSWORDS); + encrypted_types.Put(NIGORI); { syncable::ReadTransaction trans(FROM_HERE, directory()); cryptographer = directory()->GetCryptographer(&trans); @@ -777,21 +776,21 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) { Id folder_id = id_factory_.NewLocalId(); entry_factory_->CreateUnsyncedItem( folder_id, id_factory_.root(), "folder", true, - syncer::BOOKMARKS, NULL); + BOOKMARKS, NULL); // Next five items are children of the folder size_t i; size_t batch_s = 5; for (i = 0; i < batch_s; ++i) { entry_factory_->CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id, base::StringPrintf("Item %"PRIuS"", i), - false, syncer::BOOKMARKS, NULL); + false, BOOKMARKS, NULL); } // Next five items are children of the root. for (; i < 2*batch_s; ++i) { entry_factory_->CreateUnsyncedItem( id_factory_.NewLocalId(), id_factory_.root(), base::StringPrintf("Item %"PRIuS"", i), false, - syncer::BOOKMARKS, NULL); + BOOKMARKS, NULL); } // We encrypt with new keys, triggering the local cryptographer to be unready @@ -803,9 +802,9 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) { sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori(); other_cryptographer.GetKeys(nigori->mutable_encrypted()); nigori->set_encrypt_bookmarks(true); - encrypted_types.Put(syncer::BOOKMARKS); + encrypted_types.Put(BOOKMARKS); entry_factory_->CreateUnappliedNewItem( - syncer::ModelTypeToRootTag(syncer::NIGORI), specifics, true); + ModelTypeToRootTag(NIGORI), specifics, true); EXPECT_FALSE(cryptographer->has_pending_keys()); { @@ -843,7 +842,7 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) { // cryptographer should be updated. EXPECT_FALSE(VerifyUnsyncedChangesAreEncrypted(&trans, encrypted_types)); EXPECT_TRUE(cryptographer->GetEncryptedTypes().Equals( - syncer::ModelTypeSet().All())); + ModelTypeSet().All())); EXPECT_FALSE(cryptographer->is_ready()); EXPECT_TRUE(cryptographer->has_pending_keys()); diff --git a/sync/engine/build_commit_command.cc b/sync/engine/build_commit_command.cc index 32237f9..534e196 100644 --- a/sync/engine/build_commit_command.cc +++ b/sync/engine/build_commit_command.cc @@ -37,7 +37,6 @@ using syncable::IS_UNSYNCED; using syncable::Id; using syncable::MutableEntry; using syncable::SPECIFICS; -using syncer::UNSPECIFIED; // static int64 BuildCommitCommand::GetFirstPosition() { diff --git a/sync/engine/cleanup_disabled_types_command.cc b/sync/engine/cleanup_disabled_types_command.cc index cc78168..d7dc7a6 100644 --- a/sync/engine/cleanup_disabled_types_command.cc +++ b/sync/engine/cleanup_disabled_types_command.cc @@ -18,8 +18,6 @@ CleanupDisabledTypesCommand::~CleanupDisabledTypesCommand() {} SyncerError CleanupDisabledTypesCommand::ExecuteImpl( sessions::SyncSession* session) { - using syncer::ModelTypeSet; - using syncer::ModelTypeSetToString; // Because a full directory purge is slow, we avoid purging // undesired types unless we have reason to believe they were // previously enabled. Because purging could theoretically fail on diff --git a/sync/engine/cleanup_disabled_types_command_unittest.cc b/sync/engine/cleanup_disabled_types_command_unittest.cc index 79a59fe..286ca8d 100644 --- a/sync/engine/cleanup_disabled_types_command_unittest.cc +++ b/sync/engine/cleanup_disabled_types_command_unittest.cc @@ -24,7 +24,7 @@ class CleanupDisabledTypesCommandTest : public MockDirectorySyncerCommandTest { virtual void SetUp() { mutable_routing_info()->clear(); - (*mutable_routing_info())[syncer::BOOKMARKS] = GROUP_PASSIVE; + (*mutable_routing_info())[BOOKMARKS] = GROUP_PASSIVE; MockDirectorySyncerCommandTest::SetUp(); } }; @@ -33,7 +33,7 @@ class CleanupDisabledTypesCommandTest : public MockDirectorySyncerCommandTest { TEST_F(CleanupDisabledTypesCommandTest, NoPreviousRoutingInfo) { CleanupDisabledTypesCommand command; ModelTypeSet expected = ModelTypeSet::All(); - expected.Remove(syncer::BOOKMARKS); + expected.Remove(BOOKMARKS); EXPECT_CALL(*mock_directory(), PurgeEntriesWithTypeIn(HasModelTypes(expected))); command.ExecuteImpl(session()); @@ -45,7 +45,7 @@ TEST_F(CleanupDisabledTypesCommandTest, NoPurge) { ModelSafeRoutingInfo prev(routing_info()); session()->context()->set_previous_session_routing_info(prev); - (*mutable_routing_info())[syncer::AUTOFILL] = GROUP_PASSIVE; + (*mutable_routing_info())[AUTOFILL] = GROUP_PASSIVE; command.ExecuteImpl(session()); prev = routing_info(); @@ -55,16 +55,16 @@ TEST_F(CleanupDisabledTypesCommandTest, NoPurge) { TEST_F(CleanupDisabledTypesCommandTest, TypeDisabled) { CleanupDisabledTypesCommand command; - (*mutable_routing_info())[syncer::AUTOFILL] = GROUP_PASSIVE; - (*mutable_routing_info())[syncer::THEMES] = GROUP_PASSIVE; - (*mutable_routing_info())[syncer::EXTENSIONS] = GROUP_PASSIVE; + (*mutable_routing_info())[AUTOFILL] = GROUP_PASSIVE; + (*mutable_routing_info())[THEMES] = GROUP_PASSIVE; + (*mutable_routing_info())[EXTENSIONS] = GROUP_PASSIVE; ModelSafeRoutingInfo prev(routing_info()); - prev[syncer::PASSWORDS] = GROUP_PASSIVE; - prev[syncer::PREFERENCES] = GROUP_PASSIVE; + prev[PASSWORDS] = GROUP_PASSIVE; + prev[PREFERENCES] = GROUP_PASSIVE; session()->context()->set_previous_session_routing_info(prev); - const ModelTypeSet expected(syncer::PASSWORDS, syncer::PREFERENCES); + const ModelTypeSet expected(PASSWORDS, PREFERENCES); EXPECT_CALL(*mock_directory(), PurgeEntriesWithTypeIn(HasModelTypes(expected))); command.ExecuteImpl(session()); diff --git a/sync/engine/conflict_resolver.cc b/sync/engine/conflict_resolver.cc index 458c7ce..2a3c62d 100644 --- a/sync/engine/conflict_resolver.cc +++ b/sync/engine/conflict_resolver.cc @@ -221,7 +221,7 @@ ConflictResolver::ProcessSimpleConflict(WriteTransaction* trans, } // We manually merge nigori data. - if (entry.GetModelType() == syncer::NIGORI) { + if (entry.GetModelType() == NIGORI) { // Create a new set of specifics based on the server specifics (which // preserves their encryption keys). sync_pb::EntitySpecifics specifics = diff --git a/sync/engine/download_updates_command.cc b/sync/engine/download_updates_command.cc index 22839f6..e7e1b08 100644 --- a/sync/engine/download_updates_command.cc +++ b/sync/engine/download_updates_command.cc @@ -46,8 +46,7 @@ SyncerError DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { << ModelTypeSetToString(enabled_types); DCHECK(!enabled_types.Empty()); - const syncer::ModelTypePayloadMap& type_payload_map = - session->source().types; + const ModelTypePayloadMap& type_payload_map = session->source().types; for (ModelTypeSet::Iterator it = enabled_types.First(); it.Good(); it.Inc()) { sync_pb::DataTypeProgressMarker* progress_marker = @@ -55,7 +54,7 @@ SyncerError DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { dir->GetDownloadProgress(it.Get(), progress_marker); // Set notification hint if present. - syncer::ModelTypePayloadMap::const_iterator type_payload = + ModelTypePayloadMap::const_iterator type_payload = type_payload_map.find(it.Get()); if (type_payload != type_payload_map.end()) { progress_marker->set_notification_hint(type_payload->second); diff --git a/sync/engine/download_updates_command_unittest.cc b/sync/engine/download_updates_command_unittest.cc index 88b97c0..f7bbcb6 100644 --- a/sync/engine/download_updates_command_unittest.cc +++ b/sync/engine/download_updates_command_unittest.cc @@ -27,9 +27,9 @@ class DownloadUpdatesCommandTest : public SyncerCommandTest { make_scoped_refptr(new FakeModelWorker(GROUP_DB))); workers()->push_back( make_scoped_refptr(new FakeModelWorker(GROUP_UI))); - (*mutable_routing_info())[syncer::AUTOFILL] = GROUP_DB; - (*mutable_routing_info())[syncer::BOOKMARKS] = GROUP_UI; - (*mutable_routing_info())[syncer::PREFERENCES] = GROUP_UI; + (*mutable_routing_info())[AUTOFILL] = GROUP_DB; + (*mutable_routing_info())[BOOKMARKS] = GROUP_UI; + (*mutable_routing_info())[PREFERENCES] = GROUP_UI; SyncerCommandTest::SetUp(); } @@ -49,9 +49,9 @@ TEST_F(DownloadUpdatesCommandTest, ExecuteNoPayloads) { TEST_F(DownloadUpdatesCommandTest, ExecuteWithPayloads) { ConfigureMockServerConnection(); sessions::SyncSourceInfo source; - source.types[syncer::AUTOFILL] = "autofill_payload"; - source.types[syncer::BOOKMARKS] = "bookmark_payload"; - source.types[syncer::PREFERENCES] = "preferences_payload"; + source.types[AUTOFILL] = "autofill_payload"; + source.types[BOOKMARKS] = "bookmark_payload"; + source.types[PREFERENCES] = "preferences_payload"; mock_server()->ExpectGetUpdatesRequestTypes( GetRoutingInfoTypes(routing_info())); mock_server()->ExpectGetUpdatesRequestPayloads(source.types); diff --git a/sync/engine/get_commit_ids_command.cc b/sync/engine/get_commit_ids_command.cc index 405391e..a7a52dd 100644 --- a/sync/engine/get_commit_ids_command.cc +++ b/sync/engine/get_commit_ids_command.cc @@ -43,7 +43,7 @@ SyncerError GetCommitIdsCommand::ExecuteImpl(SyncSession* session) { GetUnsyncedEntries(session->write_transaction(), &all_unsynced_handles); - syncer::ModelTypeSet encrypted_types; + ModelTypeSet encrypted_types; bool passphrase_missing = false; Cryptographer* cryptographer = session->context()-> @@ -53,7 +53,7 @@ SyncerError GetCommitIdsCommand::ExecuteImpl(SyncSession* session) { passphrase_missing = cryptographer->has_pending_keys(); }; - const syncer::ModelTypeSet throttled_types = + const ModelTypeSet throttled_types = session->context()->throttled_data_type_tracker()->GetThrottledTypes(); // We filter out all unready entries from the set of unsynced handles. This // new set of ready and unsynced items (which excludes throttled items as @@ -102,19 +102,19 @@ bool IsEntryInConflict(const syncable::Entry& entry) { // encrypted). // 3. It's type is currently throttled. // 4. It's a delete but has not been committed. -bool IsEntryReadyForCommit(syncer::ModelTypeSet throttled_types, - syncer::ModelTypeSet encrypted_types, +bool IsEntryReadyForCommit(ModelTypeSet throttled_types, + ModelTypeSet encrypted_types, bool passphrase_missing, const syncable::Entry& entry) { DCHECK(entry.Get(syncable::IS_UNSYNCED)); if (IsEntryInConflict(entry)) return false; - const syncer::ModelType type = entry.GetModelType(); + const ModelType type = entry.GetModelType(); // We special case the nigori node because even though it is considered an // "encrypted type", not all nigori node changes require valid encryption // (ex: sync_tabs). - if ((type != syncer::NIGORI) && encrypted_types.Has(type) && + if ((type != NIGORI) && encrypted_types.Has(type) && (passphrase_missing || syncable::EntryNeedsEncryption(encrypted_types, entry))) { // This entry requires encryption but is not properly encrypted (possibly @@ -159,8 +159,8 @@ bool IsEntryReadyForCommit(syncer::ModelTypeSet throttled_types, void GetCommitIdsCommand::FilterUnreadyEntries( syncable::BaseTransaction* trans, - syncer::ModelTypeSet throttled_types, - syncer::ModelTypeSet encrypted_types, + ModelTypeSet throttled_types, + ModelTypeSet encrypted_types, bool passphrase_missing, const syncable::Directory::UnsyncedMetaHandles& unsynced_handles, std::set<int64>* ready_unsynced_set) { diff --git a/sync/engine/get_commit_ids_command.h b/sync/engine/get_commit_ids_command.h index b7e4335..83f3e62 100644 --- a/sync/engine/get_commit_ids_command.h +++ b/sync/engine/get_commit_ids_command.h @@ -58,8 +58,8 @@ class GetCommitIdsCommand : public SyncerCommand { // 4. It's a delete but has not been committed. void FilterUnreadyEntries( syncable::BaseTransaction* trans, - syncer::ModelTypeSet throttled_types, - syncer::ModelTypeSet encrypted_types, + ModelTypeSet throttled_types, + ModelTypeSet encrypted_types, bool passphrase_missing, const syncable::Directory::UnsyncedMetaHandles& unsynced_handles, std::set<int64>* ready_unsynced_set); diff --git a/sync/engine/model_changing_syncer_command.h b/sync/engine/model_changing_syncer_command.h index 9a58249..3d780e7 100644 --- a/sync/engine/model_changing_syncer_command.h +++ b/sync/engine/model_changing_syncer_command.h @@ -30,8 +30,7 @@ class ModelChangingSyncerCommand : public SyncerCommand { virtual ~ModelChangingSyncerCommand() { } // SyncerCommand implementation. Sets work_session to session. - virtual syncer::SyncerError ExecuteImpl( - sessions::SyncSession* session) OVERRIDE; + virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; // Wrapper so implementations don't worry about storing work_session. SyncerError StartChangingModel() { diff --git a/sync/engine/model_changing_syncer_command_unittest.cc b/sync/engine/model_changing_syncer_command_unittest.cc index 676411b..867f93e 100644 --- a/sync/engine/model_changing_syncer_command_unittest.cc +++ b/sync/engine/model_changing_syncer_command_unittest.cc @@ -53,8 +53,8 @@ class ModelChangingSyncerCommandTest : public SyncerCommandTest { make_scoped_refptr(new FakeModelWorker(GROUP_UI))); workers()->push_back( make_scoped_refptr(new FakeModelWorker(GROUP_PASSWORD))); - (*mutable_routing_info())[syncer::BOOKMARKS] = GROUP_UI; - (*mutable_routing_info())[syncer::PASSWORDS] = GROUP_PASSWORD; + (*mutable_routing_info())[BOOKMARKS] = GROUP_UI; + (*mutable_routing_info())[PASSWORDS] = GROUP_PASSWORD; SyncerCommandTest::SetUp(); } diff --git a/sync/engine/process_commit_response_command.cc b/sync/engine/process_commit_response_command.cc index be65c2e..8a00608 100644 --- a/sync/engine/process_commit_response_command.cc +++ b/sync/engine/process_commit_response_command.cc @@ -135,7 +135,7 @@ SyncerError ProcessCommitResponseCommand::ProcessCommitResponse( case CommitResponse::SUCCESS: // TODO(sync): worry about sync_rate_ rate calc? ++successes; - if (commit_set_.GetModelTypeAt(proj[i]) == syncer::BOOKMARKS) + if (commit_set_.GetModelTypeAt(proj[i]) == BOOKMARKS) status->increment_num_successful_bookmark_commits(); status->increment_num_successful_commits(); break; diff --git a/sync/engine/process_commit_response_command_unittest.cc b/sync/engine/process_commit_response_command_unittest.cc index b51f3e1..482036d 100644 --- a/sync/engine/process_commit_response_command_unittest.cc +++ b/sync/engine/process_commit_response_command_unittest.cc @@ -50,9 +50,9 @@ class ProcessCommitResponseCommandTest : public SyncerCommandTest { make_scoped_refptr(new FakeModelWorker(GROUP_DB))); workers()->push_back( make_scoped_refptr(new FakeModelWorker(GROUP_UI))); - (*mutable_routing_info())[syncer::BOOKMARKS] = GROUP_UI; - (*mutable_routing_info())[syncer::PREFERENCES] = GROUP_UI; - (*mutable_routing_info())[syncer::AUTOFILL] = GROUP_DB; + (*mutable_routing_info())[BOOKMARKS] = GROUP_UI; + (*mutable_routing_info())[PREFERENCES] = GROUP_UI; + (*mutable_routing_info())[AUTOFILL] = GROUP_DB; SyncerCommandTest::SetUp(); } @@ -66,7 +66,7 @@ class ProcessCommitResponseCommandTest : public SyncerCommandTest { } void CheckEntry(Entry* e, const std::string& name, - syncer::ModelType model_type, const Id& parent_id) { + ModelType model_type, const Id& parent_id) { EXPECT_TRUE(e->good()); ASSERT_EQ(name, e->Get(NON_UNIQUE_NAME)); ASSERT_EQ(model_type, e->GetModelType()); @@ -83,7 +83,7 @@ class ProcessCommitResponseCommandTest : public SyncerCommandTest { const Id& parent_id, const string& name, bool is_folder, - syncer::ModelType model_type, + ModelType model_type, int64* metahandle_out) { WriteTransaction trans(FROM_HERE, UNITTEST, directory()); Id predecessor_id; @@ -100,7 +100,7 @@ class ProcessCommitResponseCommandTest : public SyncerCommandTest { entry.Put(syncable::PARENT_ID, parent_id); entry.PutPredecessor(predecessor_id); sync_pb::EntitySpecifics default_specifics; - syncer::AddDefaultFieldValue(model_type, &default_specifics); + AddDefaultFieldValue(model_type, &default_specifics); entry.Put(syncable::SPECIFICS, default_specifics); if (item_id.ServerKnows()) { entry.Put(syncable::SERVER_SPECIFICS, default_specifics); @@ -120,7 +120,7 @@ class ProcessCommitResponseCommandTest : public SyncerCommandTest { const Id& item_id, const Id& parent_id, const string& name, - syncer::ModelType model_type, + ModelType model_type, sessions::OrderedCommitSet *commit_set, sync_pb::ClientToServerMessage *commit, sync_pb::ClientToServerResponse *response) { @@ -203,25 +203,25 @@ TEST_F(ProcessCommitResponseCommandTest, MultipleCommitIdProjections) { Id autofill_id1 = id_factory_.NewLocalId(); Id autofill_id2 = id_factory_.NewLocalId(); CreateUnprocessedCommitResult(bookmark_folder_id, id_factory_.root(), - "A bookmark folder", syncer::BOOKMARKS, + "A bookmark folder", BOOKMARKS, &commit_set, &request, &response); CreateUnprocessedCommitResult(bookmark_id1, bookmark_folder_id, - "bookmark 1", syncer::BOOKMARKS, + "bookmark 1", BOOKMARKS, &commit_set, &request, &response); CreateUnprocessedCommitResult(bookmark_id2, bookmark_folder_id, - "bookmark 2", syncer::BOOKMARKS, + "bookmark 2", BOOKMARKS, &commit_set, &request, &response); CreateUnprocessedCommitResult(pref_id1, id_factory_.root(), - "Pref 1", syncer::PREFERENCES, + "Pref 1", PREFERENCES, &commit_set, &request, &response); CreateUnprocessedCommitResult(pref_id2, id_factory_.root(), - "Pref 2", syncer::PREFERENCES, + "Pref 2", PREFERENCES, &commit_set, &request, &response); CreateUnprocessedCommitResult(autofill_id1, id_factory_.root(), - "Autofill 1", syncer::AUTOFILL, + "Autofill 1", AUTOFILL, &commit_set, &request, &response); CreateUnprocessedCommitResult(autofill_id2, id_factory_.root(), - "Autofill 2", syncer::AUTOFILL, + "Autofill 2", AUTOFILL, &commit_set, &request, &response); ProcessCommitResponseCommand command(commit_set, request, response); @@ -248,20 +248,20 @@ TEST_F(ProcessCommitResponseCommandTest, MultipleCommitIdProjections) { ASSERT_TRUE(directory()->GetFirstChildId(&trans, new_fid, &cid)); Entry b1(&trans, syncable::GET_BY_ID, cid); Entry b2(&trans, syncable::GET_BY_ID, b1.Get(syncable::NEXT_ID)); - CheckEntry(&b1, "bookmark 1", syncer::BOOKMARKS, new_fid); - CheckEntry(&b2, "bookmark 2", syncer::BOOKMARKS, new_fid); + CheckEntry(&b1, "bookmark 1", BOOKMARKS, new_fid); + CheckEntry(&b2, "bookmark 2", BOOKMARKS, new_fid); ASSERT_TRUE(b2.Get(syncable::NEXT_ID).IsRoot()); // Look at the prefs and autofill items. Entry p1(&trans, syncable::GET_BY_ID, b_folder.Get(syncable::NEXT_ID)); Entry p2(&trans, syncable::GET_BY_ID, p1.Get(syncable::NEXT_ID)); - CheckEntry(&p1, "Pref 1", syncer::PREFERENCES, id_factory_.root()); - CheckEntry(&p2, "Pref 2", syncer::PREFERENCES, id_factory_.root()); + CheckEntry(&p1, "Pref 1", PREFERENCES, id_factory_.root()); + CheckEntry(&p2, "Pref 2", PREFERENCES, id_factory_.root()); Entry a1(&trans, syncable::GET_BY_ID, p2.Get(syncable::NEXT_ID)); Entry a2(&trans, syncable::GET_BY_ID, a1.Get(syncable::NEXT_ID)); - CheckEntry(&a1, "Autofill 1", syncer::AUTOFILL, id_factory_.root()); - CheckEntry(&a2, "Autofill 2", syncer::AUTOFILL, id_factory_.root()); + CheckEntry(&a1, "Autofill 1", AUTOFILL, id_factory_.root()); + CheckEntry(&a2, "Autofill 2", AUTOFILL, id_factory_.root()); ASSERT_TRUE(a2.Get(syncable::NEXT_ID).IsRoot()); } @@ -283,7 +283,7 @@ TEST_F(ProcessCommitResponseCommandTest, NewFolderCommitKeepsChildOrder) { // Create the parent folder, a new item whose ID will change on commit. Id folder_id = id_factory_.NewLocalId(); CreateUnprocessedCommitResult(folder_id, id_factory_.root(), "A", - syncer::BOOKMARKS, + BOOKMARKS, &commit_set, &request, &response); // Verify that the item is reachable. @@ -303,7 +303,7 @@ TEST_F(ProcessCommitResponseCommandTest, NewFolderCommitKeepsChildOrder) { // Alternate between new and old child items, just for kicks. Id id = (i % 4 < 2) ? id_factory_.NewLocalId() : id_factory_.NewServerId(); CreateUnprocessedCommitResult( - id, folder_id, base::StringPrintf("Item %d", i), syncer::BOOKMARKS, + id, folder_id, base::StringPrintf("Item %d", i), BOOKMARKS, &commit_set, &request, &response); } // The second 25 children will be unsynced items but NOT part of the commit @@ -314,7 +314,7 @@ TEST_F(ProcessCommitResponseCommandTest, NewFolderCommitKeepsChildOrder) { // Alternate between new and old child items, just for kicks. Id id = (i % 4 < 2) ? id_factory_.NewLocalId() : id_factory_.NewServerId(); CreateUnsyncedItem(id, folder_id, base::StringPrintf("Item %d", i), - false, syncer::BOOKMARKS, NULL); + false, BOOKMARKS, NULL); } // Process the commit response for the parent folder and the first @@ -408,19 +408,19 @@ TEST_P(MixedResult, ExtensionActivity) { sync_pb::ClientToServerMessage request; sync_pb::ClientToServerResponse response; - EXPECT_NE(routing_info().find(syncer::BOOKMARKS)->second, - routing_info().find(syncer::AUTOFILL)->second) + EXPECT_NE(routing_info().find(BOOKMARKS)->second, + routing_info().find(AUTOFILL)->second) << "To not be lame, this test requires more than one active group."; // Bookmark item setup. CreateUnprocessedCommitResult(id_factory_.NewServerId(), - id_factory_.root(), "Some bookmark", syncer::BOOKMARKS, + id_factory_.root(), "Some bookmark", BOOKMARKS, &commit_set, &request, &response); if (ShouldFailBookmarkCommit()) SetLastErrorCode(CommitResponse::TRANSIENT_ERROR, &response); // Autofill item setup. CreateUnprocessedCommitResult(id_factory_.NewServerId(), - id_factory_.root(), "Some autofill", syncer::AUTOFILL, + id_factory_.root(), "Some autofill", AUTOFILL, &commit_set, &request, &response); if (ShouldFailAutofillCommit()) SetLastErrorCode(CommitResponse::TRANSIENT_ERROR, &response); diff --git a/sync/engine/process_updates_command.cc b/sync/engine/process_updates_command.cc index ccf3def..de6be0f 100644 --- a/sync/engine/process_updates_command.cc +++ b/sync/engine/process_updates_command.cc @@ -78,7 +78,7 @@ bool ReverifyEntry(syncable::WriteTransaction* trans, const bool deleted = entry.has_deleted() && entry.deleted(); const bool is_directory = IsFolder(entry); - const syncer::ModelType model_type = GetModelType(entry); + const ModelType model_type = GetModelType(entry); return VERIFY_SUCCESS == VerifyUpdateConsistency(trans, entry, @@ -160,7 +160,7 @@ ServerUpdateProcessingResult ProcessUpdatesCommand::ProcessUpdate( // We only store the old specifics if they were decryptable and applied and // there is no BASE_SERVER_SPECIFICS already. Else do nothing. if (!target_entry.Get(syncable::IS_UNAPPLIED_UPDATE) && - !syncer::IsRealDataType(syncer::GetModelTypeFromSpecifics( + !IsRealDataType(GetModelTypeFromSpecifics( target_entry.Get(syncable::BASE_SERVER_SPECIFICS))) && (!prev_specifics.has_encrypted() || cryptographer->CanDecrypt(prev_specifics.encrypted()))) { @@ -168,7 +168,7 @@ ServerUpdateProcessingResult ProcessUpdatesCommand::ProcessUpdate( << prev_specifics.SerializeAsString(); target_entry.Put(syncable::BASE_SERVER_SPECIFICS, prev_specifics); } - } else if (syncer::IsRealDataType(syncer::GetModelTypeFromSpecifics( + } else if (IsRealDataType(GetModelTypeFromSpecifics( target_entry.Get(syncable::BASE_SERVER_SPECIFICS)))) { // We have a BASE_SERVER_SPECIFICS, but a subsequent non-specifics-only // change arrived. As a result, we can't use the specifics alone to detect diff --git a/sync/engine/process_updates_command_unittest.cc b/sync/engine/process_updates_command_unittest.cc index e36af92..59f2210 100644 --- a/sync/engine/process_updates_command_unittest.cc +++ b/sync/engine/process_updates_command_unittest.cc @@ -27,8 +27,8 @@ class ProcessUpdatesCommandTest : public SyncerCommandTest { make_scoped_refptr(new FakeModelWorker(GROUP_UI))); workers()->push_back( make_scoped_refptr(new FakeModelWorker(GROUP_DB))); - (*mutable_routing_info())[syncer::BOOKMARKS] = GROUP_UI; - (*mutable_routing_info())[syncer::AUTOFILL] = GROUP_DB; + (*mutable_routing_info())[BOOKMARKS] = GROUP_UI; + (*mutable_routing_info())[AUTOFILL] = GROUP_DB; SyncerCommandTest::SetUp(); } diff --git a/sync/engine/resolve_conflicts_command_unittest.cc b/sync/engine/resolve_conflicts_command_unittest.cc index b04e0ec..7a9bc14 100644 --- a/sync/engine/resolve_conflicts_command_unittest.cc +++ b/sync/engine/resolve_conflicts_command_unittest.cc @@ -26,8 +26,8 @@ class ResolveConflictsCommandTest : public SyncerCommandTest { make_scoped_refptr(new FakeModelWorker(GROUP_UI))); workers()->push_back( make_scoped_refptr(new FakeModelWorker(GROUP_PASSWORD))); - (*mutable_routing_info())[syncer::BOOKMARKS] = GROUP_UI; - (*mutable_routing_info())[syncer::PASSWORDS] = GROUP_PASSWORD; + (*mutable_routing_info())[BOOKMARKS] = GROUP_UI; + (*mutable_routing_info())[PASSWORDS] = GROUP_PASSWORD; SyncerCommandTest::SetUp(); } diff --git a/sync/engine/store_timestamps_command.cc b/sync/engine/store_timestamps_command.cc index 0925e33..bab995e 100644 --- a/sync/engine/store_timestamps_command.cc +++ b/sync/engine/store_timestamps_command.cc @@ -26,12 +26,12 @@ SyncerError StoreTimestampsCommand::ExecuteImpl( // 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. - syncer::ModelTypeSet forward_progress_types; + ModelTypeSet forward_progress_types; for (int i = 0; i < updates.new_progress_marker_size(); ++i) { - syncer::ModelType model = - syncer::GetModelTypeFromSpecificsFieldNumber( + ModelType model = + GetModelTypeFromSpecificsFieldNumber( updates.new_progress_marker(i).data_type_id()); - if (model == syncer::UNSPECIFIED || model == syncer::TOP_LEVEL_FOLDER) { + if (model == UNSPECIFIED || model == TOP_LEVEL_FOLDER) { NOTREACHED() << "Unintelligible server response."; continue; } @@ -43,9 +43,9 @@ SyncerError StoreTimestampsCommand::ExecuteImpl( if (VLOG_IS_ON(1)) { DVLOG_IF(1, !forward_progress_types.Empty()) << "Get Updates got new progress marker for types: " - << syncer::ModelTypeSetToString(forward_progress_types) + << ModelTypeSetToString(forward_progress_types) << " out of possible: " - << syncer::ModelTypeSetToString(status->updates_request_types()); + << ModelTypeSetToString(status->updates_request_types()); } if (updates.has_changes_remaining()) { int64 changes_left = updates.changes_remaining(); diff --git a/sync/engine/sync_scheduler.h b/sync/engine/sync_scheduler.h index 423516b..c8226f4 100644 --- a/sync/engine/sync_scheduler.h +++ b/sync/engine/sync_scheduler.h @@ -33,8 +33,8 @@ struct ConfigurationParams { ConfigurationParams(); ConfigurationParams( const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, - const syncer::ModelTypeSet& types_to_download, - const syncer::ModelSafeRoutingInfo& routing_info, + const ModelTypeSet& types_to_download, + const ModelSafeRoutingInfo& routing_info, KeystoreKeyStatus keystore_key_status, const base::Closure& ready_task); ~ConfigurationParams(); @@ -42,7 +42,7 @@ struct ConfigurationParams { // Source for the configuration. sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source; // The types that should be downloaded. - syncer::ModelTypeSet types_to_download; + ModelTypeSet types_to_download; // The new routing info (superset of types to be downloaded). ModelSafeRoutingInfo routing_info; // Whether we need to perform a GetKey command. @@ -95,11 +95,11 @@ class SyncScheduler : public sessions::SyncSession::Delegate { virtual void ScheduleNudgeAsync( const base::TimeDelta& delay, NudgeSource source, - syncer::ModelTypeSet types, + ModelTypeSet types, const tracked_objects::Location& nudge_location) = 0; virtual void ScheduleNudgeWithPayloadsAsync( const base::TimeDelta& delay, NudgeSource source, - const syncer::ModelTypePayloadMap& types_with_payloads, + const ModelTypePayloadMap& types_with_payloads, const tracked_objects::Location& nudge_location) = 0; // Change status of notifications in the SyncSessionContext. diff --git a/sync/engine/sync_scheduler_impl.cc b/sync/engine/sync_scheduler_impl.cc index 289e189..e02de2c 100644 --- a/sync/engine/sync_scheduler_impl.cc +++ b/sync/engine/sync_scheduler_impl.cc @@ -31,23 +31,22 @@ using sessions::SyncSourceInfo; using sync_pb::GetUpdatesCallerInfo; namespace { -bool ShouldRequestEarlyExit( - const syncer::SyncProtocolError& error) { +bool ShouldRequestEarlyExit(const SyncProtocolError& error) { switch (error.error_type) { - case syncer::SYNC_SUCCESS: - case syncer::MIGRATION_DONE: - case syncer::THROTTLED: - case syncer::TRANSIENT_ERROR: + case SYNC_SUCCESS: + case MIGRATION_DONE: + case THROTTLED: + case TRANSIENT_ERROR: return false; - case syncer::NOT_MY_BIRTHDAY: - case syncer::CLEAR_PENDING: + case NOT_MY_BIRTHDAY: + case CLEAR_PENDING: // If we send terminate sync early then |sync_cycle_ended| notification // would not be sent. If there were no actions then |ACTIONABLE_ERROR| // notification wouldnt be sent either. Then the UI layer would be left // waiting forever. So assert we would send something. - DCHECK(error.action != syncer::UNKNOWN_ACTION); + DCHECK_NE(error.action, UNKNOWN_ACTION); return true; - case syncer::INVALID_CREDENTIAL: + case INVALID_CREDENTIAL: // The notification for this is handled by PostAndProcessHeaders|. // Server does no have to send any action for this. return true; @@ -60,8 +59,8 @@ bool ShouldRequestEarlyExit( } bool IsActionableError( - const syncer::SyncProtocolError& error) { - return (error.action != syncer::UNKNOWN_ACTION); + const SyncProtocolError& error) { + return (error.action != UNKNOWN_ACTION); } } // namespace @@ -70,8 +69,8 @@ ConfigurationParams::ConfigurationParams() keystore_key_status(KEYSTORE_KEY_UNNECESSARY) {} ConfigurationParams::ConfigurationParams( const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source, - const syncer::ModelTypeSet& types_to_download, - const syncer::ModelSafeRoutingInfo& routing_info, + const ModelTypeSet& types_to_download, + const ModelSafeRoutingInfo& routing_info, KeystoreKeyStatus keystore_key_status, const base::Closure& ready_task) : source(source), @@ -314,7 +313,7 @@ void BuildModelSafeParams( active_groups.insert(GROUP_PASSIVE); for (ModelTypeSet::Iterator iter = types_to_download.First(); iter.Good(); iter.Inc()) { - syncer::ModelType type = iter.Get(); + ModelType type = iter.Get(); ModelSafeRoutingInfo::const_iterator route = current_routes.find(type); DCHECK(route != current_routes.end()); ModelSafeGroup group = route->second; @@ -346,7 +345,7 @@ bool SyncSchedulerImpl::ScheduleConfiguration( // TODO(sync): now that ModelChanging commands only use those workers within // the routing info, we don't really need |restricted_workers|. Remove it. // crbug.com/133030 - syncer::ModelSafeRoutingInfo restricted_routes; + ModelSafeRoutingInfo restricted_routes; std::vector<ModelSafeWorker*> restricted_workers; BuildModelSafeParams(params.types_to_download, params.routing_info, @@ -449,11 +448,11 @@ SyncSchedulerImpl::JobProcessDecision SyncSchedulerImpl::DecideOnJob( return CONTINUE; // See if our type is throttled. - syncer::ModelTypeSet throttled_types = + ModelTypeSet throttled_types = session_context_->throttled_data_type_tracker()->GetThrottledTypes(); if (job.purpose == SyncSessionJob::NUDGE && job.session->source().updates_source == GetUpdatesCallerInfo::LOCAL) { - syncer::ModelTypeSet requested_types; + ModelTypeSet requested_types; for (ModelTypePayloadMap::const_iterator i = job.session->source().types.begin(); i != job.session->source().types.end(); @@ -588,7 +587,7 @@ void SyncSchedulerImpl::ScheduleNudgeAsync( << "types " << ModelTypeSetToString(types); ModelTypePayloadMap types_with_payloads = - syncer::ModelTypePayloadMapFromEnumSet(types, std::string()); + ModelTypePayloadMapFromEnumSet(types, std::string()); SyncSchedulerImpl::ScheduleNudgeImpl(delay, GetUpdatesFromNudgeSource(source), types_with_payloads, @@ -605,7 +604,7 @@ void SyncSchedulerImpl::ScheduleNudgeWithPayloadsAsync( << "Nudge scheduled with delay " << delay.InMilliseconds() << " ms, " << "source " << GetNudgeSourceString(source) << ", " << "payloads " - << syncer::ModelTypePayloadMapToString(types_with_payloads); + << ModelTypePayloadMapToString(types_with_payloads); SyncSchedulerImpl::ScheduleNudgeImpl(delay, GetUpdatesFromNudgeSource(source), @@ -626,7 +625,7 @@ void SyncSchedulerImpl::ScheduleNudgeImpl( << delay.InMilliseconds() << " ms, " << "source " << GetUpdatesSourceString(source) << ", " << "payloads " - << syncer::ModelTypePayloadMapToString(types_with_payloads) + << ModelTypePayloadMapToString(types_with_payloads) << (is_canary_job ? " (canary)" : ""); SyncSourceInfo info(source, types_with_payloads); diff --git a/sync/engine/sync_scheduler_impl.h b/sync/engine/sync_scheduler_impl.h index dfc3bff..179f900 100644 --- a/sync/engine/sync_scheduler_impl.h +++ b/sync/engine/sync_scheduler_impl.h @@ -45,11 +45,11 @@ class SyncSchedulerImpl : public SyncScheduler { virtual void ScheduleNudgeAsync( const base::TimeDelta& delay, NudgeSource source, - syncer::ModelTypeSet types, + ModelTypeSet types, const tracked_objects::Location& nudge_location) OVERRIDE; virtual void ScheduleNudgeWithPayloadsAsync( const base::TimeDelta& delay, NudgeSource source, - const syncer::ModelTypePayloadMap& types_with_payloads, + const ModelTypePayloadMap& types_with_payloads, const tracked_objects::Location& nudge_location) OVERRIDE; virtual void SetNotificationsEnabled(bool notifications_enabled) OVERRIDE; @@ -260,7 +260,7 @@ class SyncSchedulerImpl : public SyncScheduler { void ScheduleNudgeImpl( const base::TimeDelta& delay, sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, - const syncer::ModelTypePayloadMap& types_with_payloads, + const ModelTypePayloadMap& types_with_payloads, bool is_canary_job, const tracked_objects::Location& nudge_location); // Returns true if the client is currently in exponential backoff. @@ -282,8 +282,8 @@ class SyncSchedulerImpl : public SyncScheduler { void OnServerConnectionErrorFixed(); // The pointer is owned by the caller. - syncer::sessions::SyncSession* CreateSyncSession( - const syncer::sessions::SyncSourceInfo& info); + sessions::SyncSession* CreateSyncSession( + const sessions::SyncSourceInfo& info); // Creates a session for a poll and performs the sync. void PollTimerCallback(); diff --git a/sync/engine/sync_scheduler_unittest.cc b/sync/engine/sync_scheduler_unittest.cc index add275f..ff4787b 100644 --- a/sync/engine/sync_scheduler_unittest.cc +++ b/sync/engine/sync_scheduler_unittest.cc @@ -99,10 +99,10 @@ class SyncSchedulerTest : public testing::Test { delay_ = NULL; ModelSafeRoutingInfo routing_info; - routing_info[syncer::BOOKMARKS] = GROUP_UI; - routing_info[syncer::AUTOFILL] = GROUP_DB; - routing_info[syncer::THEMES] = GROUP_UI; - routing_info[syncer::NIGORI] = GROUP_PASSIVE; + routing_info[BOOKMARKS] = GROUP_UI; + routing_info[AUTOFILL] = GROUP_DB; + routing_info[THEMES] = GROUP_UI; + routing_info[NIGORI] = GROUP_PASSIVE; workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_UI))); workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_DB))); @@ -191,9 +191,9 @@ class SyncSchedulerTest : public testing::Test { // payload values. bool CompareModelTypeSetToModelTypePayloadMap( ModelTypeSet lhs, - const syncer::ModelTypePayloadMap& rhs) { + const ModelTypePayloadMap& rhs) { size_t count = 0; - for (syncer::ModelTypePayloadMap::const_iterator i = rhs.begin(); + for (ModelTypePayloadMap::const_iterator i = rhs.begin(); i != rhs.end(); ++i, ++count) { if (!lhs.Has(i->first)) return false; @@ -255,7 +255,7 @@ ACTION(QuitLoopNowAction) { // Test nudge scheduling. TEST_F(SyncSchedulerTest, Nudge) { SyncShareRecords records; - ModelTypeSet model_types(syncer::BOOKMARKS); + ModelTypeSet model_types(BOOKMARKS); EXPECT_CALL(*syncer(), SyncShare(_,_,_)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess), @@ -278,8 +278,8 @@ TEST_F(SyncSchedulerTest, Nudge) { // Make sure a second, later, nudge is unaffected by first (no coalescing). SyncShareRecords records2; - model_types.Remove(syncer::BOOKMARKS); - model_types.Put(syncer::AUTOFILL); + model_types.Remove(BOOKMARKS); + model_types.Put(AUTOFILL); EXPECT_CALL(*syncer(), SyncShare(_,_,_)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess), WithArg<0>(RecordSyncShare(&records2)))); @@ -298,7 +298,7 @@ TEST_F(SyncSchedulerTest, Nudge) { // errors. TEST_F(SyncSchedulerTest, Config) { SyncShareRecords records; - const ModelTypeSet model_types(syncer::BOOKMARKS); + const ModelTypeSet model_types(BOOKMARKS); EXPECT_CALL(*syncer(), SyncShare(_,_,_)) @@ -331,7 +331,7 @@ TEST_F(SyncSchedulerTest, ConfigWithBackingOff) { EXPECT_CALL(*delay(), GetDelay(_)) .WillRepeatedly(Return(TimeDelta::FromMilliseconds(1))); SyncShareRecords records; - const ModelTypeSet model_types(syncer::BOOKMARKS); + const ModelTypeSet model_types(BOOKMARKS); EXPECT_CALL(*syncer(), SyncShare(_,_,_)) @@ -368,7 +368,7 @@ TEST_F(SyncSchedulerTest, ConfigWithBackingOff) { // Issue a nudge when the config has failed. Make sure both the config and // nudge are executed. TEST_F(SyncSchedulerTest, NudgeWithConfigWithBackingOff) { - const ModelTypeSet model_types(syncer::BOOKMARKS); + const ModelTypeSet model_types(BOOKMARKS); UseMockDelayProvider(); EXPECT_CALL(*delay(), GetDelay(_)) .WillRepeatedly(Return(TimeDelta::FromMilliseconds(50))); @@ -433,10 +433,7 @@ TEST_F(SyncSchedulerTest, NudgeCoalescing) { EXPECT_CALL(*syncer(), SyncShare(_,_,_)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess), WithArg<0>(RecordSyncShare(&r)))); - const ModelTypeSet - types1(syncer::BOOKMARKS), - types2(syncer::AUTOFILL), - types3(syncer::THEMES); + const ModelTypeSet types1(BOOKMARKS), types2(AUTOFILL), types3(THEMES); TimeDelta delay = zero(); TimeTicks optimal_time = TimeTicks::Now() + delay; scheduler()->ScheduleNudgeAsync( @@ -477,8 +474,7 @@ TEST_F(SyncSchedulerTest, NudgeCoalescingWithDifferentTimings) { EXPECT_CALL(*syncer(), SyncShare(_,_,_)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess), WithArg<0>(RecordSyncShare(&r)))); - syncer::ModelTypeSet types1(syncer::BOOKMARKS), - types2(syncer::AUTOFILL), types3; + ModelTypeSet types1(BOOKMARKS), types2(AUTOFILL), types3; // Create a huge time delay. TimeDelta delay = TimeDelta::FromDays(1); @@ -509,8 +505,8 @@ TEST_F(SyncSchedulerTest, NudgeWithPayloads) { StartSyncScheduler(SyncScheduler::NORMAL_MODE); SyncShareRecords records; - syncer::ModelTypePayloadMap model_types_with_payloads; - model_types_with_payloads[syncer::BOOKMARKS] = "test"; + ModelTypePayloadMap model_types_with_payloads; + model_types_with_payloads[BOOKMARKS] = "test"; EXPECT_CALL(*syncer(), SyncShare(_,_,_)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess), @@ -529,8 +525,8 @@ TEST_F(SyncSchedulerTest, NudgeWithPayloads) { // Make sure a second, later, nudge is unaffected by first (no coalescing). SyncShareRecords records2; - model_types_with_payloads.erase(syncer::BOOKMARKS); - model_types_with_payloads[syncer::AUTOFILL] = "test2"; + model_types_with_payloads.erase(BOOKMARKS); + model_types_with_payloads[AUTOFILL] = "test2"; EXPECT_CALL(*syncer(), SyncShare(_,_,_)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess), WithArg<0>(RecordSyncShare(&records2)))); @@ -552,10 +548,10 @@ TEST_F(SyncSchedulerTest, NudgeWithPayloadsCoalescing) { EXPECT_CALL(*syncer(), SyncShare(_,_,_)) .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess), WithArg<0>(RecordSyncShare(&r)))); - syncer::ModelTypePayloadMap types1, types2, types3; - types1[syncer::BOOKMARKS] = "test1"; - types2[syncer::AUTOFILL] = "test2"; - types3[syncer::THEMES] = "test3"; + ModelTypePayloadMap types1, types2, types3; + types1[BOOKMARKS] = "test1"; + types2[AUTOFILL] = "test2"; + types3[THEMES] = "test3"; TimeDelta delay = zero(); TimeTicks optimal_time = TimeTicks::Now() + delay; scheduler()->ScheduleNudgeWithPayloadsAsync( @@ -566,9 +562,9 @@ TEST_F(SyncSchedulerTest, NudgeWithPayloadsCoalescing) { ASSERT_EQ(1U, r.snapshots.size()); EXPECT_GE(r.times[0], optimal_time); - syncer::ModelTypePayloadMap coalesced_types; - syncer::CoalescePayloads(&coalesced_types, types1); - syncer::CoalescePayloads(&coalesced_types, types2); + ModelTypePayloadMap coalesced_types; + CoalescePayloads(&coalesced_types, types1); + CoalescePayloads(&coalesced_types, types2); EXPECT_EQ(coalesced_types, r.snapshots[0].source().types); EXPECT_EQ(GetUpdatesCallerInfo::LOCAL, r.snapshots[0].source().updates_source); @@ -674,7 +670,7 @@ TEST_F(SyncSchedulerTest, SessionsCommitDelay) { StartSyncScheduler(SyncScheduler::NORMAL_MODE); EXPECT_EQ(delay1, scheduler()->GetSessionsCommitDelay()); - const ModelTypeSet model_types(syncer::BOOKMARKS); + const ModelTypeSet model_types(BOOKMARKS); scheduler()->ScheduleNudgeAsync( zero(), NUDGE_SOURCE_LOCAL, model_types, FROM_HERE); RunLoop(); @@ -716,7 +712,7 @@ TEST_F(SyncSchedulerTest, HasMoreToSyncThenFails) { // Test that no syncing occurs when throttled (although CleanupDisabledTypes // is allowed). TEST_F(SyncSchedulerTest, ThrottlingDoesThrottle) { - const ModelTypeSet types(syncer::BOOKMARKS); + const ModelTypeSet types(BOOKMARKS); TimeDelta poll(TimeDelta::FromMilliseconds(5)); TimeDelta throttle(TimeDelta::FromMinutes(10)); scheduler()->OnReceivedLongPollIntervalUpdate(poll); @@ -784,13 +780,13 @@ TEST_F(SyncSchedulerTest, ConfigurationMode) { StartSyncScheduler(SyncScheduler::CONFIGURATION_MODE); - const ModelTypeSet nudge_types(syncer::AUTOFILL); + const ModelTypeSet nudge_types(AUTOFILL); scheduler()->ScheduleNudgeAsync( zero(), NUDGE_SOURCE_LOCAL, nudge_types, FROM_HERE); scheduler()->ScheduleNudgeAsync( zero(), NUDGE_SOURCE_LOCAL, nudge_types, FROM_HERE); - const ModelTypeSet config_types(syncer::BOOKMARKS); + const ModelTypeSet config_types(BOOKMARKS); CallbackCounter counter; ConfigurationParams params( @@ -865,7 +861,7 @@ TEST_F(BackoffTriggersSyncSchedulerTest, FailDownloadTwice) { TEST_F(SyncSchedulerTest, BackoffDropsJobs) { SyncShareRecords r; TimeDelta poll(TimeDelta::FromMilliseconds(5)); - const ModelTypeSet types(syncer::BOOKMARKS); + const ModelTypeSet types(BOOKMARKS); scheduler()->OnReceivedLongPollIntervalUpdate(poll); UseMockDelayProvider(); @@ -1088,7 +1084,7 @@ TEST_F(SyncSchedulerTest, SyncerSteps) { .WillOnce(Invoke(sessions::test_util::SimulateSuccess)); StartSyncScheduler(SyncScheduler::CONFIGURATION_MODE); - syncer::ModelTypeSet model_types(syncer::BOOKMARKS); + ModelTypeSet model_types(BOOKMARKS); CallbackCounter counter; ConfigurationParams params( GetUpdatesCallerInfo::RECONFIGURATION, diff --git a/sync/engine/sync_scheduler_whitebox_unittest.cc b/sync/engine/sync_scheduler_whitebox_unittest.cc index 71af129..4581a07 100644 --- a/sync/engine/sync_scheduler_whitebox_unittest.cc +++ b/sync/engine/sync_scheduler_whitebox_unittest.cc @@ -19,7 +19,6 @@ using base::TimeDelta; using base::TimeTicks; namespace syncer { -using syncer::Syncer; using sessions::SyncSession; using sessions::SyncSessionContext; using sessions::SyncSourceInfo; @@ -32,8 +31,8 @@ class SyncSchedulerWhiteboxTest : public testing::Test { Syncer* syncer = new Syncer(); ModelSafeRoutingInfo routes; - routes[syncer::BOOKMARKS] = GROUP_UI; - routes[syncer::NIGORI] = GROUP_PASSIVE; + routes[BOOKMARKS] = GROUP_UI; + routes[NIGORI] = GROUP_PASSIVE; workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_UI))); workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_PASSIVE))); @@ -143,15 +142,15 @@ TEST_F(SyncSchedulerWhiteboxTest, SaveNudge) { TEST_F(SyncSchedulerWhiteboxTest, SaveNudgeWhileTypeThrottled) { InitializeSyncerOnNormalMode(); - syncer::ModelTypeSet types; - types.Put(syncer::BOOKMARKS); + ModelTypeSet types; + types.Put(BOOKMARKS); // Mark bookmarks as throttled. context()->throttled_data_type_tracker()->SetUnthrottleTime( types, base::TimeTicks::Now() + base::TimeDelta::FromHours(2)); - syncer::ModelTypePayloadMap types_with_payload; - types_with_payload[syncer::BOOKMARKS] = ""; + ModelTypePayloadMap types_with_payload; + types_with_payload[BOOKMARKS] = ""; SyncSourceInfo info(GetUpdatesCallerInfo::LOCAL, types_with_payload); SyncSession* s = scheduler_->CreateSyncSession(info); diff --git a/sync/engine/syncer_proto_util.cc b/sync/engine/syncer_proto_util.cc index c88b7c3..8149ad8 100644 --- a/sync/engine/syncer_proto_util.cc +++ b/sync/engine/syncer_proto_util.cc @@ -114,9 +114,9 @@ void SyncerProtoUtil::HandleMigrationDoneResponse( sessions::SyncSession* session) { LOG_IF(ERROR, 0 >= response->migrated_data_type_id_size()) << "MIGRATION_DONE but no types specified."; - syncer::ModelTypeSet to_migrate; + ModelTypeSet to_migrate; for (int i = 0; i < response->migrated_data_type_id_size(); i++) { - to_migrate.Put(syncer::GetModelTypeFromSpecificsFieldNumber( + to_migrate.Put(GetModelTypeFromSpecificsFieldNumber( response->migrated_data_type_id(i))); } // TODO(akalin): This should be a set union. @@ -230,7 +230,7 @@ void SyncerProtoUtil::HandleThrottleError( const base::TimeTicks& throttled_until, ThrottledDataTypeTracker* tracker, sessions::SyncSession::Delegate* delegate) { - DCHECK_EQ(error.error_type, syncer::THROTTLED); + DCHECK_EQ(error.error_type, THROTTLED); if (error.error_data_types.Empty()) { // No datatypes indicates the client should be completely throttled. delegate->OnSilencedUntil(throttled_until); @@ -257,53 +257,53 @@ SyncProtocolErrorType ConvertSyncProtocolErrorTypePBToLocalType( const sync_pb::SyncEnums::ErrorType& error_type) { switch (error_type) { case sync_pb::SyncEnums::SUCCESS: - return syncer::SYNC_SUCCESS; + return SYNC_SUCCESS; case sync_pb::SyncEnums::NOT_MY_BIRTHDAY: - return syncer::NOT_MY_BIRTHDAY; + return NOT_MY_BIRTHDAY; case sync_pb::SyncEnums::THROTTLED: - return syncer::THROTTLED; + return THROTTLED; case sync_pb::SyncEnums::CLEAR_PENDING: - return syncer::CLEAR_PENDING; + return CLEAR_PENDING; case sync_pb::SyncEnums::TRANSIENT_ERROR: - return syncer::TRANSIENT_ERROR; + return TRANSIENT_ERROR; case sync_pb::SyncEnums::MIGRATION_DONE: - return syncer::MIGRATION_DONE; + return MIGRATION_DONE; case sync_pb::SyncEnums::UNKNOWN: - return syncer::UNKNOWN_ERROR; + return UNKNOWN_ERROR; case sync_pb::SyncEnums::USER_NOT_ACTIVATED: case sync_pb::SyncEnums::AUTH_INVALID: case sync_pb::SyncEnums::ACCESS_DENIED: - return syncer::INVALID_CREDENTIAL; + return INVALID_CREDENTIAL; default: NOTREACHED(); - return syncer::UNKNOWN_ERROR; + return UNKNOWN_ERROR; } } -syncer::ClientAction ConvertClientActionPBToLocalClientAction( +ClientAction ConvertClientActionPBToLocalClientAction( const sync_pb::SyncEnums::Action& action) { switch (action) { case sync_pb::SyncEnums::UPGRADE_CLIENT: - return syncer::UPGRADE_CLIENT; + return UPGRADE_CLIENT; case sync_pb::SyncEnums::CLEAR_USER_DATA_AND_RESYNC: - return syncer::CLEAR_USER_DATA_AND_RESYNC; + return CLEAR_USER_DATA_AND_RESYNC; case sync_pb::SyncEnums::ENABLE_SYNC_ON_ACCOUNT: - return syncer::ENABLE_SYNC_ON_ACCOUNT; + return ENABLE_SYNC_ON_ACCOUNT; case sync_pb::SyncEnums::STOP_AND_RESTART_SYNC: - return syncer::STOP_AND_RESTART_SYNC; + return STOP_AND_RESTART_SYNC; case sync_pb::SyncEnums::DISABLE_SYNC_ON_CLIENT: - return syncer::DISABLE_SYNC_ON_CLIENT; + return DISABLE_SYNC_ON_CLIENT; case sync_pb::SyncEnums::UNKNOWN_ACTION: - return syncer::UNKNOWN_ACTION; + return UNKNOWN_ACTION; default: NOTREACHED(); - return syncer::UNKNOWN_ACTION; + return UNKNOWN_ACTION; } } -syncer::SyncProtocolError ConvertErrorPBToLocalType( +SyncProtocolError ConvertErrorPBToLocalType( const ClientToServerResponse::Error& error) { - syncer::SyncProtocolError sync_protocol_error; + SyncProtocolError sync_protocol_error; sync_protocol_error.error_type = ConvertSyncProtocolErrorTypePBToLocalType( error.error_type()); sync_protocol_error.error_description = error.error_description(); @@ -316,7 +316,7 @@ syncer::SyncProtocolError ConvertErrorPBToLocalType( DCHECK_EQ(error.error_type(), sync_pb::SyncEnums::THROTTLED); for (int i = 0; i < error.error_data_type_ids_size(); ++i) { sync_protocol_error.error_data_types.Put( - syncer::GetModelTypeFromSpecificsFieldNumber( + GetModelTypeFromSpecificsFieldNumber( error.error_data_type_ids(i))); } } @@ -325,13 +325,13 @@ syncer::SyncProtocolError ConvertErrorPBToLocalType( } // TODO(lipalani) : Rename these function names as per the CR for issue 7740067. -syncer::SyncProtocolError ConvertLegacyErrorCodeToNewError( +SyncProtocolError ConvertLegacyErrorCodeToNewError( const sync_pb::SyncEnums::ErrorType& error_type) { - syncer::SyncProtocolError error; + SyncProtocolError error; error.error_type = ConvertSyncProtocolErrorTypePBToLocalType(error_type); if (error_type == sync_pb::SyncEnums::CLEAR_PENDING || error_type == sync_pb::SyncEnums::NOT_MY_BIRTHDAY) { - error.action = syncer::DISABLE_SYNC_ON_CLIENT; + error.action = DISABLE_SYNC_ON_CLIENT; } // There is no other action we can compute for legacy server. return error; } @@ -358,11 +358,11 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage( msg, response)) { // There was an error establishing communication with the server. // We can not proceed beyond this point. - const syncer::HttpResponse::ServerConnectionCode server_status = + const HttpResponse::ServerConnectionCode server_status = session->context()->connection_manager()->server_status(); - DCHECK_NE(server_status, syncer::HttpResponse::NONE); - DCHECK_NE(server_status, syncer::HttpResponse::SERVER_CONNECTION_OK); + DCHECK_NE(server_status, HttpResponse::NONE); + DCHECK_NE(server_status, HttpResponse::SERVER_CONNECTION_OK); return ServerConnectionErrorAsSyncerError(server_status); } @@ -371,13 +371,13 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage( session->context()->traffic_recorder()->RecordClientToServerResponse( *response); - syncer::SyncProtocolError sync_protocol_error; + SyncProtocolError sync_protocol_error; // Birthday mismatch overrides any error that is sent by the server. if (!VerifyResponseBirthday(dir, response)) { - sync_protocol_error.error_type = syncer::NOT_MY_BIRTHDAY; + sync_protocol_error.error_type = NOT_MY_BIRTHDAY; sync_protocol_error.action = - syncer::DISABLE_SYNC_ON_CLIENT; + DISABLE_SYNC_ON_CLIENT; } else if (response->has_error()) { // This is a new server. Just get the error from the protocol. sync_protocol_error = ConvertErrorPBToLocalType(response->error()); @@ -397,28 +397,28 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage( // Now do any special handling for the error type and decide on the return // value. switch (sync_protocol_error.error_type) { - case syncer::UNKNOWN_ERROR: + case UNKNOWN_ERROR: LOG(WARNING) << "Sync protocol out-of-date. The server is using a more " << "recent version."; return SERVER_RETURN_UNKNOWN_ERROR; - case syncer::SYNC_SUCCESS: + case SYNC_SUCCESS: LogResponseProfilingData(*response); return SYNCER_OK; - case syncer::THROTTLED: + case THROTTLED: LOG(WARNING) << "Client silenced by server."; HandleThrottleError(sync_protocol_error, base::TimeTicks::Now() + GetThrottleDelay(*response), session->context()->throttled_data_type_tracker(), session->delegate()); return SERVER_RETURN_THROTTLED; - case syncer::TRANSIENT_ERROR: + case TRANSIENT_ERROR: return SERVER_RETURN_TRANSIENT_ERROR; - case syncer::MIGRATION_DONE: + case MIGRATION_DONE: HandleMigrationDoneResponse(response, session); return SERVER_RETURN_MIGRATION_DONE; - case syncer::CLEAR_PENDING: + case CLEAR_PENDING: return SERVER_RETURN_CLEAR_PENDING; - case syncer::NOT_MY_BIRTHDAY: + case NOT_MY_BIRTHDAY: return SERVER_RETURN_NOT_MY_BIRTHDAY; default: NOTREACHED(); diff --git a/sync/engine/syncer_proto_util.h b/sync/engine/syncer_proto_util.h index 53e3118..b674b50 100644 --- a/sync/engine/syncer_proto_util.h +++ b/sync/engine/syncer_proto_util.h @@ -77,7 +77,7 @@ class SyncerProtoUtil { // EntitySpecifics is used as a filter for the GetUpdates message to tell // the server which datatypes to send back. This adds a datatype so that // it's included in the filter. - static void AddToEntitySpecificDatatypesFilter(syncer::ModelType datatype, + static void AddToEntitySpecificDatatypesFilter(ModelType datatype, sync_pb::EntitySpecifics* filter); // Get a debug string representation of the client to server response. @@ -113,7 +113,7 @@ class SyncerProtoUtil { // Post the message using the scm, and do some processing on the returned // headers. Decode the server response. - static bool PostAndProcessHeaders(syncer::ServerConnectionManager* scm, + static bool PostAndProcessHeaders(ServerConnectionManager* scm, sessions::SyncSession* session, const sync_pb::ClientToServerMessage& msg, sync_pb::ClientToServerResponse* response); @@ -124,7 +124,7 @@ class SyncerProtoUtil { static void HandleThrottleError( const SyncProtocolError& error, const base::TimeTicks& throttled_until, - syncer::ThrottledDataTypeTracker* tracker, + ThrottledDataTypeTracker* tracker, sessions::SyncSession::Delegate* delegate); friend class SyncerProtoUtilTest; diff --git a/sync/engine/syncer_proto_util_unittest.cc b/sync/engine/syncer_proto_util_unittest.cc index 21735d8..8e031a1 100644 --- a/sync/engine/syncer_proto_util_unittest.cc +++ b/sync/engine/syncer_proto_util_unittest.cc @@ -207,7 +207,7 @@ TEST_F(SyncerProtoUtilTest, AddRequestBirthday) { EXPECT_EQ(msg.store_birthday(), "meat"); } -class DummyConnectionManager : public syncer::ServerConnectionManager { +class DummyConnectionManager : public ServerConnectionManager { public: DummyConnectionManager() : ServerConnectionManager("unused", 0, false), @@ -268,10 +268,10 @@ TEST_F(SyncerProtoUtilTest, PostAndProcessHeaders) { TEST_F(SyncerProtoUtilTest, HandleThrottlingWithDatatypes) { ThrottledDataTypeTracker tracker(NULL); SyncProtocolError error; - error.error_type = syncer::THROTTLED; - syncer::ModelTypeSet types; - types.Put(syncer::BOOKMARKS); - types.Put(syncer::PASSWORDS); + error.error_type = THROTTLED; + ModelTypeSet types; + types.Put(BOOKMARKS); + types.Put(PASSWORDS); error.error_data_types = types; base::TimeTicks ticks = base::TimeTicks::FromInternalValue(1); @@ -283,7 +283,7 @@ TEST_F(SyncerProtoUtilTest, HandleThrottlingNoDatatypes) { ThrottledDataTypeTracker tracker(NULL); MockDelegate delegate; SyncProtocolError error; - error.error_type = syncer::THROTTLED; + error.error_type = THROTTLED; base::TimeTicks ticks = base::TimeTicks::FromInternalValue(1); diff --git a/sync/engine/syncer_unittest.cc b/sync/engine/syncer_unittest.cc index 3f6dde7..458f5a1 100644 --- a/sync/engine/syncer_unittest.cc +++ b/sync/engine/syncer_unittest.cc @@ -152,7 +152,7 @@ class SyncerTest : public testing::Test, void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { // 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 (syncer::ModelTypeSet::Iterator it = enabled_datatypes_.First(); + for (ModelTypeSet::Iterator it = enabled_datatypes_.First(); it.Good(); it.Inc()) { (*out)[it.Get()] = GROUP_PASSIVE; } @@ -177,7 +177,7 @@ class SyncerTest : public testing::Test, std::vector<ModelSafeWorker*> workers; GetModelSafeRoutingInfo(&info); GetWorkers(&workers); - syncer::ModelTypePayloadMap types = + ModelTypePayloadMap types = ModelSafeRoutingInfoToPayloadMap(info, std::string()); return new SyncSession(context_.get(), this, sessions::SyncSourceInfo(sync_pb::GetUpdatesCallerInfo::UNKNOWN, types), @@ -218,10 +218,10 @@ class SyncerTest : public testing::Test, virtual void SetUp() { dir_maker_.SetUp(); mock_server_.reset(new MockConnectionManager(directory())); - EnableDatatype(syncer::BOOKMARKS); - EnableDatatype(syncer::NIGORI); - EnableDatatype(syncer::PREFERENCES); - EnableDatatype(syncer::NIGORI); + EnableDatatype(BOOKMARKS); + EnableDatatype(NIGORI); + EnableDatatype(PREFERENCES); + EnableDatatype(NIGORI); worker_ = new FakeModelWorker(GROUP_PASSIVE); std::vector<SyncEngineEventListener*> listeners; listeners.push_back(this); @@ -280,7 +280,7 @@ class SyncerTest : public testing::Test, EXPECT_EQ("http://demo/", specifics.bookmark().url()); } - bool initial_sync_ended_for_type(syncer::ModelType type) { + bool initial_sync_ended_for_type(ModelType type) { return directory()->initial_sync_ended_for_type(type); } @@ -297,13 +297,13 @@ class SyncerTest : public testing::Test, } sync_pb::EntitySpecifics DefaultBookmarkSpecifics() { sync_pb::EntitySpecifics result; - AddDefaultFieldValue(syncer::BOOKMARKS, &result); + AddDefaultFieldValue(BOOKMARKS, &result); return result; } sync_pb::EntitySpecifics DefaultPreferencesSpecifics() { sync_pb::EntitySpecifics result; - AddDefaultFieldValue(syncer::PREFERENCES, &result); + AddDefaultFieldValue(PREFERENCES, &result); return result; } // Enumeration of alterations to entries for commit ordering tests. @@ -406,8 +406,8 @@ class SyncerTest : public testing::Test, sessions::OrderedCommitSet output_set(routes); GetCommitIdsCommand command(limit, &output_set); std::set<int64> ready_unsynced_set; - command.FilterUnreadyEntries(&wtrans, syncer::ModelTypeSet(), - syncer::ModelTypeSet(), false, + command.FilterUnreadyEntries(&wtrans, ModelTypeSet(), + ModelTypeSet(), false, unsynced_handle_view, &ready_unsynced_set); command.BuildCommitIds(session_->write_transaction(), routes, ready_unsynced_set); @@ -458,7 +458,7 @@ class SyncerTest : public testing::Test, return entry.Get(META_HANDLE); } - void EnableDatatype(syncer::ModelType model_type) { + void EnableDatatype(ModelType model_type) { enabled_datatypes_.Put(model_type); ModelSafeRoutingInfo routing_info; @@ -471,7 +471,7 @@ class SyncerTest : public testing::Test, mock_server_->ExpectGetUpdatesRequestTypes(enabled_datatypes_); } - void DisableDatatype(syncer::ModelType model_type) { + void DisableDatatype(ModelType model_type) { enabled_datatypes_.Remove(model_type); ModelSafeRoutingInfo routing_info; @@ -559,8 +559,8 @@ class SyncerTest : public testing::Test, base::TimeDelta last_sessions_commit_delay_seconds_; scoped_refptr<ModelSafeWorker> worker_; - syncer::ModelTypeSet enabled_datatypes_; - syncer::TrafficRecorder traffic_recorder_; + ModelTypeSet enabled_datatypes_; + TrafficRecorder traffic_recorder_; DISALLOW_COPY_AND_ASSIGN(SyncerTest); }; @@ -633,9 +633,9 @@ TEST_F(SyncerTest, GetCommitIdsCommandTruncates) { } TEST_F(SyncerTest, GetCommitIdsFiltersThrottledEntries) { - const syncer::ModelTypeSet throttled_types(syncer::BOOKMARKS); + const ModelTypeSet throttled_types(BOOKMARKS); sync_pb::EntitySpecifics bookmark_data; - AddDefaultFieldValue(syncer::BOOKMARKS, &bookmark_data); + AddDefaultFieldValue(BOOKMARKS, &bookmark_data); mock_server_->AddUpdateDirectory(1, 0, "A", 10, 10); SyncShareNudge(); @@ -688,7 +688,7 @@ TEST_F(SyncerTest, GetCommitIdsFiltersThrottledEntries) { EXPECT_TRUE(is_unsynced == entryA.Get(IS_UNSYNCED)); \ EXPECT_TRUE(is_unapplied == entryA.Get(IS_UNAPPLIED_UPDATE)); \ EXPECT_TRUE(prev_initialized == \ - syncer::IsRealDataType(syncer::GetModelTypeFromSpecifics( \ + IsRealDataType(GetModelTypeFromSpecifics( \ entryA.Get(BASE_SERVER_SPECIFICS)))); \ EXPECT_TRUE(parent_id == -1 || \ entryA.Get(PARENT_ID) == id_fac.FromNumber(parent_id)); \ @@ -702,7 +702,7 @@ TEST_F(SyncerTest, GetCommitIdsFiltersUnreadyEntries) { sync_pb::EntitySpecifics bookmark, encrypted_bookmark; bookmark.mutable_bookmark()->set_url("url"); bookmark.mutable_bookmark()->set_title("title"); - AddDefaultFieldValue(syncer::BOOKMARKS, &encrypted_bookmark); + AddDefaultFieldValue(BOOKMARKS, &encrypted_bookmark); mock_server_->AddUpdateDirectory(1, 0, "A", 10, 10); mock_server_->AddUpdateDirectory(2, 0, "B", 10, 10); mock_server_->AddUpdateDirectory(3, 0, "C", 10, 10); @@ -714,7 +714,7 @@ TEST_F(SyncerTest, GetCommitIdsFiltersUnreadyEntries) { // Mark bookmarks as encrypted and set the cryptographer to have pending // keys. WriteTransaction wtrans(FROM_HERE, UNITTEST, directory()); - syncer::Cryptographer other_cryptographer(&encryptor_); + Cryptographer other_cryptographer(&encryptor_); other_cryptographer.AddKey(other_params); sync_pb::EntitySpecifics specifics; sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori(); @@ -807,19 +807,19 @@ TEST_F(SyncerTest, GetCommitIdsFiltersUnreadyEntries) { TEST_F(SyncerTest, EncryptionAwareConflicts) { KeyParams key_params = {"localhost", "dummy", "foobar"}; - syncer::Cryptographer other_cryptographer(&encryptor_); + Cryptographer other_cryptographer(&encryptor_); other_cryptographer.AddKey(key_params); sync_pb::EntitySpecifics bookmark, encrypted_bookmark, modified_bookmark; bookmark.mutable_bookmark()->set_title("title"); other_cryptographer.Encrypt(bookmark, encrypted_bookmark.mutable_encrypted()); - AddDefaultFieldValue(syncer::BOOKMARKS, &encrypted_bookmark); + AddDefaultFieldValue(BOOKMARKS, &encrypted_bookmark); modified_bookmark.mutable_bookmark()->set_title("title2"); other_cryptographer.Encrypt(modified_bookmark, modified_bookmark.mutable_encrypted()); sync_pb::EntitySpecifics pref, encrypted_pref, modified_pref; pref.mutable_preference()->set_name("name"); - AddDefaultFieldValue(syncer::PREFERENCES, &encrypted_pref); + AddDefaultFieldValue(PREFERENCES, &encrypted_pref); other_cryptographer.Encrypt(pref, encrypted_pref.mutable_encrypted()); modified_pref.mutable_preference()->set_name("name2"); @@ -981,7 +981,7 @@ TEST_F(SyncerTest, ReceiveOldNigori) { KeyParams current_key = {"localhost", "dummy", "cur"}; // Data for testing encryption/decryption. - syncer::Cryptographer other_cryptographer(&encryptor_); + Cryptographer other_cryptographer(&encryptor_); other_cryptographer.AddKey(old_key); sync_pb::EntitySpecifics other_encrypted_specifics; other_encrypted_specifics.mutable_bookmark()->set_title("title"); @@ -990,7 +990,7 @@ TEST_F(SyncerTest, ReceiveOldNigori) { other_encrypted_specifics.mutable_encrypted()); sync_pb::EntitySpecifics our_encrypted_specifics; our_encrypted_specifics.mutable_bookmark()->set_title("title2"); - syncer::ModelTypeSet encrypted_types = syncer::ModelTypeSet::All(); + ModelTypeSet encrypted_types = ModelTypeSet::All(); // Receive the initial nigori node. @@ -1015,7 +1015,7 @@ TEST_F(SyncerTest, ReceiveOldNigori) { cryptographer(&wtrans)->set_encrypt_everything(); cryptographer(&wtrans)->UpdateNigoriFromEncryptedTypes(nigori); MutableEntry nigori_entry(&wtrans, GET_BY_SERVER_TAG, - syncer::ModelTypeToRootTag(syncer::NIGORI)); + ModelTypeToRootTag(NIGORI)); ASSERT_TRUE(nigori_entry.good()); nigori_entry.Put(SPECIFICS, specifics); nigori_entry.Put(IS_UNSYNCED, true); @@ -1041,7 +1041,7 @@ TEST_F(SyncerTest, ReceiveOldNigori) { // the newest, and the encrypted types should be the most recent syncable::ReadTransaction trans(FROM_HERE, directory()); Entry nigori_entry(&trans, GET_BY_SERVER_TAG, - syncer::ModelTypeToRootTag(syncer::NIGORI)); + ModelTypeToRootTag(NIGORI)); ASSERT_TRUE(nigori_entry.good()); EXPECT_FALSE(nigori_entry.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(nigori_entry.Get(IS_UNSYNCED)); @@ -1064,9 +1064,9 @@ TEST_F(SyncerTest, ReceiveOldNigori) { TEST_F(SyncerTest, NigoriConflicts) { KeyParams local_key_params = {"localhost", "dummy", "blargle"}; KeyParams other_key_params = {"localhost", "dummy", "foobar"}; - syncer::Cryptographer other_cryptographer(&encryptor_); + Cryptographer other_cryptographer(&encryptor_); other_cryptographer.AddKey(other_key_params); - syncer::ModelTypeSet encrypted_types(syncer::PASSWORDS, syncer::NIGORI); + ModelTypeSet encrypted_types(PASSWORDS, NIGORI); sync_pb::EntitySpecifics initial_nigori_specifics; initial_nigori_specifics.mutable_nigori(); mock_server_->SetNigori(1, 10, 10, initial_nigori_specifics); @@ -1082,7 +1082,7 @@ TEST_F(SyncerTest, NigoriConflicts) { // Receive the initial nigori node. SyncShareNudge(); - encrypted_types = syncer::ModelTypeSet::All(); + encrypted_types = ModelTypeSet::All(); { // Local changes with different passphrase, different types. WriteTransaction wtrans(FROM_HERE, UNITTEST, directory()); @@ -1097,7 +1097,7 @@ TEST_F(SyncerTest, NigoriConflicts) { cryptographer(&wtrans)->UpdateNigoriFromEncryptedTypes(nigori); cryptographer(&wtrans)->set_encrypt_everything(); MutableEntry nigori_entry(&wtrans, GET_BY_SERVER_TAG, - syncer::ModelTypeToRootTag(syncer::NIGORI)); + ModelTypeToRootTag(NIGORI)); ASSERT_TRUE(nigori_entry.good()); nigori_entry.Put(SPECIFICS, specifics); nigori_entry.Put(IS_UNSYNCED, true); @@ -1127,7 +1127,7 @@ TEST_F(SyncerTest, NigoriConflicts) { // Ensure the nigori data merged (encrypted types). WriteTransaction wtrans(FROM_HERE, UNITTEST, directory()); MutableEntry nigori_entry(&wtrans, GET_BY_SERVER_TAG, - syncer::ModelTypeToRootTag(syncer::NIGORI)); + ModelTypeToRootTag(NIGORI)); ASSERT_TRUE(nigori_entry.good()); EXPECT_FALSE(nigori_entry.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(nigori_entry.Get(IS_UNSYNCED)); @@ -1158,7 +1158,7 @@ TEST_F(SyncerTest, NigoriConflicts) { // should have been unioned. WriteTransaction wtrans(FROM_HERE, UNITTEST, directory()); MutableEntry nigori_entry(&wtrans, GET_BY_SERVER_TAG, - syncer::ModelTypeToRootTag(syncer::NIGORI)); + ModelTypeToRootTag(NIGORI)); ASSERT_TRUE(nigori_entry.good()); EXPECT_FALSE(nigori_entry.Get(IS_UNAPPLIED_UPDATE)); EXPECT_FALSE(nigori_entry.Get(IS_UNSYNCED)); @@ -1233,8 +1233,7 @@ TEST_F(SyncerTest, TestPurgeWhileUnsynced) { parent2.Put(syncable::ID, pref_node_id); } - directory()->PurgeEntriesWithTypeIn( - syncer::ModelTypeSet(syncer::PREFERENCES)); + directory()->PurgeEntriesWithTypeIn(ModelTypeSet(PREFERENCES)); SyncShareNudge(); ASSERT_EQ(2U, mock_server_->committed_ids().size()); @@ -1269,7 +1268,7 @@ TEST_F(SyncerTest, TestPurgeWhileUnapplied) { } directory()->PurgeEntriesWithTypeIn( - syncer::ModelTypeSet(syncer::BOOKMARKS)); + ModelTypeSet(BOOKMARKS)); SyncShareNudge(); directory()->SaveChanges(); @@ -2464,7 +2463,7 @@ TEST_F(SyncerTest, CommitsUpdateDoesntAlterEntry) { } TEST_F(SyncerTest, ParentAndChildBothMatch) { - const syncer::FullModelTypeSet all_types = syncer::FullModelTypeSet::All(); + const FullModelTypeSet all_types = FullModelTypeSet::All(); syncable::Id parent_id = ids_.NewServerId(); syncable::Id child_id = ids_.NewServerId(); @@ -4018,28 +4017,28 @@ TEST_F(SyncerTest, GetUpdatesSetsRequestedTypes) { // The expectations of this test happen in the MockConnectionManager's // GetUpdates handler. EnableDatatype sets the expectation value from our // set of enabled/disabled datatypes. - EnableDatatype(syncer::BOOKMARKS); + EnableDatatype(BOOKMARKS); SyncShareNudge(); EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); - EnableDatatype(syncer::AUTOFILL); + EnableDatatype(AUTOFILL); SyncShareNudge(); EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); - EnableDatatype(syncer::PREFERENCES); + EnableDatatype(PREFERENCES); SyncShareNudge(); EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); - DisableDatatype(syncer::BOOKMARKS); + DisableDatatype(BOOKMARKS); SyncShareNudge(); EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); - DisableDatatype(syncer::AUTOFILL); + DisableDatatype(AUTOFILL); SyncShareNudge(); EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); - DisableDatatype(syncer::PREFERENCES); - EnableDatatype(syncer::AUTOFILL); + DisableDatatype(PREFERENCES); + EnableDatatype(AUTOFILL); SyncShareNudge(); EXPECT_EQ(1, mock_server_->GetAndClearNumGetUpdatesRequests()); } @@ -4098,7 +4097,7 @@ TEST_F(SyncerTest, UpdateFailsThenDontCommit) { // Downloads two updates and applies them successfully. // This is the "happy path" alternative to ConfigureFailsDontApplyUpdates. TEST_F(SyncerTest, ConfigureDownloadsTwoBatchesSuccess) { - EXPECT_FALSE(initial_sync_ended_for_type(syncer::BOOKMARKS)); + EXPECT_FALSE(initial_sync_ended_for_type(BOOKMARKS)); syncable::Id node1 = ids_.NewServerId(); syncable::Id node2 = ids_.NewServerId(); @@ -4124,12 +4123,12 @@ TEST_F(SyncerTest, ConfigureDownloadsTwoBatchesSuccess) { ASSERT_TRUE(n2.good()); EXPECT_FALSE(n2.Get(IS_UNAPPLIED_UPDATE)); - EXPECT_TRUE(initial_sync_ended_for_type(syncer::BOOKMARKS)); + EXPECT_TRUE(initial_sync_ended_for_type(BOOKMARKS)); } // Same as the above case, but this time the second batch fails to download. TEST_F(SyncerTest, ConfigureFailsDontApplyUpdates) { - EXPECT_FALSE(initial_sync_ended_for_type(syncer::BOOKMARKS)); + EXPECT_FALSE(initial_sync_ended_for_type(BOOKMARKS)); syncable::Id node1 = ids_.NewServerId(); syncable::Id node2 = ids_.NewServerId(); @@ -4164,7 +4163,7 @@ TEST_F(SyncerTest, ConfigureFailsDontApplyUpdates) { // One update remains undownloaded. mock_server_->ClearUpdatesQueue(); - EXPECT_FALSE(initial_sync_ended_for_type(syncer::BOOKMARKS)); + EXPECT_FALSE(initial_sync_ended_for_type(BOOKMARKS)); } // Test what happens if a client deletes, then recreates, an object very diff --git a/sync/engine/syncer_util.cc b/sync/engine/syncer_util.cc index 51f46a0..fedf4d8 100644 --- a/sync/engine/syncer_util.cc +++ b/sync/engine/syncer_util.cc @@ -251,7 +251,7 @@ UpdateAttemptResponse AttemptToUpdateEntry( !cryptographer->CanDecrypt(specifics.encrypted())) { // We can't decrypt this node yet. DVLOG(1) << "Received an undecryptable " - << syncer::ModelTypeToString(entry->GetServerModelType()) + << ModelTypeToString(entry->GetServerModelType()) << " update, returning encryption_conflict."; return CONFLICT_ENCRYPTION; } else if (specifics.has_password() && @@ -303,11 +303,11 @@ UpdateAttemptResponse AttemptToUpdateEntry( if (specifics.has_encrypted()) { DVLOG(2) << "Received a decryptable " - << syncer::ModelTypeToString(entry->GetServerModelType()) + << ModelTypeToString(entry->GetServerModelType()) << " update, applying normally."; } else { DVLOG(2) << "Received an unencrypted " - << syncer::ModelTypeToString(entry->GetServerModelType()) + << ModelTypeToString(entry->GetServerModelType()) << " update, applying normally."; } @@ -596,7 +596,7 @@ VerifyResult VerifyUpdateConsistency( syncable::MutableEntry* target, const bool deleted, const bool is_directory, - syncer::ModelType model_type) { + ModelType model_type) { CHECK(target->good()); const syncable::Id& update_id = SyncableIdFromProto(update.id_string()); @@ -605,7 +605,7 @@ VerifyResult VerifyUpdateConsistency( if (deleted) return VERIFY_SUCCESS; - if (model_type == syncer::UNSPECIFIED) { + if (model_type == UNSPECIFIED) { // This update is to an item of a datatype we don't recognize. The server // shouldn't have sent it to us. Throw it on the ground. return VERIFY_SKIP; diff --git a/sync/engine/syncer_util.h b/sync/engine/syncer_util.h index ad70f40..e15c16d 100644 --- a/sync/engine/syncer_util.h +++ b/sync/engine/syncer_util.h @@ -76,7 +76,7 @@ VerifyResult VerifyUpdateConsistency(syncable::WriteTransaction* trans, syncable::MutableEntry* target, const bool deleted, const bool is_directory, - syncer::ModelType model_type); + ModelType model_type); // Assumes we have an existing entry; verify an update that seems to be // expressing an 'undelete' diff --git a/sync/engine/throttled_data_type_tracker.cc b/sync/engine/throttled_data_type_tracker.cc index 42d1246..9cb2461 100644 --- a/sync/engine/throttled_data_type_tracker.cc +++ b/sync/engine/throttled_data_type_tracker.cc @@ -12,16 +12,15 @@ namespace syncer { ThrottledDataTypeTracker::ThrottledDataTypeTracker(AllStatus *allstatus) : allstatus_(allstatus) { if (allstatus_) { - allstatus_->SetThrottledTypes(syncer::ModelTypeSet()); + allstatus_->SetThrottledTypes(ModelTypeSet()); } } ThrottledDataTypeTracker::~ThrottledDataTypeTracker() { } -void ThrottledDataTypeTracker::SetUnthrottleTime(syncer::ModelTypeSet types, +void ThrottledDataTypeTracker::SetUnthrottleTime(ModelTypeSet types, const base::TimeTicks& time) { - for (syncer::ModelTypeSet::Iterator it = types.First(); - it.Good(); it.Inc()) { + for (ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) { unthrottle_times_[it.Get()] = time; } @@ -60,8 +59,8 @@ void ThrottledDataTypeTracker::PruneUnthrottledTypes( } } -syncer::ModelTypeSet ThrottledDataTypeTracker::GetThrottledTypes() const { - syncer::ModelTypeSet types; +ModelTypeSet ThrottledDataTypeTracker::GetThrottledTypes() const { + ModelTypeSet types; for (UnthrottleTimes::const_iterator it = unthrottle_times_.begin(); it != unthrottle_times_.end(); ++it) { types.Put(it->first); diff --git a/sync/engine/throttled_data_type_tracker.h b/sync/engine/throttled_data_type_tracker.h index 8db5061..e2a40bf 100644 --- a/sync/engine/throttled_data_type_tracker.h +++ b/sync/engine/throttled_data_type_tracker.h @@ -22,15 +22,14 @@ class ThrottledDataTypeTracker { ~ThrottledDataTypeTracker(); // Throttles a set of data types until the specified time is reached. - void SetUnthrottleTime(syncer::ModelTypeSet types, - const base::TimeTicks& time); + void SetUnthrottleTime(ModelTypeSet types, const base::TimeTicks& time); // Given an input of the current time (usually from time::Now()), removes from // the set of throttled types any types whose throttling period has expired. void PruneUnthrottledTypes(const base::TimeTicks& time); // Returns the set of types which are currently throttled. - syncer::ModelTypeSet GetThrottledTypes() const; + ModelTypeSet GetThrottledTypes() const; private: FRIEND_TEST_ALL_PREFIXES(ThrottledDataTypeTrackerTest, @@ -38,7 +37,7 @@ class ThrottledDataTypeTracker { FRIEND_TEST_ALL_PREFIXES(ThrottledDataTypeTrackerTest, GetCurrentlyThrottledTypesTest); - typedef std::map<syncer::ModelType, base::TimeTicks> UnthrottleTimes; + typedef std::map<ModelType, base::TimeTicks> UnthrottleTimes; // This is a map from throttled data types to the time at which they can be // unthrottled. diff --git a/sync/engine/throttled_data_type_tracker_unittest.cc b/sync/engine/throttled_data_type_tracker_unittest.cc index 011fdff..a2d894f 100644 --- a/sync/engine/throttled_data_type_tracker_unittest.cc +++ b/sync/engine/throttled_data_type_tracker_unittest.cc @@ -13,19 +13,19 @@ using base::TimeTicks; namespace syncer { TEST(ThrottledDataTypeTrackerTest, AddUnthrottleTimeTest) { - const syncer::ModelTypeSet types(syncer::BOOKMARKS, syncer::PASSWORDS); + const ModelTypeSet types(BOOKMARKS, PASSWORDS); ThrottledDataTypeTracker throttler(NULL); TimeTicks now = TimeTicks::Now(); throttler.SetUnthrottleTime(types, now); EXPECT_EQ(throttler.unthrottle_times_.size(), 2U); - EXPECT_EQ(throttler.unthrottle_times_[syncer::BOOKMARKS], now); - EXPECT_EQ(throttler.unthrottle_times_[syncer::PASSWORDS], now); + EXPECT_EQ(throttler.unthrottle_times_[BOOKMARKS], now); + EXPECT_EQ(throttler.unthrottle_times_[PASSWORDS], now); } TEST(ThrottledDataTypeTrackerTest, GetCurrentlyThrottledTypesTest) { - const syncer::ModelTypeSet types(syncer::BOOKMARKS, syncer::PASSWORDS); + const ModelTypeSet types(BOOKMARKS, PASSWORDS); ThrottledDataTypeTracker throttler(NULL); TimeTicks now = TimeTicks::Now(); @@ -44,8 +44,8 @@ TEST(ThrottledDataTypeTrackerTest, GetCurrentlyThrottledTypesTest) { // Have two data types whose throttling is set to expire at different times. TEST(ThrottledDataTypeTrackerTest, UnthrottleSomeTypesTest) { - const syncer::ModelTypeSet long_throttled(syncer::BOOKMARKS); - const syncer::ModelTypeSet short_throttled(syncer::PASSWORDS); + const ModelTypeSet long_throttled(BOOKMARKS); + const ModelTypeSet short_throttled(PASSWORDS); const TimeTicks start_time = TimeTicks::Now(); const TimeTicks short_throttle_time = start_time + TimeDelta::FromSeconds(1); diff --git a/sync/engine/update_applicator.cc b/sync/engine/update_applicator.cc index 03ae08d..c5a80c6 100644 --- a/sync/engine/update_applicator.cc +++ b/sync/engine/update_applicator.cc @@ -101,7 +101,7 @@ void UpdateApplicator::Advance() { } bool UpdateApplicator::SkipUpdate(const syncable::Entry& entry) { - syncer::ModelType type = entry.GetServerModelType(); + ModelType type = entry.GetServerModelType(); ModelSafeGroup g = GetGroupForModelType(type, routing_info_); // The set of updates passed to the UpdateApplicator should already // be group-filtered. @@ -111,8 +111,8 @@ bool UpdateApplicator::SkipUpdate(const syncable::Entry& entry) { } if (g == GROUP_PASSIVE && !routing_info_.count(type) && - type != syncer::UNSPECIFIED && - type != syncer::TOP_LEVEL_FOLDER) { + type != UNSPECIFIED && + type != TOP_LEVEL_FOLDER) { DVLOG(1) << "Skipping update application, type not permitted."; return true; } diff --git a/sync/engine/verify_updates_command.cc b/sync/engine/verify_updates_command.cc index e105ec8..4b4a85a 100644 --- a/sync/engine/verify_updates_command.cc +++ b/sync/engine/verify_updates_command.cc @@ -22,7 +22,6 @@ namespace syncer { using syncable::GET_BY_ID; -using syncer::ModelTypeSet; using syncable::SYNCER; using syncable::WriteTransaction; @@ -86,7 +85,7 @@ std::set<ModelSafeGroup> VerifyUpdatesCommand::GetGroupsToChange( session.status_controller().updates_response().get_updates(); for (int i = 0; i < updates.entries().size(); i++) { groups_with_updates.insert( - GetGroupForModelType(syncer::GetModelType(updates.entries(i)), + GetGroupForModelType(GetModelType(updates.entries(i)), session.routing_info())); } @@ -103,7 +102,7 @@ SyncerError VerifyUpdatesCommand::ModelChangingExecuteImpl( status->updates_response().get_updates(); int update_count = updates.entries().size(); - ModelTypeSet requested_types = syncer::GetRoutingInfoTypes( + ModelTypeSet requested_types = GetRoutingInfoTypes( session->routing_info()); DVLOG(1) << update_count << " entries to verify"; @@ -137,7 +136,7 @@ VerifyUpdatesCommand::VerifyUpdateResult VerifyUpdatesCommand::VerifyUpdate( const bool deleted = entry.has_deleted() && entry.deleted(); const bool is_directory = IsFolder(entry); - const syncer::ModelType model_type = GetModelType(entry); + const ModelType model_type = GetModelType(entry); if (!id.ServerKnows()) { LOG(ERROR) << "Illegal negative id in received updates"; @@ -154,8 +153,8 @@ VerifyUpdatesCommand::VerifyUpdateResult VerifyUpdatesCommand::VerifyUpdate( syncable::MutableEntry same_id(trans, GET_BY_ID, id); result.value = VerifyNewEntry(entry, &same_id, deleted); - syncer::ModelType placement_type = !deleted ? GetModelType(entry) - : same_id.good() ? same_id.GetModelType() : syncer::UNSPECIFIED; + ModelType placement_type = !deleted ? GetModelType(entry) + : same_id.good() ? same_id.GetModelType() : UNSPECIFIED; result.placement = GetGroupForModelType(placement_type, routes); if (VERIFY_UNDECIDED == result.value) { diff --git a/sync/engine/verify_updates_command.h b/sync/engine/verify_updates_command.h index 2e7adf8d..06e7230 100644 --- a/sync/engine/verify_updates_command.h +++ b/sync/engine/verify_updates_command.h @@ -38,7 +38,7 @@ class VerifyUpdatesCommand : public ModelChangingSyncerCommand { }; VerifyUpdateResult VerifyUpdate(syncable::WriteTransaction* trans, const sync_pb::SyncEntity& entry, - const syncer::ModelTypeSet& requested_types, + const ModelTypeSet& requested_types, const ModelSafeRoutingInfo& routes); DISALLOW_COPY_AND_ASSIGN(VerifyUpdatesCommand); }; diff --git a/sync/engine/verify_updates_command_unittest.cc b/sync/engine/verify_updates_command_unittest.cc index 3375af8..c0ea363 100644 --- a/sync/engine/verify_updates_command_unittest.cc +++ b/sync/engine/verify_updates_command_unittest.cc @@ -29,15 +29,15 @@ class VerifyUpdatesCommandTest : public SyncerCommandTest { mutable_routing_info()->clear(); workers()->push_back(make_scoped_refptr(new FakeModelWorker(GROUP_DB))); workers()->push_back(make_scoped_refptr(new FakeModelWorker(GROUP_UI))); - (*mutable_routing_info())[syncer::PREFERENCES] = GROUP_UI; - (*mutable_routing_info())[syncer::BOOKMARKS] = GROUP_UI; - (*mutable_routing_info())[syncer::AUTOFILL] = GROUP_DB; + (*mutable_routing_info())[PREFERENCES] = GROUP_UI; + (*mutable_routing_info())[BOOKMARKS] = GROUP_UI; + (*mutable_routing_info())[AUTOFILL] = GROUP_DB; SyncerCommandTest::SetUp(); } void CreateLocalItem(const std::string& item_id, const std::string& parent_id, - const syncer::ModelType& type) { + const ModelType& type) { WriteTransaction trans(FROM_HERE, UNITTEST, directory()); MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, Id::CreateFromServerId(item_id)); @@ -54,7 +54,7 @@ class VerifyUpdatesCommandTest : public SyncerCommandTest { void AddUpdate(sync_pb::GetUpdatesResponse* updates, const std::string& id, const std::string& parent, - const syncer::ModelType& type) { + const ModelType& type) { sync_pb::SyncEntity* e = updates->add_entries(); e->set_id_string("b1"); e->set_parent_id_string(parent); @@ -70,20 +70,20 @@ class VerifyUpdatesCommandTest : public SyncerCommandTest { TEST_F(VerifyUpdatesCommandTest, AllVerified) { string root = syncable::GetNullId().GetServerId(); - CreateLocalItem("b1", root, syncer::BOOKMARKS); - CreateLocalItem("b2", root, syncer::BOOKMARKS); - CreateLocalItem("p1", root, syncer::PREFERENCES); - CreateLocalItem("a1", root, syncer::AUTOFILL); + CreateLocalItem("b1", root, BOOKMARKS); + CreateLocalItem("b2", root, BOOKMARKS); + CreateLocalItem("p1", root, PREFERENCES); + CreateLocalItem("a1", root, AUTOFILL); ExpectNoGroupsToChange(command_); sync_pb::GetUpdatesResponse* updates = session()->mutable_status_controller()-> mutable_updates_response()->mutable_get_updates(); - AddUpdate(updates, "b1", root, syncer::BOOKMARKS); - AddUpdate(updates, "b2", root, syncer::BOOKMARKS); - AddUpdate(updates, "p1", root, syncer::PREFERENCES); - AddUpdate(updates, "a1", root, syncer::AUTOFILL); + AddUpdate(updates, "b1", root, BOOKMARKS); + AddUpdate(updates, "b2", root, BOOKMARKS); + AddUpdate(updates, "p1", root, PREFERENCES); + AddUpdate(updates, "a1", root, AUTOFILL); ExpectGroupsToChange(command_, GROUP_UI, GROUP_DB); diff --git a/sync/internal_api/base_node.cc b/sync/internal_api/base_node.cc index fc0dfb2..9595d29 100644 --- a/sync/internal_api/base_node.cc +++ b/sync/internal_api/base_node.cc @@ -64,11 +64,11 @@ BaseNode::BaseNode() : password_data_(new sync_pb::PasswordSpecificsData) {} BaseNode::~BaseNode() {} std::string BaseNode::GenerateSyncableHash( - syncer::ModelType model_type, const std::string& client_tag) { + ModelType model_type, const std::string& client_tag) { // Blank PB with just the field in it has termination symbol, // handy for delimiter. sync_pb::EntitySpecifics serialized_type; - syncer::AddDefaultFieldValue(model_type, &serialized_type); + AddDefaultFieldValue(model_type, &serialized_type); std::string hash_input; serialized_type.AppendToString(&hash_input); hash_input.append(client_tag); @@ -101,7 +101,7 @@ bool BaseNode::DecryptIfNecessary() { // we fill the unencrypted_data_ with a copy of the bookmark specifics that // follows the new bookmarks format. if (!specifics.has_encrypted()) { - if (GetModelType() == syncer::BOOKMARKS && + if (GetModelType() == BOOKMARKS && !specifics.bookmark().has_title() && !GetTitle().empty()) { // Last check ensures this isn't a new node. // We need to fill in the title. @@ -121,8 +121,8 @@ bool BaseNode::DecryptIfNecessary() { std::string plaintext_data = GetTransaction()->GetCryptographer()-> DecryptToString(encrypted); if (plaintext_data.length() == 0) { - LOG(ERROR) << "Failed to decrypt encrypted node of type " << - syncer::ModelTypeToString(GetModelType()) << "."; + LOG(ERROR) << "Failed to decrypt encrypted node of type " + << ModelTypeToString(GetModelType()) << "."; // Debugging for crbug.com/123223. We failed to decrypt the data, which // means we applied an update without having the key or lost the key at a // later point. @@ -135,7 +135,7 @@ bool BaseNode::DecryptIfNecessary() { return false; } DVLOG(2) << "Decrypted specifics of type " - << syncer::ModelTypeToString(GetModelType()) + << ModelTypeToString(GetModelType()) << " with content: " << plaintext_data; return true; } @@ -144,15 +144,14 @@ const sync_pb::EntitySpecifics& BaseNode::GetUnencryptedSpecifics( const syncable::Entry* entry) const { const sync_pb::EntitySpecifics& specifics = entry->Get(SPECIFICS); if (specifics.has_encrypted()) { - DCHECK_NE(syncer::GetModelTypeFromSpecifics(unencrypted_data_), - syncer::UNSPECIFIED); + DCHECK_NE(GetModelTypeFromSpecifics(unencrypted_data_), UNSPECIFIED); return unencrypted_data_; } else { // Due to the change in bookmarks format, we need to check to see if this is // a legacy bookmarks (and has no title field in the proto). If it is, we // return the unencrypted_data_, which was filled in with the title by // DecryptIfNecessary(). - if (GetModelType() == syncer::BOOKMARKS) { + if (GetModelType() == BOOKMARKS) { const sync_pb::BookmarkSpecifics& bookmark_specifics = specifics.bookmark(); if (bookmark_specifics.has_title() || @@ -163,13 +162,11 @@ const sync_pb::EntitySpecifics& BaseNode::GetUnencryptedSpecifics( // |unencrypted_data_| to be non-empty. return specifics; } else { - DCHECK_EQ(syncer::GetModelTypeFromSpecifics(unencrypted_data_), - syncer::BOOKMARKS); + DCHECK_EQ(GetModelTypeFromSpecifics(unencrypted_data_), BOOKMARKS); return unencrypted_data_; } } else { - DCHECK_EQ(syncer::GetModelTypeFromSpecifics(unencrypted_data_), - syncer::UNSPECIFIED); + DCHECK_EQ(GetModelTypeFromSpecifics(unencrypted_data_), UNSPECIFIED); return specifics; } } @@ -195,7 +192,7 @@ bool BaseNode::GetIsFolder() const { std::string BaseNode::GetTitle() const { std::string result; // TODO(zea): refactor bookmarks to not need this functionality. - if (syncer::BOOKMARKS == GetModelType() && + if (BOOKMARKS == GetModelType() && GetEntry()->Get(syncable::SPECIFICS).has_encrypted()) { // Special case for legacy bookmarks dealing with encryption. ServerNameToSyncAPIName(GetBookmarkSpecifics().title(), &result); @@ -256,7 +253,7 @@ DictionaryValue* BaseNode::GetDetailsAsValue() const { DictionaryValue* node_info = GetSummaryAsValue(); node_info->SetString( "modificationTime", - syncer::GetTimeDebugString(GetModificationTime())); + GetTimeDebugString(GetModificationTime())); node_info->SetString("parentId", base::Int64ToString(GetParentId())); // Specifics are already in the Entry value, so no need to duplicate // it here. @@ -286,52 +283,52 @@ int64 BaseNode::GetExternalId() const { } const sync_pb::AppSpecifics& BaseNode::GetAppSpecifics() const { - DCHECK_EQ(syncer::APPS, GetModelType()); + DCHECK_EQ(GetModelType(), APPS); return GetEntitySpecifics().app(); } const sync_pb::AutofillSpecifics& BaseNode::GetAutofillSpecifics() const { - DCHECK_EQ(syncer::AUTOFILL, GetModelType()); + DCHECK_EQ(GetModelType(), AUTOFILL); return GetEntitySpecifics().autofill(); } const AutofillProfileSpecifics& BaseNode::GetAutofillProfileSpecifics() const { - DCHECK_EQ(GetModelType(), syncer::AUTOFILL_PROFILE); + DCHECK_EQ(GetModelType(), AUTOFILL_PROFILE); return GetEntitySpecifics().autofill_profile(); } const sync_pb::BookmarkSpecifics& BaseNode::GetBookmarkSpecifics() const { - DCHECK_EQ(syncer::BOOKMARKS, GetModelType()); + DCHECK_EQ(GetModelType(), BOOKMARKS); return GetEntitySpecifics().bookmark(); } const sync_pb::NigoriSpecifics& BaseNode::GetNigoriSpecifics() const { - DCHECK_EQ(syncer::NIGORI, GetModelType()); + DCHECK_EQ(GetModelType(), NIGORI); return GetEntitySpecifics().nigori(); } const sync_pb::PasswordSpecificsData& BaseNode::GetPasswordSpecifics() const { - DCHECK_EQ(syncer::PASSWORDS, GetModelType()); + DCHECK_EQ(GetModelType(), PASSWORDS); return *password_data_; } const sync_pb::ThemeSpecifics& BaseNode::GetThemeSpecifics() const { - DCHECK_EQ(syncer::THEMES, GetModelType()); + DCHECK_EQ(GetModelType(), THEMES); return GetEntitySpecifics().theme(); } const sync_pb::TypedUrlSpecifics& BaseNode::GetTypedUrlSpecifics() const { - DCHECK_EQ(syncer::TYPED_URLS, GetModelType()); + DCHECK_EQ(GetModelType(), TYPED_URLS); return GetEntitySpecifics().typed_url(); } const sync_pb::ExtensionSpecifics& BaseNode::GetExtensionSpecifics() const { - DCHECK_EQ(syncer::EXTENSIONS, GetModelType()); + DCHECK_EQ(GetModelType(), EXTENSIONS); return GetEntitySpecifics().extension(); } const sync_pb::SessionSpecifics& BaseNode::GetSessionSpecifics() const { - DCHECK_EQ(syncer::SESSIONS, GetModelType()); + DCHECK_EQ(GetModelType(), SESSIONS); return GetEntitySpecifics().session(); } @@ -339,15 +336,15 @@ const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const { return GetUnencryptedSpecifics(GetEntry()); } -syncer::ModelType BaseNode::GetModelType() const { +ModelType BaseNode::GetModelType() const { return GetEntry()->GetModelType(); } void BaseNode::SetUnencryptedSpecifics( const sync_pb::EntitySpecifics& specifics) { - syncer::ModelType type = syncer::GetModelTypeFromSpecifics(specifics); - DCHECK_NE(syncer::UNSPECIFIED, type); - if (GetModelType() != syncer::UNSPECIFIED) { + ModelType type = GetModelTypeFromSpecifics(specifics); + DCHECK_NE(UNSPECIFIED, type); + if (GetModelType() != UNSPECIFIED) { DCHECK_EQ(GetModelType(), type); } unencrypted_data_.CopyFrom(specifics); diff --git a/sync/internal_api/base_transaction.cc b/sync/internal_api/base_transaction.cc index 94a78c1..61c1f48 100644 --- a/sync/internal_api/base_transaction.cc +++ b/sync/internal_api/base_transaction.cc @@ -7,8 +7,6 @@ #include "sync/syncable/directory.h" #include "sync/util/cryptographer.h" -using syncer::Cryptographer; - namespace syncer { ////////////////////////////////////////////////////////////////////////// @@ -20,11 +18,11 @@ BaseTransaction::BaseTransaction(UserShare* share) { BaseTransaction::~BaseTransaction() { } -syncer::Cryptographer* BaseTransaction::GetCryptographer() const { +Cryptographer* BaseTransaction::GetCryptographer() const { return directory_->GetCryptographer(this->GetWrappedTrans()); } -syncer::ModelTypeSet GetEncryptedTypes(const syncer::BaseTransaction* trans) { +ModelTypeSet GetEncryptedTypes(const BaseTransaction* trans) { return trans->GetCryptographer()->GetEncryptedTypes(); } diff --git a/sync/internal_api/change_record.cc b/sync/internal_api/change_record.cc index b956c9b..7e50e60 100644 --- a/sync/internal_api/change_record.cc +++ b/sync/internal_api/change_record.cc @@ -41,8 +41,7 @@ DictionaryValue* ChangeRecord::ToValue() const { if (extra.get()) { value->Set("extra", extra->ToValue()); } - value->Set("specifics", - syncer::EntitySpecificsToValue(specifics)); + value->Set("specifics", EntitySpecificsToValue(specifics)); } return value; } @@ -57,7 +56,7 @@ ExtraPasswordChangeRecordData::ExtraPasswordChangeRecordData( ExtraPasswordChangeRecordData::~ExtraPasswordChangeRecordData() {} DictionaryValue* ExtraPasswordChangeRecordData::ToValue() const { - return syncer::PasswordSpecificsDataToValue(unencrypted_); + return PasswordSpecificsDataToValue(unencrypted_); } const sync_pb::PasswordSpecificsData& diff --git a/sync/internal_api/change_reorder_buffer.cc b/sync/internal_api/change_reorder_buffer.cc index 1d7da38..5188309 100644 --- a/sync/internal_api/change_reorder_buffer.cc +++ b/sync/internal_api/change_reorder_buffer.cc @@ -154,7 +154,7 @@ bool ChangeReorderBuffer::GetAllChangesInTreeOrder( CHECK_EQ(BaseNode::INIT_OK, node.InitByIdLookup(i->first)); // We only care about parents of entry's with position-sensitive models. - if (syncer::ShouldMaintainPosition(node.GetEntry()->GetModelType())) { + if (ShouldMaintainPosition(node.GetEntry()->GetModelType())) { parents_of_position_changes.insert(node.GetParentId()); } } diff --git a/sync/internal_api/debug_info_event_listener.cc b/sync/internal_api/debug_info_event_listener.cc index 259ad76..60d0806 100644 --- a/sync/internal_api/debug_info_event_listener.cc +++ b/sync/internal_api/debug_info_event_listener.cc @@ -6,7 +6,7 @@ namespace syncer { -using syncer::sessions::SyncSessionSnapshot; +using sessions::SyncSessionSnapshot; DebugInfoEventListener::DebugInfoEventListener() : events_dropped_(false), @@ -45,18 +45,18 @@ void DebugInfoEventListener::OnSyncCycleCompleted( } void DebugInfoEventListener::OnInitializationComplete( - const syncer::WeakHandle<syncer::JsBackend>& js_backend, + const WeakHandle<JsBackend>& js_backend, bool success) { CreateAndAddEvent(sync_pb::DebugEventInfo::INITIALIZATION_COMPLETE); } void DebugInfoEventListener::OnConnectionStatusChange( - syncer::ConnectionStatus status) { + ConnectionStatus status) { CreateAndAddEvent(sync_pb::DebugEventInfo::CONNECTION_STATUS_CHANGE); } void DebugInfoEventListener::OnPassphraseRequired( - syncer::PassphraseRequiredReason reason, + PassphraseRequiredReason reason, const sync_pb::EncryptedData& pending_keys) { CreateAndAddEvent(sync_pb::DebugEventInfo::PASSPHRASE_REQUIRED); } @@ -79,7 +79,7 @@ void DebugInfoEventListener::OnUpdatedToken(const std::string& token) { } void DebugInfoEventListener::OnEncryptedTypesChanged( - syncer::ModelTypeSet encrypted_types, + ModelTypeSet encrypted_types, bool encrypt_everything) { CreateAndAddEvent(sync_pb::DebugEventInfo::ENCRYPTED_TYPES_CHANGED); } @@ -89,7 +89,7 @@ void DebugInfoEventListener::OnEncryptionComplete() { } void DebugInfoEventListener::OnActionableError( - const syncer::SyncProtocolError& sync_error) { + const SyncProtocolError& sync_error) { CreateAndAddEvent(sync_pb::DebugEventInfo::ACTIONABLE_ERROR); } @@ -101,22 +101,21 @@ void DebugInfoEventListener::SetCryptographerReady(bool ready) { cryptographer_ready_ = ready; } -void DebugInfoEventListener::OnNudgeFromDatatype(syncer::ModelType datatype) { +void DebugInfoEventListener::OnNudgeFromDatatype(ModelType datatype) { sync_pb::DebugEventInfo event_info; event_info.set_nudging_datatype( - syncer::GetSpecificsFieldNumberFromModelType(datatype)); + GetSpecificsFieldNumberFromModelType(datatype)); AddEventToQueue(event_info); } void DebugInfoEventListener::OnIncomingNotification( - const syncer::ModelTypePayloadMap& type_payloads) { + const ModelTypePayloadMap& type_payloads) { sync_pb::DebugEventInfo event_info; - syncer::ModelTypeSet types = ModelTypePayloadMapToEnumSet(type_payloads); + ModelTypeSet types = ModelTypePayloadMapToEnumSet(type_payloads); - for (syncer::ModelTypeSet::Iterator it = types.First(); - it.Good(); it.Inc()) { + for (ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) { event_info.add_datatypes_notified_from_server( - syncer::GetSpecificsFieldNumberFromModelType(it.Get())); + GetSpecificsFieldNumberFromModelType(it.Get())); } AddEventToQueue(event_info); @@ -124,7 +123,7 @@ void DebugInfoEventListener::OnIncomingNotification( void DebugInfoEventListener::GetAndClearDebugInfo( sync_pb::DebugInfo* debug_info) { - DCHECK(events_.size() <= syncer::kMaxEntries); + DCHECK_LE(events_.size(), kMaxEntries); while (!events_.empty()) { sync_pb::DebugEventInfo* event_info = debug_info->add_events(); const sync_pb::DebugEventInfo& debug_event_info = events_.front(); @@ -149,7 +148,7 @@ void DebugInfoEventListener::CreateAndAddEvent( void DebugInfoEventListener::AddEventToQueue( const sync_pb::DebugEventInfo& event_info) { - if (events_.size() >= syncer::kMaxEntries) { + if (events_.size() >= kMaxEntries) { DVLOG(1) << "DebugInfoEventListener::AddEventToQueue Dropping an old event " << "because of full queue"; diff --git a/sync/internal_api/debug_info_event_listener.h b/sync/internal_api/debug_info_event_listener.h index 403c182..8606cf9 100644 --- a/sync/internal_api/debug_info_event_listener.h +++ b/sync/internal_api/debug_info_event_listener.h @@ -23,22 +23,22 @@ const unsigned int kMaxEntries = 6; // Listens to events and records them in a queue. And passes the events to // syncer when requested. -class DebugInfoEventListener : public syncer::SyncManager::Observer, - public syncer::sessions::DebugInfoGetter { +class DebugInfoEventListener : public SyncManager::Observer, + public sessions::DebugInfoGetter { public: DebugInfoEventListener(); virtual ~DebugInfoEventListener(); // SyncManager::Observer implementation. virtual void OnSyncCycleCompleted( - const syncer::sessions::SyncSessionSnapshot& snapshot) OVERRIDE; + const sessions::SyncSessionSnapshot& snapshot) OVERRIDE; virtual void OnInitializationComplete( - const syncer::WeakHandle<syncer::JsBackend>& js_backend, + const WeakHandle<JsBackend>& js_backend, bool success) OVERRIDE; virtual void OnConnectionStatusChange( - syncer::ConnectionStatus connection_status) OVERRIDE; + ConnectionStatus connection_status) OVERRIDE; virtual void OnPassphraseRequired( - syncer::PassphraseRequiredReason reason, + PassphraseRequiredReason reason, const sync_pb::EncryptedData& pending_keys) OVERRIDE; virtual void OnPassphraseAccepted() OVERRIDE; virtual void OnBootstrapTokenUpdated( @@ -46,16 +46,15 @@ class DebugInfoEventListener : public syncer::SyncManager::Observer, virtual void OnStopSyncingPermanently() OVERRIDE; virtual void OnUpdatedToken(const std::string& token) OVERRIDE; virtual void OnEncryptedTypesChanged( - syncer::ModelTypeSet encrypted_types, + ModelTypeSet encrypted_types, bool encrypt_everything) OVERRIDE; virtual void OnEncryptionComplete() OVERRIDE; virtual void OnActionableError( - const syncer::SyncProtocolError& sync_error) OVERRIDE; + const SyncProtocolError& sync_error) OVERRIDE; // Sync manager events. - void OnNudgeFromDatatype(syncer::ModelType datatype); - void OnIncomingNotification( - const syncer::ModelTypePayloadMap& type_payloads); + void OnNudgeFromDatatype(ModelType datatype); + void OnIncomingNotification(const ModelTypePayloadMap& type_payloads); // DebugInfoGetter Implementation. virtual void GetAndClearDebugInfo(sync_pb::DebugInfo* debug_info) OVERRIDE; diff --git a/sync/internal_api/debug_info_event_listener_unittest.cc b/sync/internal_api/debug_info_event_listener_unittest.cc index 72f9039..a352203 100644 --- a/sync/internal_api/debug_info_event_listener_unittest.cc +++ b/sync/internal_api/debug_info_event_listener_unittest.cc @@ -11,7 +11,7 @@ namespace syncer { typedef testing::Test DebugInfoEventListenerTest; TEST_F(DebugInfoEventListenerTest, VerifyEventsAdded) { - syncer::DebugInfoEventListener debug_info_event_listener; + DebugInfoEventListener debug_info_event_listener; debug_info_event_listener.CreateAndAddEvent( sync_pb::DebugEventInfo::ENCRYPTION_COMPLETE); ASSERT_EQ(debug_info_event_listener.events_.size(), 1U); @@ -22,17 +22,16 @@ TEST_F(DebugInfoEventListenerTest, VerifyEventsAdded) { } TEST_F(DebugInfoEventListenerTest, VerifyQueueSize) { - syncer::DebugInfoEventListener debug_info_event_listener; + DebugInfoEventListener debug_info_event_listener; for (int i = 0; i < 10; ++i) { debug_info_event_listener.CreateAndAddEvent( sync_pb::DebugEventInfo::ENCRYPTION_COMPLETE); } - ASSERT_EQ(debug_info_event_listener.events_.size(), - syncer::kMaxEntries); + ASSERT_EQ(debug_info_event_listener.events_.size(), kMaxEntries); } TEST_F(DebugInfoEventListenerTest, VerifyGetAndClearEvents) { - syncer::DebugInfoEventListener debug_info_event_listener; + DebugInfoEventListener debug_info_event_listener; debug_info_event_listener.CreateAndAddEvent( sync_pb::DebugEventInfo::ENCRYPTION_COMPLETE); ASSERT_EQ(debug_info_event_listener.events_.size(), 1U); diff --git a/sync/internal_api/http_bridge.cc b/sync/internal_api/http_bridge.cc index 5c5073d..96e1a58 100644 --- a/sync/internal_api/http_bridge.cc +++ b/sync/internal_api/http_bridge.cc @@ -65,13 +65,13 @@ HttpBridgeFactory::HttpBridgeFactory( HttpBridgeFactory::~HttpBridgeFactory() { } -syncer::HttpPostProviderInterface* HttpBridgeFactory::Create() { +HttpPostProviderInterface* HttpBridgeFactory::Create() { HttpBridge* http = new HttpBridge(request_context_getter_); http->AddRef(); return http; } -void HttpBridgeFactory::Destroy(syncer::HttpPostProviderInterface* http) { +void HttpBridgeFactory::Destroy(HttpPostProviderInterface* http) { static_cast<HttpBridge*>(http)->Release(); } diff --git a/sync/internal_api/internal_components_factory_impl.cc b/sync/internal_api/internal_components_factory_impl.cc index 0ec5911..d62d942 100644 --- a/sync/internal_api/internal_components_factory_impl.cc +++ b/sync/internal_api/internal_components_factory_impl.cc @@ -30,7 +30,7 @@ InternalComponentsFactoryImpl::BuildContext( ThrottledDataTypeTracker* throttled_data_type_tracker, const std::vector<SyncEngineEventListener*>& listeners, sessions::DebugInfoGetter* debug_info_getter, - syncer::TrafficRecorder* traffic_recorder) { + TrafficRecorder* traffic_recorder) { return scoped_ptr<sessions::SyncSessionContext>( new sessions::SyncSessionContext(connection_manager, directory, routing_info, workers, monitor, throttled_data_type_tracker, diff --git a/sync/internal_api/js_mutation_event_observer.cc b/sync/internal_api/js_mutation_event_observer.cc index d977fa5..262c7b5 100644 --- a/sync/internal_api/js_mutation_event_observer.cc +++ b/sync/internal_api/js_mutation_event_observer.cc @@ -44,21 +44,21 @@ const size_t kChangeLimit = 100; } // namespace void JsMutationEventObserver::OnChangesApplied( - syncer::ModelType model_type, + ModelType model_type, int64 write_transaction_id, - const syncer::ImmutableChangeRecordList& changes) { + const ImmutableChangeRecordList& changes) { if (!event_handler_.IsInitialized()) { return; } DictionaryValue details; - details.SetString("modelType", syncer::ModelTypeToString(model_type)); + details.SetString("modelType", ModelTypeToString(model_type)); details.SetString("writeTransactionId", base::Int64ToString(write_transaction_id)); base::Value* changes_value = NULL; const size_t changes_size = changes.Get().size(); if (changes_size <= kChangeLimit) { ListValue* changes_list = new ListValue(); - for (syncer::ChangeRecordList::const_iterator it = + for (ChangeRecordList::const_iterator it = changes.Get().begin(); it != changes.Get().end(); ++it) { changes_list->Append(it->ToValue()); } @@ -73,19 +73,18 @@ void JsMutationEventObserver::OnChangesApplied( HandleJsEvent(FROM_HERE, "onChangesApplied", JsEventDetails(&details)); } -void JsMutationEventObserver::OnChangesComplete( - syncer::ModelType model_type) { +void JsMutationEventObserver::OnChangesComplete(ModelType model_type) { if (!event_handler_.IsInitialized()) { return; } DictionaryValue details; - details.SetString("modelType", syncer::ModelTypeToString(model_type)); + details.SetString("modelType", ModelTypeToString(model_type)); HandleJsEvent(FROM_HERE, "onChangesComplete", JsEventDetails(&details)); } void JsMutationEventObserver::OnTransactionWrite( const syncable::ImmutableWriteTransactionInfo& write_transaction_info, - syncer::ModelTypeSet models_with_changes) { + ModelTypeSet models_with_changes) { DCHECK(CalledOnValidThread()); if (!event_handler_.IsInitialized()) { return; @@ -94,7 +93,7 @@ void JsMutationEventObserver::OnTransactionWrite( details.Set("writeTransactionInfo", write_transaction_info.Get().ToValue(kChangeLimit)); details.Set("modelsWithChanges", - syncer::ModelTypeSetToValue(models_with_changes)); + ModelTypeSetToValue(models_with_changes)); HandleJsEvent(FROM_HERE, "onTransactionWrite", JsEventDetails(&details)); } diff --git a/sync/internal_api/js_mutation_event_observer.h b/sync/internal_api/js_mutation_event_observer.h index 91bf98b..2fb1d48 100644 --- a/sync/internal_api/js_mutation_event_observer.h +++ b/sync/internal_api/js_mutation_event_observer.h @@ -27,7 +27,7 @@ class JsEventHandler; // Observes all change- and transaction-related events and routes a // summarized version to a JsEventHandler. class JsMutationEventObserver - : public syncer::SyncManager::ChangeObserver, + : public SyncManager::ChangeObserver, public syncable::TransactionObserver, public base::NonThreadSafe { public: @@ -41,17 +41,17 @@ class JsMutationEventObserver void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); - // syncer::SyncManager::ChangeObserver implementation. + // SyncManager::ChangeObserver implementation. virtual void OnChangesApplied( - syncer::ModelType model_type, + ModelType model_type, int64 write_transaction_id, - const syncer::ImmutableChangeRecordList& changes) OVERRIDE; - virtual void OnChangesComplete(syncer::ModelType model_type) OVERRIDE; + const ImmutableChangeRecordList& changes) OVERRIDE; + virtual void OnChangesComplete(ModelType model_type) OVERRIDE; // syncable::TransactionObserver implementation. virtual void OnTransactionWrite( const syncable::ImmutableWriteTransactionInfo& write_transaction_info, - syncer::ModelTypeSet models_with_changes) OVERRIDE; + ModelTypeSet models_with_changes) OVERRIDE; private: base::WeakPtrFactory<JsMutationEventObserver> weak_ptr_factory_; diff --git a/sync/internal_api/js_mutation_event_observer_unittest.cc b/sync/internal_api/js_mutation_event_observer_unittest.cc index a7eb824..91e10b3 100644 --- a/sync/internal_api/js_mutation_event_observer_unittest.cc +++ b/sync/internal_api/js_mutation_event_observer_unittest.cc @@ -46,21 +46,18 @@ TEST_F(JsMutationEventObserverTest, OnChangesApplied) { // We don't test with passwords as that requires additional setup. // Build a list of example ChangeRecords. - syncer::ChangeRecord changes[syncer::MODEL_TYPE_COUNT]; - for (int i = syncer::AUTOFILL_PROFILE; i < syncer::MODEL_TYPE_COUNT; ++i) { + ChangeRecord changes[MODEL_TYPE_COUNT]; + for (int i = AUTOFILL_PROFILE; i < MODEL_TYPE_COUNT; ++i) { changes[i].id = i; switch (i % 3) { case 0: - changes[i].action = - syncer::ChangeRecord::ACTION_ADD; + changes[i].action = ChangeRecord::ACTION_ADD; break; case 1: - changes[i].action = - syncer::ChangeRecord::ACTION_UPDATE; + changes[i].action = ChangeRecord::ACTION_UPDATE; break; default: - changes[i].action = - syncer::ChangeRecord::ACTION_DELETE; + changes[i].action = ChangeRecord::ACTION_DELETE; break; } } @@ -70,15 +67,15 @@ TEST_F(JsMutationEventObserverTest, OnChangesApplied) { // starting from changes[i]. // Set expectations for each data type. - for (int i = syncer::AUTOFILL_PROFILE; i < syncer::MODEL_TYPE_COUNT; ++i) { + for (int i = AUTOFILL_PROFILE; i < MODEL_TYPE_COUNT; ++i) { const std::string& model_type_str = - syncer::ModelTypeToString(syncer::ModelTypeFromInt(i)); + ModelTypeToString(ModelTypeFromInt(i)); DictionaryValue expected_details; expected_details.SetString("modelType", model_type_str); expected_details.SetString("writeTransactionId", "0"); ListValue* expected_changes = new ListValue(); expected_details.Set("changes", expected_changes); - for (int j = i; j < syncer::MODEL_TYPE_COUNT; ++j) { + for (int j = i; j < MODEL_TYPE_COUNT; ++j) { expected_changes->Append(changes[j].ToValue()); } EXPECT_CALL(mock_js_event_handler_, @@ -87,12 +84,11 @@ TEST_F(JsMutationEventObserverTest, OnChangesApplied) { } // Fire OnChangesApplied() for each data type. - for (int i = syncer::AUTOFILL_PROFILE; i < syncer::MODEL_TYPE_COUNT; ++i) { - syncer::ChangeRecordList - local_changes(changes + i, changes + arraysize(changes)); + for (int i = AUTOFILL_PROFILE; i < MODEL_TYPE_COUNT; ++i) { + ChangeRecordList local_changes(changes + i, changes + arraysize(changes)); js_mutation_event_observer_.OnChangesApplied( - syncer::ModelTypeFromInt(i), - 0, syncer::ImmutableChangeRecordList(&local_changes)); + ModelTypeFromInt(i), + 0, ImmutableChangeRecordList(&local_changes)); } PumpLoop(); @@ -101,21 +97,19 @@ TEST_F(JsMutationEventObserverTest, OnChangesApplied) { TEST_F(JsMutationEventObserverTest, OnChangesComplete) { InSequence dummy; - for (int i = syncer::FIRST_REAL_MODEL_TYPE; - i < syncer::MODEL_TYPE_COUNT; ++i) { + for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { DictionaryValue expected_details; expected_details.SetString( "modelType", - syncer::ModelTypeToString(syncer::ModelTypeFromInt(i))); + ModelTypeToString(ModelTypeFromInt(i))); EXPECT_CALL(mock_js_event_handler_, HandleJsEvent("onChangesComplete", HasDetailsAsDictionary(expected_details))); } - for (int i = syncer::FIRST_REAL_MODEL_TYPE; - i < syncer::MODEL_TYPE_COUNT; ++i) { + for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { js_mutation_event_observer_.OnChangesComplete( - syncer::ModelTypeFromInt(i)); + ModelTypeFromInt(i)); } PumpLoop(); } diff --git a/sync/internal_api/js_sync_manager_observer.cc b/sync/internal_api/js_sync_manager_observer.cc index 4e98fd9..5eda7f1 100644 --- a/sync/internal_api/js_sync_manager_observer.cc +++ b/sync/internal_api/js_sync_manager_observer.cc @@ -21,8 +21,6 @@ namespace syncer { -using syncer::SyncProtocolError; - JsSyncManagerObserver::JsSyncManagerObserver() {} JsSyncManagerObserver::~JsSyncManagerObserver() {} @@ -42,13 +40,12 @@ void JsSyncManagerObserver::OnSyncCycleCompleted( HandleJsEvent(FROM_HERE, "onSyncCycleCompleted", JsEventDetails(&details)); } -void JsSyncManagerObserver::OnConnectionStatusChange( - syncer::ConnectionStatus status) { +void JsSyncManagerObserver::OnConnectionStatusChange(ConnectionStatus status) { if (!event_handler_.IsInitialized()) { return; } DictionaryValue details; - details.SetString("status", syncer::ConnectionStatusToString(status)); + details.SetString("status", ConnectionStatusToString(status)); HandleJsEvent(FROM_HERE, "onConnectionStatusChange", JsEventDetails(&details)); } @@ -63,14 +60,14 @@ void JsSyncManagerObserver::OnUpdatedToken(const std::string& token) { } void JsSyncManagerObserver::OnPassphraseRequired( - syncer::PassphraseRequiredReason reason, + PassphraseRequiredReason reason, const sync_pb::EncryptedData& pending_keys) { if (!event_handler_.IsInitialized()) { return; } DictionaryValue details; details.SetString("reason", - syncer::PassphraseRequiredReasonToString(reason)); + PassphraseRequiredReasonToString(reason)); HandleJsEvent(FROM_HERE, "onPassphraseRequired", JsEventDetails(&details)); } @@ -93,14 +90,14 @@ void JsSyncManagerObserver::OnBootstrapTokenUpdated( } void JsSyncManagerObserver::OnEncryptedTypesChanged( - syncer::ModelTypeSet encrypted_types, + ModelTypeSet encrypted_types, bool encrypt_everything) { if (!event_handler_.IsInitialized()) { return; } DictionaryValue details; details.Set("encryptedTypes", - syncer::ModelTypeSetToValue(encrypted_types)); + ModelTypeSetToValue(encrypted_types)); details.SetBoolean("encryptEverything", encrypt_everything); HandleJsEvent(FROM_HERE, "onEncryptedTypesChanged", JsEventDetails(&details)); diff --git a/sync/internal_api/js_sync_manager_observer.h b/sync/internal_api/js_sync_manager_observer.h index e26c8f4..0988670 100644 --- a/sync/internal_api/js_sync_manager_observer.h +++ b/sync/internal_api/js_sync_manager_observer.h @@ -23,34 +23,33 @@ class JsEventDetails; class JsEventHandler; // Routes SyncManager events to a JsEventHandler. -class JsSyncManagerObserver : public syncer::SyncManager::Observer { +class JsSyncManagerObserver : public SyncManager::Observer { public: JsSyncManagerObserver(); virtual ~JsSyncManagerObserver(); void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); - // syncer::SyncManager::Observer implementation. + // SyncManager::Observer implementation. virtual void OnSyncCycleCompleted( const sessions::SyncSessionSnapshot& snapshot) OVERRIDE; - virtual void OnConnectionStatusChange( - syncer::ConnectionStatus status) OVERRIDE; + virtual void OnConnectionStatusChange(ConnectionStatus status) OVERRIDE; virtual void OnUpdatedToken(const std::string& token) OVERRIDE; virtual void OnPassphraseRequired( - syncer::PassphraseRequiredReason reason, + PassphraseRequiredReason reason, const sync_pb::EncryptedData& pending_keys) OVERRIDE; virtual void OnPassphraseAccepted() OVERRIDE; virtual void OnBootstrapTokenUpdated( const std::string& bootstrap_token) OVERRIDE; virtual void OnEncryptedTypesChanged( - syncer::ModelTypeSet encrypted_types, + ModelTypeSet encrypted_types, bool encrypt_everything) OVERRIDE; virtual void OnEncryptionComplete() OVERRIDE; virtual void OnInitializationComplete( const WeakHandle<JsBackend>& js_backend, bool success) OVERRIDE; virtual void OnStopSyncingPermanently() OVERRIDE; virtual void OnActionableError( - const syncer::SyncProtocolError& sync_protocol_error) OVERRIDE; + const SyncProtocolError& sync_protocol_error) OVERRIDE; private: void HandleJsEvent(const tracked_objects::Location& from_here, diff --git a/sync/internal_api/js_sync_manager_observer_unittest.cc b/sync/internal_api/js_sync_manager_observer_unittest.cc index b0f7761..72ea4f3 100644 --- a/sync/internal_api/js_sync_manager_observer_unittest.cc +++ b/sync/internal_api/js_sync_manager_observer_unittest.cc @@ -65,10 +65,10 @@ TEST_F(JsSyncManagerObserverTest, NoArgNotifiations) { } TEST_F(JsSyncManagerObserverTest, OnSyncCycleCompleted) { - syncer::ModelTypePayloadMap download_progress_markers; + ModelTypePayloadMap download_progress_markers; sessions::SyncSessionSnapshot snapshot(sessions::ModelNeutralState(), false, - syncer::ModelTypeSet(), + ModelTypeSet(), download_progress_markers, false, true, @@ -93,9 +93,9 @@ TEST_F(JsSyncManagerObserverTest, OnSyncCycleCompleted) { } TEST_F(JsSyncManagerObserverTest, OnActionableError) { - syncer::SyncProtocolError sync_error; - sync_error.action = syncer::CLEAR_USER_DATA_AND_RESYNC; - sync_error.error_type = syncer::TRANSIENT_ERROR; + SyncProtocolError sync_error; + sync_error.action = CLEAR_USER_DATA_AND_RESYNC; + sync_error.error_type = TRANSIENT_ERROR; DictionaryValue expected_details; expected_details.Set("syncError", sync_error.ToValue()); @@ -109,11 +109,10 @@ TEST_F(JsSyncManagerObserverTest, OnActionableError) { TEST_F(JsSyncManagerObserverTest, OnConnectionStatusChange) { - const syncer::ConnectionStatus kStatus = - syncer::CONNECTION_AUTH_ERROR; + const ConnectionStatus kStatus = CONNECTION_AUTH_ERROR; DictionaryValue expected_details; expected_details.SetString("status", - syncer::ConnectionStatusToString(kStatus)); + ConnectionStatusToString(kStatus)); EXPECT_CALL(mock_js_event_handler_, HandleJsEvent("onConnectionStatusChange", @@ -132,14 +131,13 @@ TEST_F(JsSyncManagerObserverTest, OnPassphraseRequired) { reason_passphrase_not_required_details.SetString( "reason", - syncer::PassphraseRequiredReasonToString( - syncer::REASON_PASSPHRASE_NOT_REQUIRED)); + PassphraseRequiredReasonToString(REASON_PASSPHRASE_NOT_REQUIRED)); reason_encryption_details.SetString( "reason", - syncer::PassphraseRequiredReasonToString(syncer::REASON_ENCRYPTION)); + PassphraseRequiredReasonToString(REASON_ENCRYPTION)); reason_decryption_details.SetString( "reason", - syncer::PassphraseRequiredReasonToString(syncer::REASON_DECRYPTION)); + PassphraseRequiredReasonToString(REASON_DECRYPTION)); EXPECT_CALL(mock_js_event_handler_, HandleJsEvent("onPassphraseRequired", @@ -153,11 +151,11 @@ TEST_F(JsSyncManagerObserverTest, OnPassphraseRequired) { HasDetailsAsDictionary(reason_decryption_details))); js_sync_manager_observer_.OnPassphraseRequired( - syncer::REASON_PASSPHRASE_NOT_REQUIRED, + REASON_PASSPHRASE_NOT_REQUIRED, sync_pb::EncryptedData()); - js_sync_manager_observer_.OnPassphraseRequired(syncer::REASON_ENCRYPTION, + js_sync_manager_observer_.OnPassphraseRequired(REASON_ENCRYPTION, sync_pb::EncryptedData()); - js_sync_manager_observer_.OnPassphraseRequired(syncer::REASON_DECRYPTION, + js_sync_manager_observer_.OnPassphraseRequired(REASON_DECRYPTION, sync_pb::EncryptedData()); PumpLoop(); } @@ -187,14 +185,13 @@ TEST_F(JsSyncManagerObserverTest, OnEncryptedTypesChanged) { const bool encrypt_everything = false; expected_details.Set("encryptedTypes", encrypted_type_values); expected_details.SetBoolean("encryptEverything", encrypt_everything); - syncer::ModelTypeSet encrypted_types; + ModelTypeSet encrypted_types; - for (int i = syncer::FIRST_REAL_MODEL_TYPE; - i < syncer::MODEL_TYPE_COUNT; ++i) { - syncer::ModelType type = syncer::ModelTypeFromInt(i); + for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { + ModelType type = ModelTypeFromInt(i); encrypted_types.Put(type); encrypted_type_values->Append(Value::CreateStringValue( - syncer::ModelTypeToString(type))); + ModelTypeToString(type))); } EXPECT_CALL(mock_js_event_handler_, diff --git a/sync/internal_api/public/base/model_type.h b/sync/internal_api/public/base/model_type.h index 2c4613e..20c8ffa 100644 --- a/sync/internal_api/public/base/model_type.h +++ b/sync/internal_api/public/base/model_type.h @@ -93,10 +93,10 @@ enum ModelType { MODEL_TYPE_COUNT, }; -typedef syncer::EnumSet< - ModelType, FIRST_REAL_MODEL_TYPE, LAST_REAL_MODEL_TYPE> ModelTypeSet; -typedef syncer::EnumSet< - ModelType, UNSPECIFIED, LAST_REAL_MODEL_TYPE> FullModelTypeSet; +typedef EnumSet<ModelType, FIRST_REAL_MODEL_TYPE, LAST_REAL_MODEL_TYPE> + ModelTypeSet; +typedef EnumSet<ModelType, UNSPECIFIED, LAST_REAL_MODEL_TYPE> + FullModelTypeSet; inline ModelType ModelTypeFromInt(int i) { DCHECK_GE(i, 0); diff --git a/sync/internal_api/public/base/model_type_payload_map.cc b/sync/internal_api/public/base/model_type_payload_map.cc index 04222ee..1728130 100644 --- a/sync/internal_api/public/base/model_type_payload_map.cc +++ b/sync/internal_api/public/base/model_type_payload_map.cc @@ -14,11 +14,10 @@ namespace syncer { ModelTypePayloadMap ModelTypePayloadMapFromEnumSet( - syncer::ModelTypeSet types, + ModelTypeSet types, const std::string& payload) { ModelTypePayloadMap types_with_payloads; - for (syncer::ModelTypeSet::Iterator it = types.First(); - it.Good(); it.Inc()) { + for (ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) { types_with_payloads[it.Get()] = payload; } return types_with_payloads; @@ -52,7 +51,7 @@ DictionaryValue* ModelTypePayloadMapToValue( std::string base64_marker; bool encoded = base::Base64Encode(it->second, &base64_marker); DCHECK(encoded); - value->SetString(syncer::ModelTypeToString(it->first), base64_marker); + value->SetString(ModelTypeToString(it->first), base64_marker); } return value; } diff --git a/sync/internal_api/public/base/model_type_payload_map_unittest.cc b/sync/internal_api/public/base/model_type_payload_map_unittest.cc index 1a20867..19762eeb 100644 --- a/sync/internal_api/public/base/model_type_payload_map_unittest.cc +++ b/sync/internal_api/public/base/model_type_payload_map_unittest.cc @@ -43,30 +43,30 @@ TEST_F(ModelTypePayloadMapTest, TypePayloadMapToValue) { } TEST_F(ModelTypePayloadMapTest, CoalescePayloads) { - syncer::ModelTypePayloadMap original; + ModelTypePayloadMap original; std::string empty_payload; std::string payload1 = "payload1"; std::string payload2 = "payload2"; std::string payload3 = "payload3"; - original[syncer::BOOKMARKS] = empty_payload; - original[syncer::PASSWORDS] = payload1; - original[syncer::AUTOFILL] = payload2; - original[syncer::THEMES] = payload3; + original[BOOKMARKS] = empty_payload; + original[PASSWORDS] = payload1; + original[AUTOFILL] = payload2; + original[THEMES] = payload3; - syncer::ModelTypePayloadMap update; - update[syncer::BOOKMARKS] = empty_payload; // Same. - update[syncer::PASSWORDS] = empty_payload; // Overwrite with empty. - update[syncer::AUTOFILL] = payload1; // Overwrite with non-empty. - update[syncer::SESSIONS] = payload2; // New. + ModelTypePayloadMap update; + update[BOOKMARKS] = empty_payload; // Same. + update[PASSWORDS] = empty_payload; // Overwrite with empty. + update[AUTOFILL] = payload1; // Overwrite with non-empty. + update[SESSIONS] = payload2; // New. // Themes untouched. CoalescePayloads(&original, update); ASSERT_EQ(5U, original.size()); - EXPECT_EQ(empty_payload, original[syncer::BOOKMARKS]); - EXPECT_EQ(payload1, original[syncer::PASSWORDS]); - EXPECT_EQ(payload1, original[syncer::AUTOFILL]); - EXPECT_EQ(payload2, original[syncer::SESSIONS]); - EXPECT_EQ(payload3, original[syncer::THEMES]); + EXPECT_EQ(empty_payload, original[BOOKMARKS]); + EXPECT_EQ(payload1, original[PASSWORDS]); + EXPECT_EQ(payload1, original[AUTOFILL]); + EXPECT_EQ(payload2, original[SESSIONS]); + EXPECT_EQ(payload3, original[THEMES]); } } // namespace diff --git a/sync/internal_api/public/base_node.h b/sync/internal_api/public/base_node.h index 8d66016..d4ba99d 100644 --- a/sync/internal_api/public/base_node.h +++ b/sync/internal_api/public/base_node.h @@ -78,7 +78,7 @@ class BaseNode { // by doing a client tag lookup. Returns false on failure. A deleted node // will return FALSE. virtual InitByLookupResult InitByClientTagLookup( - syncer::ModelType model_type, + ModelType model_type, const std::string& tag) = 0; // Each object is identified by a 64-bit id (internally, the syncable @@ -106,7 +106,7 @@ class BaseNode { // Returns the model type of this object. The model type is set at node // creation time and is expected never to change. - syncer::ModelType GetModelType() const; + ModelType GetModelType() const; // Getter specific to the BOOKMARK datatype. Returns protobuf // data. Can only be called if GetModelType() == BOOKMARK. @@ -202,7 +202,8 @@ class BaseNode { virtual ~BaseNode(); // The server has a size limit on client tags, so we generate a fixed length // hash locally. This also ensures that ModelTypes have unique namespaces. - static std::string GenerateSyncableHash(syncer::ModelType model_type, + static std::string GenerateSyncableHash( + ModelType model_type, const std::string& client_tag); // Determines whether part of the entry is encrypted, and if so attempts to diff --git a/sync/internal_api/public/base_transaction.h b/sync/internal_api/public/base_transaction.h index 09cecda..f097fb3 100644 --- a/sync/internal_api/public/base_transaction.h +++ b/sync/internal_api/public/base_transaction.h @@ -27,7 +27,7 @@ class BaseTransaction { public: // Provide access to the underlying syncable objects from BaseNode. virtual syncable::BaseTransaction* GetWrappedTrans() const = 0; - syncer::Cryptographer* GetCryptographer() const; + Cryptographer* GetCryptographer() const; syncable::Directory* GetDirectory() const { return directory_; @@ -45,7 +45,7 @@ class BaseTransaction { DISALLOW_COPY_AND_ASSIGN(BaseTransaction); }; -syncer::ModelTypeSet GetEncryptedTypes(const syncer::BaseTransaction* trans); +ModelTypeSet GetEncryptedTypes(const BaseTransaction* trans); } // namespace syncer diff --git a/sync/internal_api/public/change_record.h b/sync/internal_api/public/change_record.h index 5b27285..876e450 100644 --- a/sync/internal_api/public/change_record.h +++ b/sync/internal_api/public/change_record.h @@ -60,7 +60,7 @@ struct ChangeRecord { typedef std::vector<ChangeRecord> ChangeRecordList; -typedef syncer::Immutable<ChangeRecordList> ImmutableChangeRecordList; +typedef Immutable<ChangeRecordList> ImmutableChangeRecordList; } // namespace syncer diff --git a/sync/internal_api/public/change_record_unittest.cc b/sync/internal_api/public/change_record_unittest.cc index b46ab99..549b0d7 100644 --- a/sync/internal_api/public/change_record_unittest.cc +++ b/sync/internal_api/public/change_record_unittest.cc @@ -61,7 +61,7 @@ void CheckChangeRecordValue( EXPECT_TRUE(Value::Equals(extra_value, expected_extra_value.get())); scoped_ptr<DictionaryValue> expected_specifics_value( - syncer::EntitySpecificsToValue(record.specifics)); + EntitySpecificsToValue(record.specifics)); ExpectDictDictionaryValue(*expected_specifics_value, value, "specifics"); } diff --git a/sync/internal_api/public/engine/model_safe_worker.cc b/sync/internal_api/public/engine/model_safe_worker.cc index 7623cd3..cd7eaea 100644 --- a/sync/internal_api/public/engine/model_safe_worker.cc +++ b/sync/internal_api/public/engine/model_safe_worker.cc @@ -15,7 +15,7 @@ base::DictionaryValue* ModelSafeRoutingInfoToValue( base::DictionaryValue* dict = new base::DictionaryValue(); for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); it != routing_info.end(); ++it) { - dict->SetString(syncer::ModelTypeToString(it->first), + dict->SetString(ModelTypeToString(it->first), ModelSafeGroupToString(it->second)); } return dict; @@ -29,10 +29,10 @@ std::string ModelSafeRoutingInfoToString( return json; } -syncer::ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( +ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( const ModelSafeRoutingInfo& routes, const std::string& payload) { - syncer::ModelTypePayloadMap types_with_payloads; + ModelTypePayloadMap types_with_payloads; for (ModelSafeRoutingInfo::const_iterator i = routes.begin(); i != routes.end(); ++i) { types_with_payloads[i->first] = payload; @@ -40,9 +40,8 @@ syncer::ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( return types_with_payloads; } -syncer::ModelTypeSet GetRoutingInfoTypes( - const ModelSafeRoutingInfo& routing_info) { - syncer::ModelTypeSet types; +ModelTypeSet GetRoutingInfoTypes(const ModelSafeRoutingInfo& routing_info) { + ModelTypeSet types; for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); it != routing_info.end(); ++it) { types.Put(it->first); @@ -50,11 +49,11 @@ syncer::ModelTypeSet GetRoutingInfoTypes( return types; } -ModelSafeGroup GetGroupForModelType(const syncer::ModelType type, +ModelSafeGroup GetGroupForModelType(const ModelType type, const ModelSafeRoutingInfo& routes) { ModelSafeRoutingInfo::const_iterator it = routes.find(type); if (it == routes.end()) { - if (type != syncer::UNSPECIFIED && type != syncer::TOP_LEVEL_FOLDER) + if (type != UNSPECIFIED && type != TOP_LEVEL_FOLDER) LOG(WARNING) << "Entry does not belong to active ModelSafeGroup!"; return GROUP_PASSIVE; } diff --git a/sync/internal_api/public/engine/model_safe_worker.h b/sync/internal_api/public/engine/model_safe_worker.h index 9f1c702..d67f4b6 100644 --- a/sync/internal_api/public/engine/model_safe_worker.h +++ b/sync/internal_api/public/engine/model_safe_worker.h @@ -68,11 +68,10 @@ class SYNC_EXPORT ModelSafeWorker friend class base::RefCountedThreadSafe<ModelSafeWorker>; }; -// A map that details which ModelSafeGroup each syncer::ModelType +// A map that details which ModelSafeGroup each ModelType // belongs to. Routing info can change in response to the user enabling / // disabling sync for certain types, as well as model association completions. -typedef std::map<syncer::ModelType, ModelSafeGroup> - ModelSafeRoutingInfo; +typedef std::map<ModelType, ModelSafeGroup> ModelSafeRoutingInfo; // Caller takes ownership of return value. base::DictionaryValue* ModelSafeRoutingInfoToValue( @@ -83,15 +82,15 @@ SYNC_EXPORT std::string ModelSafeRoutingInfoToString( // Make a ModelTypePayloadMap for all the enabled types in a // ModelSafeRoutingInfo using a default payload. -syncer::ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( +ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( const ModelSafeRoutingInfo& routes, const std::string& payload); -SYNC_EXPORT syncer::ModelTypeSet GetRoutingInfoTypes( +SYNC_EXPORT ModelTypeSet GetRoutingInfoTypes( const ModelSafeRoutingInfo& routing_info); SYNC_EXPORT ModelSafeGroup GetGroupForModelType( - const syncer::ModelType type, + const ModelType type, const ModelSafeRoutingInfo& routes); } // namespace syncer diff --git a/sync/internal_api/public/engine/model_safe_worker_unittest.cc b/sync/internal_api/public/engine/model_safe_worker_unittest.cc index b1036b5..5acf460 100644 --- a/sync/internal_api/public/engine/model_safe_worker_unittest.cc +++ b/sync/internal_api/public/engine/model_safe_worker_unittest.cc @@ -16,9 +16,9 @@ class ModelSafeWorkerTest : public ::testing::Test { TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToValue) { ModelSafeRoutingInfo routing_info; - routing_info[syncer::BOOKMARKS] = GROUP_PASSIVE; - routing_info[syncer::NIGORI] = GROUP_UI; - routing_info[syncer::PREFERENCES] = GROUP_DB; + routing_info[BOOKMARKS] = GROUP_PASSIVE; + routing_info[NIGORI] = GROUP_UI; + routing_info[PREFERENCES] = GROUP_DB; DictionaryValue expected_value; expected_value.SetString("Bookmarks", "GROUP_PASSIVE"); expected_value.SetString("Encryption keys", "GROUP_UI"); @@ -30,9 +30,9 @@ TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToValue) { TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToString) { ModelSafeRoutingInfo routing_info; - routing_info[syncer::BOOKMARKS] = GROUP_PASSIVE; - routing_info[syncer::NIGORI] = GROUP_UI; - routing_info[syncer::PREFERENCES] = GROUP_DB; + routing_info[BOOKMARKS] = GROUP_PASSIVE; + routing_info[NIGORI] = GROUP_UI; + routing_info[PREFERENCES] = GROUP_DB; EXPECT_EQ( "{\"Bookmarks\":\"GROUP_PASSIVE\",\"Encryption keys\":\"GROUP_UI\"," "\"Preferences\":\"GROUP_DB\"}", @@ -41,23 +41,20 @@ TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToString) { TEST_F(ModelSafeWorkerTest, GetRoutingInfoTypes) { ModelSafeRoutingInfo routing_info; - routing_info[syncer::BOOKMARKS] = GROUP_PASSIVE; - routing_info[syncer::NIGORI] = GROUP_UI; - routing_info[syncer::PREFERENCES] = GROUP_DB; - const syncer::ModelTypeSet expected_types( - syncer::BOOKMARKS, - syncer::NIGORI, - syncer::PREFERENCES); + routing_info[BOOKMARKS] = GROUP_PASSIVE; + routing_info[NIGORI] = GROUP_UI; + routing_info[PREFERENCES] = GROUP_DB; + const ModelTypeSet expected_types(BOOKMARKS, NIGORI, PREFERENCES); EXPECT_TRUE(GetRoutingInfoTypes(routing_info).Equals(expected_types)); } TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToPayloadMap) { std::string payload = "test"; ModelSafeRoutingInfo routing_info; - routing_info[syncer::BOOKMARKS] = GROUP_PASSIVE; - routing_info[syncer::NIGORI] = GROUP_UI; - routing_info[syncer::PREFERENCES] = GROUP_DB; - syncer::ModelTypePayloadMap types_with_payloads = + routing_info[BOOKMARKS] = GROUP_PASSIVE; + routing_info[NIGORI] = GROUP_UI; + routing_info[PREFERENCES] = GROUP_DB; + ModelTypePayloadMap types_with_payloads = ModelSafeRoutingInfoToPayloadMap(routing_info, payload); ASSERT_EQ(routing_info.size(), types_with_payloads.size()); for (ModelSafeRoutingInfo::iterator iter = routing_info.begin(); diff --git a/sync/internal_api/public/engine/sync_status.h b/sync/internal_api/public/engine/sync_status.h index d82c0f4..dfd9603 100644 --- a/sync/internal_api/public/engine/sync_status.h +++ b/sync/internal_api/public/engine/sync_status.h @@ -30,7 +30,7 @@ struct SYNC_EXPORT SyncStatus { // Notifications counters updated by the actions in synapi. int notifications_received; - syncer::SyncProtocolError sync_protocol_error; + SyncProtocolError sync_protocol_error; // Number of encryption conflicts counted during most recent sync cycle. int encryption_conflicts; @@ -81,12 +81,12 @@ struct SYNC_EXPORT SyncStatus { int useful_sync_cycles; // Encryption related. - syncer::ModelTypeSet encrypted_types; + ModelTypeSet encrypted_types; bool cryptographer_ready; bool crypto_has_pending_keys; // Per-datatype throttled status. - syncer::ModelTypeSet throttled_types; + ModelTypeSet throttled_types; // The unique identifer for this client. std::string unique_id; diff --git a/sync/internal_api/public/http_bridge.h b/sync/internal_api/public/http_bridge.h index 45dc487..15001c2 100644 --- a/sync/internal_api/public/http_bridge.h +++ b/sync/internal_api/public/http_bridge.h @@ -37,7 +37,7 @@ namespace syncer { // It is RefCountedThreadSafe because it can PostTask to the io loop, and thus // needs to stick around across context switches, etc. class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>, - public syncer::HttpPostProviderInterface, + public HttpPostProviderInterface, public net::URLFetcherDelegate { public: // A request context used for HTTP requests bridged from the sync backend. @@ -97,7 +97,7 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>, explicit HttpBridge(RequestContextGetter* context); - // syncer::HttpPostProvider implementation. + // HttpPostProvider implementation. virtual void SetExtraRequestHeaders(const char* headers) OVERRIDE; virtual void SetURL(const char* url, int port) OVERRIDE; virtual void SetPostPayload(const char* content_type, int content_length, @@ -204,16 +204,16 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>, DISALLOW_COPY_AND_ASSIGN(HttpBridge); }; -class HttpBridgeFactory : public syncer::HttpPostProviderFactory { +class HttpBridgeFactory : public HttpPostProviderFactory { public: HttpBridgeFactory( net::URLRequestContextGetter* baseline_context_getter, const std::string& user_agent); virtual ~HttpBridgeFactory(); - // syncer::HttpPostProviderFactory: - virtual syncer::HttpPostProviderInterface* Create() OVERRIDE; - virtual void Destroy(syncer::HttpPostProviderInterface* http) OVERRIDE; + // HttpPostProviderFactory: + virtual HttpPostProviderInterface* Create() OVERRIDE; + virtual void Destroy(HttpPostProviderInterface* http) OVERRIDE; private: // This request context is built on top of the baseline context and shares diff --git a/sync/internal_api/public/internal_components_factory.h b/sync/internal_api/public/internal_components_factory.h index 9ef604b..ab7dddf 100644 --- a/sync/internal_api/public/internal_components_factory.h +++ b/sync/internal_api/public/internal_components_factory.h @@ -52,7 +52,7 @@ class InternalComponentsFactory { ThrottledDataTypeTracker* throttled_data_type_tracker, const std::vector<SyncEngineEventListener*>& listeners, sessions::DebugInfoGetter* debug_info_getter, - syncer::TrafficRecorder* traffic_recorder) = 0; + TrafficRecorder* traffic_recorder) = 0; virtual scoped_ptr<syncable::DirectoryBackingStore> BuildDirectoryBackingStore( diff --git a/sync/internal_api/public/internal_components_factory_impl.h b/sync/internal_api/public/internal_components_factory_impl.h index db9b04a..1398022 100644 --- a/sync/internal_api/public/internal_components_factory_impl.h +++ b/sync/internal_api/public/internal_components_factory_impl.h @@ -30,7 +30,7 @@ class InternalComponentsFactoryImpl : public InternalComponentsFactory { ThrottledDataTypeTracker* throttled_data_type_tracker, const std::vector<SyncEngineEventListener*>& listeners, sessions::DebugInfoGetter* debug_info_getter, - syncer::TrafficRecorder* traffic_recorder) OVERRIDE; + TrafficRecorder* traffic_recorder) OVERRIDE; virtual scoped_ptr<syncable::DirectoryBackingStore> BuildDirectoryBackingStore( diff --git a/sync/internal_api/public/read_node.h b/sync/internal_api/public/read_node.h index 358a529..78d67cc 100644 --- a/sync/internal_api/public/read_node.h +++ b/sync/internal_api/public/read_node.h @@ -29,7 +29,7 @@ class ReadNode : public BaseNode { // BaseNode implementation. virtual InitByLookupResult InitByIdLookup(int64 id) OVERRIDE; virtual InitByLookupResult InitByClientTagLookup( - syncer::ModelType model_type, + ModelType model_type, const std::string& tag) OVERRIDE; // There is always a root node, so this can't fail. The root node is diff --git a/sync/internal_api/public/sessions/model_neutral_state.h b/sync/internal_api/public/sessions/model_neutral_state.h index a9c1c44..6b0cec8 100644 --- a/sync/internal_api/public/sessions/model_neutral_state.h +++ b/sync/internal_api/public/sessions/model_neutral_state.h @@ -23,7 +23,7 @@ struct ModelNeutralState { // We GetUpdates for some combination of types at once. // requested_update_types stores the set of types which were requested. - syncer::ModelTypeSet updates_request_types; + ModelTypeSet updates_request_types; sync_pb::ClientToServerResponse updates_response; @@ -39,7 +39,7 @@ struct ModelNeutralState { // 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. - syncer::ModelTypeSet types_needing_local_migration; + ModelTypeSet types_needing_local_migration; // Overwrites due to conflict resolution counters. int num_local_overwrites; diff --git a/sync/internal_api/public/sessions/sync_session_snapshot.cc b/sync/internal_api/public/sessions/sync_session_snapshot.cc index 42b990d..5e1e4e7 100644 --- a/sync/internal_api/public/sessions/sync_session_snapshot.cc +++ b/sync/internal_api/public/sessions/sync_session_snapshot.cc @@ -28,8 +28,8 @@ SyncSessionSnapshot::SyncSessionSnapshot() SyncSessionSnapshot::SyncSessionSnapshot( const ModelNeutralState& model_neutral_state, bool is_share_usable, - syncer::ModelTypeSet initial_sync_ended, - const syncer::ModelTypePayloadMap& download_progress_markers, + ModelTypeSet initial_sync_ended, + const ModelTypePayloadMap& download_progress_markers, bool more_to_sync, bool is_silenced, int num_encryption_conflicts, @@ -82,9 +82,9 @@ DictionaryValue* SyncSessionSnapshot::ToValue() const { static_cast<int>(model_neutral_state_.num_server_changes_remaining)); value->SetBoolean("isShareUsable", is_share_usable_); value->Set("initialSyncEnded", - syncer::ModelTypeSetToValue(initial_sync_ended_)); + ModelTypeSetToValue(initial_sync_ended_)); value->Set("downloadProgressMarkers", - syncer::ModelTypePayloadMapToValue(download_progress_markers_)); + ModelTypePayloadMapToValue(download_progress_markers_)); value->SetBoolean("hasMoreToSync", has_more_to_sync_); value->SetBoolean("isSilenced", is_silenced_); // We don't care too much if we lose precision here, also. @@ -119,12 +119,11 @@ bool SyncSessionSnapshot::is_share_usable() const { return is_share_usable_; } -syncer::ModelTypeSet SyncSessionSnapshot::initial_sync_ended() const { +ModelTypeSet SyncSessionSnapshot::initial_sync_ended() const { return initial_sync_ended_; } -syncer::ModelTypePayloadMap - SyncSessionSnapshot::download_progress_markers() const { +ModelTypePayloadMap SyncSessionSnapshot::download_progress_markers() const { return download_progress_markers_; } diff --git a/sync/internal_api/public/sessions/sync_session_snapshot.h b/sync/internal_api/public/sessions/sync_session_snapshot.h index d599f9d..d6fb025 100644 --- a/sync/internal_api/public/sessions/sync_session_snapshot.h +++ b/sync/internal_api/public/sessions/sync_session_snapshot.h @@ -32,8 +32,8 @@ class SyncSessionSnapshot { SyncSessionSnapshot( const ModelNeutralState& model_neutral_state, bool is_share_usable, - syncer::ModelTypeSet initial_sync_ended, - const syncer::ModelTypePayloadMap& download_progress_markers, + ModelTypeSet initial_sync_ended, + const ModelTypePayloadMap& download_progress_markers, bool more_to_sync, bool is_silenced, int num_encryption_conflicts, @@ -57,8 +57,8 @@ class SyncSessionSnapshot { } int64 num_server_changes_remaining() const; bool is_share_usable() const; - syncer::ModelTypeSet initial_sync_ended() const; - syncer::ModelTypePayloadMap download_progress_markers() const; + ModelTypeSet initial_sync_ended() const; + ModelTypePayloadMap download_progress_markers() const; bool has_more_to_sync() const; bool is_silenced() const; int num_encryption_conflicts() const; @@ -77,8 +77,8 @@ class SyncSessionSnapshot { private: ModelNeutralState model_neutral_state_; bool is_share_usable_; - syncer::ModelTypeSet initial_sync_ended_; - syncer::ModelTypePayloadMap download_progress_markers_; + ModelTypeSet initial_sync_ended_; + ModelTypePayloadMap download_progress_markers_; bool has_more_to_sync_; bool is_silenced_; int num_encryption_conflicts_; diff --git a/sync/internal_api/public/sessions/sync_source_info.cc b/sync/internal_api/public/sessions/sync_source_info.cc index e133f08..9e15289 100644 --- a/sync/internal_api/public/sessions/sync_source_info.cc +++ b/sync/internal_api/public/sessions/sync_source_info.cc @@ -13,12 +13,12 @@ namespace sessions { SyncSourceInfo::SyncSourceInfo() : updates_source(sync_pb::GetUpdatesCallerInfo::UNKNOWN) {} -SyncSourceInfo::SyncSourceInfo(const syncer::ModelTypePayloadMap& t) +SyncSourceInfo::SyncSourceInfo(const ModelTypePayloadMap& t) : updates_source(sync_pb::GetUpdatesCallerInfo::UNKNOWN), types(t) {} SyncSourceInfo::SyncSourceInfo( const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& u, - const syncer::ModelTypePayloadMap& t) + const ModelTypePayloadMap& t) : updates_source(u), types(t) {} SyncSourceInfo::~SyncSourceInfo() {} @@ -27,7 +27,7 @@ DictionaryValue* SyncSourceInfo::ToValue() const { DictionaryValue* value = new DictionaryValue(); value->SetString("updatesSource", GetUpdatesSourceString(updates_source)); - value->Set("types", syncer::ModelTypePayloadMapToValue(types)); + value->Set("types", ModelTypePayloadMapToValue(types)); return value; } diff --git a/sync/internal_api/public/sessions/sync_source_info.h b/sync/internal_api/public/sessions/sync_source_info.h index 4e5b264..390bdb5 100644 --- a/sync/internal_api/public/sessions/sync_source_info.h +++ b/sync/internal_api/public/sessions/sync_source_info.h @@ -22,17 +22,17 @@ namespace sessions { // specific payloads which should be sent to the server. struct SyncSourceInfo { SyncSourceInfo(); - explicit SyncSourceInfo(const syncer::ModelTypePayloadMap& t); + explicit SyncSourceInfo(const ModelTypePayloadMap& t); SyncSourceInfo( const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& u, - const syncer::ModelTypePayloadMap& t); + const ModelTypePayloadMap& t); ~SyncSourceInfo(); // Caller takes ownership of the returned dictionary. base::DictionaryValue* ToValue() const; sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source; - syncer::ModelTypePayloadMap types; + ModelTypePayloadMap types; }; } // namespace sessions diff --git a/sync/internal_api/public/sync_manager.h b/sync/internal_api/public/sync_manager.h index 715a3e1..0429697 100644 --- a/sync/internal_api/public/sync_manager.h +++ b/sync/internal_api/public/sync_manager.h @@ -60,7 +60,7 @@ enum ConnectionStatus { CONNECTION_SERVER_ERROR }; -// Reasons due to which syncer::Cryptographer might require a passphrase. +// Reasons due to which Cryptographer might require a passphrase. enum PassphraseRequiredReason { REASON_PASSPHRASE_NOT_REQUIRED = 0, // Initial value. REASON_ENCRYPTION = 1, // The cryptographer requires a @@ -120,7 +120,7 @@ class SyncManager { // operations, a delete may temporarily orphan a node that is // updated later in the list. virtual void OnChangesApplied( - syncer::ModelType model_type, + ModelType model_type, const BaseTransaction* trans, const ImmutableChangeRecordList& changes) = 0; @@ -135,7 +135,7 @@ class SyncManager { // those changes, let the transaction fall out of scope, and then commit // those changes from within OnChangesComplete (postponing the blocking // I/O to when it no longer holds any lock). - virtual void OnChangesComplete(syncer::ModelType model_type) = 0; + virtual void OnChangesComplete(ModelType model_type) = 0; protected: virtual ~ChangeDelegate(); @@ -163,11 +163,11 @@ class SyncManager { // be able to apply changes without being under a transaction. // But that's a ways off... virtual void OnChangesApplied( - syncer::ModelType model_type, + ModelType model_type, int64 write_transaction_id, const ImmutableChangeRecordList& changes) = 0; - virtual void OnChangesComplete(syncer::ModelType model_type) = 0; + virtual void OnChangesComplete(ModelType model_type) = 0; protected: virtual ~ChangeObserver(); @@ -182,7 +182,7 @@ class SyncManager { // A round-trip sync-cycle took place and the syncer has resolved any // conflicts that may have arisen. virtual void OnSyncCycleCompleted( - const syncer::sessions::SyncSessionSnapshot& snapshot) = 0; + const sessions::SyncSessionSnapshot& snapshot) = 0; // Called when the status of the connection to the sync server has // changed. @@ -298,8 +298,7 @@ class SyncManager { // function getChildNodeIds(id); virtual void OnInitializationComplete( - const syncer::WeakHandle<syncer::JsBackend>& - js_backend, bool success) = 0; + const WeakHandle<JsBackend>& js_backend, bool success) = 0; // We are no longer permitted to communicate with the server. Sync should // be disabled and state cleaned up at once. This can happen for a number @@ -322,7 +321,7 @@ class SyncManager { // // Called from within a transaction. virtual void OnEncryptedTypesChanged( - syncer::ModelTypeSet encrypted_types, + ModelTypeSet encrypted_types, bool encrypt_everything) = 0; // Called after we finish encrypting the current set of encrypted @@ -332,7 +331,7 @@ class SyncManager { virtual void OnEncryptionComplete() = 0; virtual void OnActionableError( - const syncer::SyncProtocolError& sync_protocol_error) = 0; + const SyncProtocolError& sync_protocol_error) = 0; protected: virtual ~Observer(); @@ -364,35 +363,34 @@ class SyncManager { // URLFetcher parameter. virtual bool Init( const FilePath& database_location, - const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, + const WeakHandle<JsEventHandler>& event_handler, const std::string& sync_server_and_path, int sync_server_port, bool use_ssl, const scoped_refptr<base::TaskRunner>& blocking_task_runner, scoped_ptr<HttpPostProviderFactory> post_factory, - const syncer::ModelSafeRoutingInfo& model_safe_routing_info, - const std::vector<syncer::ModelSafeWorker*>& workers, - syncer::ExtensionsActivityMonitor* extensions_activity_monitor, + const ModelSafeRoutingInfo& model_safe_routing_info, + const std::vector<ModelSafeWorker*>& workers, + ExtensionsActivityMonitor* extensions_activity_monitor, ChangeDelegate* change_delegate, const SyncCredentials& credentials, - scoped_ptr<syncer::SyncNotifier> sync_notifier, + scoped_ptr<SyncNotifier> sync_notifier, const std::string& restored_key_for_bootstrapping, scoped_ptr<InternalComponentsFactory> internal_components_factory, - syncer::Encryptor* encryptor, - syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, - syncer::ReportUnrecoverableErrorFunction - report_unrecoverable_error_function) = 0; + Encryptor* encryptor, + UnrecoverableErrorHandler* unrecoverable_error_handler, + ReportUnrecoverableErrorFunction report_unrecoverable_error_function) = 0; // Throw an unrecoverable error from a transaction (mostly used for // testing). virtual void ThrowUnrecoverableError() = 0; - virtual syncer::ModelTypeSet InitialSyncEndedTypes() = 0; + virtual ModelTypeSet InitialSyncEndedTypes() = 0; // Returns those types within |types| that have an empty progress marker // token. - virtual syncer::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( - syncer::ModelTypeSet types) = 0; + virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( + ModelTypeSet types) = 0; // Purge from the directory those types with non-empty progress markers // but without initial synced ended set. @@ -404,11 +402,11 @@ class SyncManager { // Called when the user disables or enables a sync type. virtual void UpdateEnabledTypes( - const syncer::ModelTypeSet& enabled_types) = 0; + const ModelTypeSet& enabled_types) = 0; // Put the syncer in normal mode ready to perform nudges and polls. virtual void StartSyncingNormally( - const syncer::ModelSafeRoutingInfo& routing_info) = 0; + const ModelSafeRoutingInfo& routing_info) = 0; // Attempts to re-encrypt encrypted data types using the passphrase provided. // Notifies observers of the result of the operation via OnPassphraseAccepted @@ -438,8 +436,8 @@ class SyncManager { // does finish. virtual void ConfigureSyncer( ConfigureReason reason, - const syncer::ModelTypeSet& types_to_config, - const syncer::ModelSafeRoutingInfo& new_routing_info, + const ModelTypeSet& types_to_config, + const ModelSafeRoutingInfo& new_routing_info, const base::Closure& ready_task, const base::Closure& retry_task) = 0; @@ -508,7 +506,7 @@ class SyncManager { // Reads the nigori node to determine if any experimental features should // be enabled. // Note: opens a transaction. May be called on any thread. - virtual bool ReceivedExperiment(syncer::Experiments* experiments) = 0; + virtual bool ReceivedExperiment(Experiments* experiments) = 0; // Uses a read-only transaction to determine if the directory being synced has // any remaining unsynced items. May be called on any thread. diff --git a/sync/internal_api/public/sync_manager_factory.h b/sync/internal_api/public/sync_manager_factory.h index bdcb19d..9f566c2 100644 --- a/sync/internal_api/public/sync_manager_factory.h +++ b/sync/internal_api/public/sync_manager_factory.h @@ -19,7 +19,7 @@ class SyncManagerFactory { SyncManagerFactory(); virtual ~SyncManagerFactory(); - virtual scoped_ptr<syncer::SyncManager> CreateSyncManager(std::string name); + virtual scoped_ptr<SyncManager> CreateSyncManager(std::string name); private: DISALLOW_COPY_AND_ASSIGN(SyncManagerFactory); diff --git a/sync/internal_api/public/test/fake_sync_manager.h b/sync/internal_api/public/test/fake_sync_manager.h index 9753927..b0a5d1f 100644 --- a/sync/internal_api/public/test/fake_sync_manager.h +++ b/sync/internal_api/public/test/fake_sync_manager.h @@ -23,68 +23,67 @@ class FakeSyncManager : public SyncManager { // The set of types that have initial_sync_ended set to true. This value will // be used by InitialSyncEndedTypes() until the next configuration is // performed. - void set_initial_sync_ended_types(syncer::ModelTypeSet types); + void set_initial_sync_ended_types(ModelTypeSet types); // The set of types that have valid progress markers. This will be used by // GetTypesWithEmptyProgressMarkerToken() until the next configuration is // performed. - void set_progress_marker_types(syncer::ModelTypeSet types); + void set_progress_marker_types(ModelTypeSet types); // The set of types that will fail configuration. Once ConfigureSyncer is // called, the |initial_sync_ended_types_| and // |progress_marker_types_| will be updated to include those types // that didn't fail. - void set_configure_fail_types(syncer::ModelTypeSet types); + void set_configure_fail_types(ModelTypeSet types); // Returns those types that have been cleaned (purged from the directory) // since the last call to GetAndResetCleanedTypes(), or since startup if never // called. - syncer::ModelTypeSet GetAndResetCleanedTypes(); + ModelTypeSet GetAndResetCleanedTypes(); // Returns those types that have been downloaded since the last call to // GetAndResetDownloadedTypes(), or since startup if never called. - syncer::ModelTypeSet GetAndResetDownloadedTypes(); + ModelTypeSet GetAndResetDownloadedTypes(); // SyncManager implementation. // Note: we treat whatever message loop this is called from as the sync // loop for purposes of callbacks. virtual bool Init( const FilePath& database_location, - const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, + const WeakHandle<JsEventHandler>& event_handler, const std::string& sync_server_and_path, int sync_server_port, bool use_ssl, const scoped_refptr<base::TaskRunner>& blocking_task_runner, scoped_ptr<HttpPostProviderFactory> post_factory, - const syncer::ModelSafeRoutingInfo& model_safe_routing_info, - const std::vector<syncer::ModelSafeWorker*>& workers, - syncer::ExtensionsActivityMonitor* - extensions_activity_monitor, + const ModelSafeRoutingInfo& model_safe_routing_info, + const std::vector<ModelSafeWorker*>& workers, + ExtensionsActivityMonitor* extensions_activity_monitor, ChangeDelegate* change_delegate, const SyncCredentials& credentials, - scoped_ptr<syncer::SyncNotifier> sync_notifier, + scoped_ptr<SyncNotifier> sync_notifier, const std::string& restored_key_for_bootstrapping, scoped_ptr<InternalComponentsFactory> internal_components_factory, - syncer::Encryptor* encryptor, - syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, - syncer::ReportUnrecoverableErrorFunction + Encryptor* encryptor, + UnrecoverableErrorHandler* unrecoverable_error_handler, + ReportUnrecoverableErrorFunction report_unrecoverable_error_function) OVERRIDE; virtual void ThrowUnrecoverableError() OVERRIDE; - virtual syncer::ModelTypeSet InitialSyncEndedTypes() OVERRIDE; - virtual syncer::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( - syncer::ModelTypeSet types) OVERRIDE; + virtual ModelTypeSet InitialSyncEndedTypes() OVERRIDE; + virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( + ModelTypeSet types) OVERRIDE; virtual bool PurgePartiallySyncedTypes() OVERRIDE; virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE; - virtual void UpdateEnabledTypes(const syncer::ModelTypeSet& types) OVERRIDE; + virtual void UpdateEnabledTypes(const ModelTypeSet& types) OVERRIDE; virtual void StartSyncingNormally( - const syncer::ModelSafeRoutingInfo& routing_info) OVERRIDE; + const ModelSafeRoutingInfo& routing_info) OVERRIDE; virtual void SetEncryptionPassphrase(const std::string& passphrase, bool is_explicit) OVERRIDE; virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE; virtual void ConfigureSyncer( ConfigureReason reason, - const syncer::ModelTypeSet& types_to_config, - const syncer::ModelSafeRoutingInfo& new_routing_info, + const ModelTypeSet& types_to_config, + const ModelSafeRoutingInfo& new_routing_info, const base::Closure& ready_task, const base::Closure& retry_task) OVERRIDE; virtual void AddObserver(Observer* observer) OVERRIDE; @@ -98,24 +97,24 @@ class FakeSyncManager : public SyncManager { virtual void RefreshNigori(const std::string& chrome_version, const base::Closure& done_callback) OVERRIDE; virtual void EnableEncryptEverything() OVERRIDE; - virtual bool ReceivedExperiment(syncer::Experiments* experiments) OVERRIDE; + virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE; virtual bool HasUnsyncedItems() OVERRIDE; private: ObserverList<SyncManager::Observer> observers_; // Faked directory state. - syncer::ModelTypeSet initial_sync_ended_types_; - syncer::ModelTypeSet progress_marker_types_; + ModelTypeSet initial_sync_ended_types_; + ModelTypeSet progress_marker_types_; // Test specific state. // The types that should fail configuration attempts. These types will not // have their progress markers or initial_sync_ended bits set. - syncer::ModelTypeSet configure_fail_types_; + ModelTypeSet configure_fail_types_; // The set of types that have been cleaned up. - syncer::ModelTypeSet cleaned_types_; + ModelTypeSet cleaned_types_; // The set of types that have been downloaded. - syncer::ModelTypeSet downloaded_types_; + ModelTypeSet downloaded_types_; // For StopSyncingForShutdown's callback. MessageLoop* sync_loop_; diff --git a/sync/internal_api/public/test/test_entry_factory.h b/sync/internal_api/public/test/test_entry_factory.h index 931b8e7..83efe26 100644 --- a/sync/internal_api/public/test/test_entry_factory.h +++ b/sync/internal_api/public/test/test_entry_factory.h @@ -42,19 +42,19 @@ class TestEntryFactory { const syncable::Id& parent_id, const std::string& name, bool is_folder, - syncer::ModelType model_type, + ModelType model_type, int64* metahandle_out); // Creates an item that is both unsynced an an unapplied update. Returns the // metahandle of the created item. int64 CreateUnappliedAndUnsyncedItem(const std::string& name, - syncer::ModelType model_type); + ModelType model_type); // Creates an item that has neither IS_UNSYNED or IS_UNAPPLIED_UPDATE. The // item is known to both the server and client. Returns the metahandle of // the created item. - int64 CreateSyncedItem(const std::string& name, syncer::ModelType - model_type, bool is_folder); + int64 CreateSyncedItem(const std::string& name, + ModelType model_type, bool is_folder); int64 GetNextRevision(); diff --git a/sync/internal_api/public/test/test_internal_components_factory.h b/sync/internal_api/public/test/test_internal_components_factory.h index 628c712..4218d56 100644 --- a/sync/internal_api/public/test/test_internal_components_factory.h +++ b/sync/internal_api/public/test/test_internal_components_factory.h @@ -35,7 +35,7 @@ class TestInternalComponentsFactory : public InternalComponentsFactory { ThrottledDataTypeTracker* throttled_data_type_tracker, const std::vector<SyncEngineEventListener*>& listeners, sessions::DebugInfoGetter* debug_info_getter, - syncer::TrafficRecorder* traffic_recorder) OVERRIDE; + TrafficRecorder* traffic_recorder) OVERRIDE; virtual scoped_ptr<syncable::DirectoryBackingStore> BuildDirectoryBackingStore( diff --git a/sync/internal_api/public/test/test_user_share.h b/sync/internal_api/public/test/test_user_share.h index 7ce6ff8..ea811a1 100644 --- a/sync/internal_api/public/test/test_user_share.h +++ b/sync/internal_api/public/test/test_user_share.h @@ -3,7 +3,7 @@ // found in the LICENSE file. // // A handy class that takes care of setting up and destroying a -// syncer::UserShare instance for unit tests that require one. +// UserShare instance for unit tests that require one. // // The expected usage is to make this a component of your test fixture: // @@ -22,7 +22,7 @@ // Then, in your tests: // // TEST_F(AwesomenessTest, IsMaximal) { -// syncer::ReadTransaction trans(test_user_share_.user_share()); +// ReadTransaction trans(test_user_share_.user_share()); // ... // } // @@ -53,11 +53,11 @@ class TestUserShare { void TearDown(); // Non-NULL iff called between a call to SetUp() and TearDown(). - syncer::UserShare* user_share(); + UserShare* user_share(); private: scoped_ptr<TestDirectorySetterUpper> dir_maker_; - scoped_ptr<syncer::UserShare> user_share_; + scoped_ptr<UserShare> user_share_; DISALLOW_COPY_AND_ASSIGN(TestUserShare); }; diff --git a/sync/internal_api/public/util/immutable.h b/sync/internal_api/public/util/immutable.h index 290f130..683a5e6 100644 --- a/sync/internal_api/public/util/immutable.h +++ b/sync/internal_api/public/util/immutable.h @@ -25,8 +25,7 @@ // The last line incurs the cost of copying my_stuff, which is // undesirable. Here's the above code re-written using Immutable<T>: // -// void ProcessStuff( -// const syncer::Immutable<LargeObjectList>& stuff) { +// void ProcessStuff(const Immutable<LargeObjectList>& stuff) { // for (LargeObjectList::const_iterator it = stuff.Get().begin(); // it != stuff.Get().end(); ++it) { // ... process it ... diff --git a/sync/internal_api/public/util/weak_handle.h b/sync/internal_api/public/util/weak_handle.h index 0103e4e..2e49910 100644 --- a/sync/internal_api/public/util/weak_handle.h +++ b/sync/internal_api/public/util/weak_handle.h @@ -285,7 +285,7 @@ class WeakHandle { // Note that this doesn't override the regular copy constructor, so // that one can be called on any thread. template <typename U> - WeakHandle(const syncer::WeakHandle<U>& other) // NOLINT + WeakHandle(const WeakHandle<U>& other) // NOLINT : core_( other.IsInitialized() ? new internal::WeakHandleCore<T>(other.Get()) : diff --git a/sync/internal_api/public/write_node.h b/sync/internal_api/public/write_node.h index 6231850..1993cdb 100644 --- a/sync/internal_api/public/write_node.h +++ b/sync/internal_api/public/write_node.h @@ -64,7 +64,7 @@ class WriteNode : public BaseNode { // BaseNode implementation. virtual InitByLookupResult InitByIdLookup(int64 id) OVERRIDE; virtual InitByLookupResult InitByClientTagLookup( - syncer::ModelType model_type, + ModelType model_type, const std::string& tag) OVERRIDE; // Create a new node with the specified parent and predecessor. |model_type| @@ -73,7 +73,7 @@ class WriteNode : public BaseNode { // to indicate that this is to be the first child. // |predecessor| must be a child of |new_parent| or NULL. Returns false on // failure. - bool InitByCreation(syncer::ModelType model_type, + bool InitByCreation(ModelType model_type, const BaseNode& parent, const BaseNode* predecessor); @@ -84,7 +84,7 @@ class WriteNode : public BaseNode { // actually undelete it // Client unique tagged nodes must NOT be folders. InitUniqueByCreationResult InitUniqueByCreation( - syncer::ModelType model_type, + ModelType model_type, const BaseNode& parent, const std::string& client_tag); @@ -177,7 +177,7 @@ class WriteNode : public BaseNode { void* operator new(size_t size); // Node is meant for stack use only. // Helper to set model type. This will clear any specifics data. - void PutModelType(syncer::ModelType model_type); + void PutModelType(ModelType model_type); // Helper to set the previous node. bool PutPredecessor(const BaseNode* predecessor) WARN_UNUSED_RESULT; diff --git a/sync/internal_api/read_node.cc b/sync/internal_api/read_node.cc index 9f31781..84fe4b5 100644 --- a/sync/internal_api/read_node.cc +++ b/sync/internal_api/read_node.cc @@ -44,15 +44,14 @@ BaseNode::InitByLookupResult ReadNode::InitByIdLookup(int64 id) { return INIT_FAILED_ENTRY_NOT_GOOD; if (entry_->Get(syncable::IS_DEL)) return INIT_FAILED_ENTRY_IS_DEL; - syncer::ModelType model_type = GetModelType(); - LOG_IF(WARNING, model_type == syncer::UNSPECIFIED || - model_type == syncer::TOP_LEVEL_FOLDER) + ModelType model_type = GetModelType(); + LOG_IF(WARNING, model_type == UNSPECIFIED || model_type == TOP_LEVEL_FOLDER) << "SyncAPI InitByIdLookup referencing unusual object."; return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY; } BaseNode::InitByLookupResult ReadNode::InitByClientTagLookup( - syncer::ModelType model_type, + ModelType model_type, const std::string& tag) { DCHECK(!entry_) << "Init called twice"; if (tag.empty()) @@ -88,9 +87,8 @@ BaseNode::InitByLookupResult ReadNode::InitByTagLookup( return INIT_FAILED_ENTRY_NOT_GOOD; if (entry_->Get(syncable::IS_DEL)) return INIT_FAILED_ENTRY_IS_DEL; - syncer::ModelType model_type = GetModelType(); - LOG_IF(WARNING, model_type == syncer::UNSPECIFIED || - model_type == syncer::TOP_LEVEL_FOLDER) + ModelType model_type = GetModelType(); + LOG_IF(WARNING, model_type == UNSPECIFIED || model_type == TOP_LEVEL_FOLDER) << "SyncAPI InitByTagLookup referencing unusually typed object."; return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY; } diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc index 18d3ca7..6a164d8 100644 --- a/sync/internal_api/sync_manager_impl.cc +++ b/sync/internal_api/sync_manager_impl.cc @@ -54,6 +54,12 @@ using base::TimeDelta; using sync_pb::GetUpdatesCallerInfo; +namespace syncer { + +using sessions::SyncSessionContext; +using syncable::ImmutableWriteTransactionInfo; +using syncable::SPECIFICS; + namespace { // Delays for syncer nudges. @@ -62,16 +68,24 @@ static const int kPreferencesNudgeDelayMilliseconds = 2000; static const int kSyncRefreshDelayMsec = 500; static const int kSyncSchedulerDelayMsec = 250; +// The maximum number of times we will automatically overwrite the nigori node +// because the encryption keys don't match (per chrome instantiation). +static const int kNigoriOverwriteLimit = 10; + +// Maximum count and size for traffic recorder. +static const unsigned int kMaxMessagesToRecord = 10; +static const unsigned int kMaxMessageSizeToRecord = 5 * 1024; + GetUpdatesCallerInfo::GetUpdatesSource GetSourceFromReason( - syncer::ConfigureReason reason) { + ConfigureReason reason) { switch (reason) { - case syncer::CONFIGURE_REASON_RECONFIGURATION: + case CONFIGURE_REASON_RECONFIGURATION: return GetUpdatesCallerInfo::RECONFIGURATION; - case syncer::CONFIGURE_REASON_MIGRATION: + case CONFIGURE_REASON_MIGRATION: return GetUpdatesCallerInfo::MIGRATION; - case syncer::CONFIGURE_REASON_NEW_CLIENT: + case CONFIGURE_REASON_NEW_CLIENT: return GetUpdatesCallerInfo::NEW_CLIENT; - case syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE: + case CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE: return GetUpdatesCallerInfo::NEWLY_SUPPORTED_DATATYPE; default: NOTREACHED(); @@ -79,21 +93,7 @@ GetUpdatesCallerInfo::GetUpdatesSource GetSourceFromReason( return GetUpdatesCallerInfo::UNKNOWN; } -// The maximum number of times we will automatically overwrite the nigori node -// because the encryption keys don't match (per chrome instantiation). -static const int kNigoriOverwriteLimit = 10; - -} // namespace - -namespace syncer { - -using sessions::SyncSessionContext; -using syncable::ImmutableWriteTransactionInfo; -using syncable::SPECIFICS; - -// Maximum count and size for traffic recorder. -const unsigned int kMaxMessagesToRecord = 10; -const unsigned int kMaxMessageSizeToRecord = 5 * 1024; +} // namespace // A class to calculate nudge delays for types. class NudgeStrategy { @@ -124,10 +124,10 @@ class NudgeStrategy { static NudgeDelayStrategy GetNudgeDelayStrategy(const ModelType& type) { switch (type) { - case syncer::AUTOFILL: + case AUTOFILL: return ACCOMPANY_ONLY; - case syncer::PREFERENCES: - case syncer::SESSIONS: + case PREFERENCES: + case SESSIONS: return CUSTOM; default: return IMMEDIATE; @@ -146,16 +146,15 @@ class NudgeStrategy { kDefaultNudgeDelayMilliseconds); break; case ACCOMPANY_ONLY: - delay = TimeDelta::FromSeconds( - syncer::kDefaultShortPollIntervalSeconds); + delay = TimeDelta::FromSeconds(kDefaultShortPollIntervalSeconds); break; case CUSTOM: switch (model_type) { - case syncer::PREFERENCES: + case PREFERENCES: delay = TimeDelta::FromMilliseconds( kPreferencesNudgeDelayMilliseconds); break; - case syncer::SESSIONS: + case SESSIONS: delay = core->scheduler()->GetSessionsCommitDelay(); break; default: @@ -182,10 +181,9 @@ SyncManagerImpl::SyncManagerImpl(const std::string& name) report_unrecoverable_error_function_(NULL), nigori_overwrite_count_(0) { // Pre-fill |notification_info_map_|. - for (int i = syncer::FIRST_REAL_MODEL_TYPE; - i < syncer::MODEL_TYPE_COUNT; ++i) { + for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { notification_info_map_.insert( - std::make_pair(syncer::ModelTypeFromInt(i), NotificationInfo())); + std::make_pair(ModelTypeFromInt(i), NotificationInfo())); } // Bind message handlers. @@ -236,8 +234,7 @@ bool SyncManagerImpl::VisiblePositionsDiffer( const syncable::EntryKernel& b = mutation.mutated; // If the datatype isn't one where the browser model cares about position, // don't bother notifying that data model of position-only changes. - if (!ShouldMaintainPosition( - syncer::GetModelTypeFromSpecifics(b.ref(SPECIFICS)))) { + if (!ShouldMaintainPosition(GetModelTypeFromSpecifics(b.ref(SPECIFICS)))) { return false; } if (a.ref(syncable::NEXT_ID) != b.ref(syncable::NEXT_ID)) @@ -254,12 +251,11 @@ bool SyncManagerImpl::VisiblePropertiesDiffer( const syncable::EntryKernel& b = mutation.mutated; const sync_pb::EntitySpecifics& a_specifics = a.ref(SPECIFICS); const sync_pb::EntitySpecifics& b_specifics = b.ref(SPECIFICS); - DCHECK_EQ(syncer::GetModelTypeFromSpecifics(a_specifics), - syncer::GetModelTypeFromSpecifics(b_specifics)); - syncer::ModelType model_type = - syncer::GetModelTypeFromSpecifics(b_specifics); + DCHECK_EQ(GetModelTypeFromSpecifics(a_specifics), + GetModelTypeFromSpecifics(b_specifics)); + ModelType model_type = GetModelTypeFromSpecifics(b_specifics); // Suppress updates to items that aren't tracked by any browser model. - if (model_type < syncer::FIRST_REAL_MODEL_TYPE || + if (model_type < FIRST_REAL_MODEL_TYPE || !a.ref(syncable::UNIQUE_SERVER_TAG).empty()) { return false; } @@ -281,7 +277,7 @@ bool SyncManagerImpl::VisiblePropertiesDiffer( } bool SyncManagerImpl::ChangeBuffersAreEmpty() { - for (int i = 0; i < syncer::MODEL_TYPE_COUNT; ++i) { + for (int i = 0; i < MODEL_TYPE_COUNT; ++i) { if (!change_buffers_[i].IsEmpty()) return false; } @@ -295,17 +291,16 @@ void SyncManagerImpl::ThrowUnrecoverableError() { FROM_HERE, "Simulating unrecoverable error for testing purposes."); } -syncer::ModelTypeSet SyncManagerImpl::InitialSyncEndedTypes() { +ModelTypeSet SyncManagerImpl::InitialSyncEndedTypes() { DCHECK(initialized_); return directory()->initial_sync_ended_types(); } -syncer::ModelTypeSet SyncManagerImpl::GetTypesWithEmptyProgressMarkerToken( - syncer::ModelTypeSet types) { +ModelTypeSet SyncManagerImpl::GetTypesWithEmptyProgressMarkerToken( + ModelTypeSet types) { DCHECK(initialized_); - syncer::ModelTypeSet result; - for (syncer::ModelTypeSet::Iterator i = types.First(); - i.Good(); i.Inc()) { + ModelTypeSet result; + for (ModelTypeSet::Iterator i = types.First(); i.Good(); i.Inc()) { sync_pb::DataTypeProgressMarker marker; directory()->GetDownloadProgress(i.Get(), &marker); @@ -341,8 +336,8 @@ bool SyncManagerImpl::EncryptEverythingEnabledForTest() { void SyncManagerImpl::ConfigureSyncer( ConfigureReason reason, - const syncer::ModelTypeSet& types_to_config, - const syncer::ModelSafeRoutingInfo& new_routing_info, + const ModelTypeSet& types_to_config, + const ModelSafeRoutingInfo& new_routing_info, const base::Closure& ready_task, const base::Closure& retry_task) { DCHECK(thread_checker_.CalledOnValidThread()); @@ -360,7 +355,7 @@ void SyncManagerImpl::ConfigureSyncer( keystore_key_status, ready_task); - scheduler_->Start(syncer::SyncScheduler::CONFIGURATION_MODE); + scheduler_->Start(SyncScheduler::CONFIGURATION_MODE); if (!scheduler_->ScheduleConfiguration(params)) retry_task.Run(); @@ -374,12 +369,12 @@ bool SyncManagerImpl::Init( bool use_ssl, const scoped_refptr<base::TaskRunner>& blocking_task_runner, scoped_ptr<HttpPostProviderFactory> post_factory, - const syncer::ModelSafeRoutingInfo& model_safe_routing_info, - const std::vector<syncer::ModelSafeWorker*>& workers, - syncer::ExtensionsActivityMonitor* extensions_activity_monitor, + const ModelSafeRoutingInfo& model_safe_routing_info, + const std::vector<ModelSafeWorker*>& workers, + ExtensionsActivityMonitor* extensions_activity_monitor, SyncManager::ChangeDelegate* change_delegate, const SyncCredentials& credentials, - scoped_ptr<syncer::SyncNotifier> sync_notifier, + scoped_ptr<SyncNotifier> sync_notifier, const std::string& restored_key_for_bootstrapping, scoped_ptr<InternalComponentsFactory> internal_components_factory, Encryptor* encryptor, @@ -452,7 +447,7 @@ bool SyncManagerImpl::Init( bool success = SignIn(credentials); if (success) { - scheduler_->Start(syncer::SyncScheduler::CONFIGURATION_MODE); + scheduler_->Start(SyncScheduler::CONFIGURATION_MODE); initialized_ = true; @@ -500,7 +495,7 @@ void SyncManagerImpl::RefreshNigori(const std::string& chrome_version, const base::Closure& done_callback) { DCHECK(initialized_); DCHECK(thread_checker_.CalledOnValidThread()); - syncer::GetSessionName( + GetSessionName( blocking_task_runner_, base::Bind( &SyncManagerImpl::UpdateCryptographerAndNigoriCallback, @@ -547,7 +542,7 @@ void SyncManagerImpl::UpdateCryptographerAndNigoriCallback( const std::string& chrome_version, const base::Closure& done_callback, const std::string& session_name) { - if (!directory()->initial_sync_ended_for_type(syncer::NIGORI)) { + if (!directory()->initial_sync_ended_for_type(NIGORI)) { done_callback.Run(); // Should only happen during first time sync. return; } @@ -558,7 +553,7 @@ void SyncManagerImpl::UpdateCryptographerAndNigoriCallback( Cryptographer* cryptographer = trans.GetCryptographer(); WriteNode node(&trans); - if (node.InitByTagLookup(kNigoriTag) == syncer::BaseNode::INIT_OK) { + if (node.InitByTagLookup(kNigoriTag) == BaseNode::INIT_OK) { sync_pb::NigoriSpecifics nigori(node.GetNigoriSpecifics()); Cryptographer::UpdateResult result = cryptographer->Update(nigori); if (result == Cryptographer::NEEDS_PASSPHRASE) { @@ -566,7 +561,7 @@ void SyncManagerImpl::UpdateCryptographerAndNigoriCallback( if (cryptographer->has_pending_keys()) pending_keys = cryptographer->GetPendingKeys(); FOR_EACH_OBSERVER(SyncManager::Observer, observers_, - OnPassphraseRequired(syncer::REASON_DECRYPTION, + OnPassphraseRequired(REASON_DECRYPTION, pending_keys)); } @@ -634,7 +629,7 @@ void SyncManagerImpl::NotifyCryptographerState(Cryptographer * cryptographer) { } void SyncManagerImpl::StartSyncingNormally( - const syncer::ModelSafeRoutingInfo& routing_info) { + const ModelSafeRoutingInfo& routing_info) { // Start the sync scheduler. // TODO(sync): We always want the newest set of routes when we switch back // to normal mode. Figure out how to enforce set_routing_info is always @@ -657,10 +652,9 @@ bool SyncManagerImpl::OpenDirectory() { DCHECK(!initialized_) << "Should only happen once"; // Set before Open(). - change_observer_ = - syncer::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr()); + change_observer_ = MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr()); WeakHandle<syncable::TransactionObserver> transaction_observer( - syncer::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr())); + MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr())); syncable::DirOpenResult open_result = syncable::NOT_INITIALIZED; open_result = directory()->Open(username_for_share(), this, @@ -704,11 +698,10 @@ bool SyncManagerImpl::SignIn(const SyncCredentials& credentials) { } bool SyncManagerImpl::PurgePartiallySyncedTypes() { - syncer::ModelTypeSet partially_synced_types = - syncer::ModelTypeSet::All(); + ModelTypeSet partially_synced_types = ModelTypeSet::All(); partially_synced_types.RemoveAll(InitialSyncEndedTypes()); partially_synced_types.RemoveAll(GetTypesWithEmptyProgressMarkerToken( - syncer::ModelTypeSet::All())); + ModelTypeSet::All())); UMA_HISTOGRAM_COUNTS("Sync.PartiallySyncedTypes", partially_synced_types.Size()); @@ -755,7 +748,7 @@ void SyncManagerImpl::SetEncryptionPassphrase( Cryptographer* cryptographer = trans.GetCryptographer(); KeyParams key_params = {"localhost", "dummy", passphrase}; WriteNode node(&trans); - if (node.InitByTagLookup(kNigoriTag) != syncer::BaseNode::INIT_OK) { + if (node.InitByTagLookup(kNigoriTag) != BaseNode::INIT_OK) { // TODO(albertb): Plumb an UnrecoverableError all the way back to the PSS. NOTREACHED(); return; @@ -870,7 +863,7 @@ void SyncManagerImpl::SetDecryptionPassphrase( Cryptographer* cryptographer = trans.GetCryptographer(); KeyParams key_params = {"localhost", "dummy", passphrase}; WriteNode node(&trans); - if (node.InitByTagLookup(kNigoriTag) != syncer::BaseNode::INIT_OK) { + if (node.InitByTagLookup(kNigoriTag) != BaseNode::INIT_OK) { // TODO(albertb): Plumb an UnrecoverableError all the way back to the PSS. NOTREACHED(); return; @@ -1023,11 +1016,11 @@ void SyncManagerImpl::FinishSetPassphrase( << "was ready."; } else if (cryptographer->has_pending_keys()) { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, - OnPassphraseRequired(syncer::REASON_DECRYPTION, + OnPassphraseRequired(REASON_DECRYPTION, cryptographer->GetPendingKeys())); } else { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, - OnPassphraseRequired(syncer::REASON_ENCRYPTION, + OnPassphraseRequired(REASON_ENCRYPTION, sync_pb::EncryptedData())); } return; @@ -1059,7 +1052,7 @@ void SyncManagerImpl::FinishSetPassphrase( bool SyncManagerImpl::IsUsingExplicitPassphrase() { ReadTransaction trans(FROM_HERE, &share_); ReadNode node(&trans); - if (node.InitByTagLookup(kNigoriTag) != syncer::BaseNode::INIT_OK) { + if (node.InitByTagLookup(kNigoriTag) != BaseNode::INIT_OK) { // TODO(albertb): Plumb an UnrecoverableError all the way back to the PSS. NOTREACHED(); return false; @@ -1073,7 +1066,7 @@ void SyncManagerImpl::RefreshEncryption() { WriteTransaction trans(FROM_HERE, GetUserShare()); WriteNode node(&trans); - if (node.InitByTagLookup(kNigoriTag) != syncer::BaseNode::INIT_OK) { + if (node.InitByTagLookup(kNigoriTag) != BaseNode::INIT_OK) { NOTREACHED() << "Unable to set encrypted datatypes because Nigori node not " << "found."; return; @@ -1090,7 +1083,7 @@ void SyncManagerImpl::RefreshEncryption() { if (cryptographer->has_pending_keys()) pending_keys = cryptographer->GetPendingKeys(); FOR_EACH_OBSERVER(SyncManager::Observer, observers_, - OnPassphraseRequired(syncer::REASON_DECRYPTION, + OnPassphraseRequired(REASON_DECRYPTION, pending_keys)); return; } @@ -1113,15 +1106,15 @@ void SyncManagerImpl::ReEncryptEverything( Cryptographer* cryptographer = trans->GetCryptographer(); if (!cryptographer || !cryptographer->is_ready()) return; - syncer::ModelTypeSet encrypted_types = GetEncryptedTypes(trans); - for (syncer::ModelTypeSet::Iterator iter = encrypted_types.First(); + ModelTypeSet encrypted_types = GetEncryptedTypes(trans); + for (ModelTypeSet::Iterator iter = encrypted_types.First(); iter.Good(); iter.Inc()) { - if (iter.Get() == syncer::PASSWORDS || iter.Get() == syncer::NIGORI) + if (iter.Get() == PASSWORDS || iter.Get() == NIGORI) continue; // These types handle encryption differently. ReadNode type_root(trans); - std::string tag = syncer::ModelTypeToRootTag(iter.Get()); - if (type_root.InitByTagLookup(tag) != syncer::BaseNode::INIT_OK) + std::string tag = ModelTypeToRootTag(iter.Get()); + if (type_root.InitByTagLookup(tag) != BaseNode::INIT_OK) continue; // Don't try to reencrypt if the type's data is unavailable. // Iterate through all children of this datatype. @@ -1135,7 +1128,7 @@ void SyncManagerImpl::ReEncryptEverything( continue; WriteNode child(trans); - if (child.InitByIdLookup(child_id) != syncer::BaseNode::INIT_OK) { + if (child.InitByIdLookup(child_id) != BaseNode::INIT_OK) { NOTREACHED(); continue; } @@ -1154,13 +1147,12 @@ void SyncManagerImpl::ReEncryptEverything( // Passwords are encrypted with their own legacy scheme. Passwords are always // encrypted so we don't need to check GetEncryptedTypes() here. ReadNode passwords_root(trans); - std::string passwords_tag = syncer::ModelTypeToRootTag(syncer::PASSWORDS); - if (passwords_root.InitByTagLookup(passwords_tag) == - syncer::BaseNode::INIT_OK) { + std::string passwords_tag = ModelTypeToRootTag(PASSWORDS); + if (passwords_root.InitByTagLookup(passwords_tag) == BaseNode::INIT_OK) { int64 child_id = passwords_root.GetFirstChildId(); while (child_id != kInvalidId) { WriteNode child(trans); - if (child.InitByIdLookup(child_id) != syncer::BaseNode::INIT_OK) { + if (child.InitByIdLookup(child_id) != BaseNode::INIT_OK) { NOTREACHED(); return; } @@ -1261,19 +1253,18 @@ void SyncManagerImpl::OnServerConnectionEvent( const ServerConnectionEvent& event) { DCHECK(thread_checker_.CalledOnValidThread()); if (event.connection_code == - syncer::HttpResponse::SERVER_CONNECTION_OK) { + HttpResponse::SERVER_CONNECTION_OK) { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnConnectionStatusChange(CONNECTION_OK)); } - if (event.connection_code == syncer::HttpResponse::SYNC_AUTH_ERROR) { + if (event.connection_code == HttpResponse::SYNC_AUTH_ERROR) { observing_ip_address_changes_ = false; FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnConnectionStatusChange(CONNECTION_AUTH_ERROR)); } - if (event.connection_code == - syncer::HttpResponse::SYNC_SERVER_ERROR) { + if (event.connection_code == HttpResponse::SYNC_SERVER_ERROR) { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnConnectionStatusChange(CONNECTION_SERVER_ERROR)); } @@ -1315,9 +1306,8 @@ SyncManagerImpl::HandleTransactionEndingChangeEvent( ReadTransaction read_trans(GetUserShare(), trans); ModelTypeSet models_with_changes; - for (int i = syncer::FIRST_REAL_MODEL_TYPE; - i < syncer::MODEL_TYPE_COUNT; ++i) { - const syncer::ModelType type = syncer::ModelTypeFromInt(i); + for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { + const ModelType type = ModelTypeFromInt(i); if (change_buffers_[type].IsEmpty()) continue; @@ -1347,7 +1337,7 @@ void SyncManagerImpl::HandleCalculateChangesChangeEventFromSyncApi( "CALCULATE_CHANGES called with unapplied old changes."; // The mutated model type, or UNSPECIFIED if nothing was mutated. - syncer::ModelTypeSet mutated_model_types; + ModelTypeSet mutated_model_types; const syncable::ImmutableEntryKernelMutationMap& mutations = write_transaction_info.Get().mutations; @@ -1357,16 +1347,15 @@ void SyncManagerImpl::HandleCalculateChangesChangeEventFromSyncApi( continue; } - syncer::ModelType model_type = - syncer::GetModelTypeFromSpecifics( - it->second.mutated.ref(SPECIFICS)); - if (model_type < syncer::FIRST_REAL_MODEL_TYPE) { + ModelType model_type = + GetModelTypeFromSpecifics(it->second.mutated.ref(SPECIFICS)); + if (model_type < FIRST_REAL_MODEL_TYPE) { NOTREACHED() << "Permanent or underspecified item changed via syncapi."; continue; } // Found real mutation. - if (model_type != syncer::UNSPECIFIED) { + if (model_type != UNSPECIFIED) { mutated_model_types.Put(model_type); } } @@ -1385,14 +1374,14 @@ void SyncManagerImpl::HandleCalculateChangesChangeEventFromSyncApi( } void SyncManagerImpl::SetExtraChangeRecordData(int64 id, - syncer::ModelType type, ChangeReorderBuffer* buffer, + ModelType type, ChangeReorderBuffer* buffer, Cryptographer* cryptographer, const syncable::EntryKernel& original, bool existed_before, bool exists_now) { // If this is a deletion and the datatype was encrypted, we need to decrypt it // and attach it to the buffer. if (!exists_now && existed_before) { sync_pb::EntitySpecifics original_specifics(original.ref(SPECIFICS)); - if (type == syncer::PASSWORDS) { + if (type == PASSWORDS) { // Passwords must use their own legacy ExtraPasswordChangeRecordData. scoped_ptr<sync_pb::PasswordSpecificsData> data( DecryptPasswordSpecifics(original_specifics, cryptographer)); @@ -1431,10 +1420,9 @@ void SyncManagerImpl::HandleCalculateChangesChangeEventFromSyncer( bool exists_now = !it->second.mutated.ref(syncable::IS_DEL); // Omit items that aren't associated with a model. - syncer::ModelType type = - syncer::GetModelTypeFromSpecifics( - it->second.mutated.ref(SPECIFICS)); - if (type < syncer::FIRST_REAL_MODEL_TYPE) + ModelType type = + GetModelTypeFromSpecifics(it->second.mutated.ref(SPECIFICS)); + if (type < FIRST_REAL_MODEL_TYPE) continue; int64 handle = it->first; @@ -1468,7 +1456,7 @@ void SyncManagerImpl::RequestNudgeForDataTypes( types.First().Get(), this); scheduler_->ScheduleNudgeAsync(nudge_delay, - syncer::NUDGE_SOURCE_LOCAL, + NUDGE_SOURCE_LOCAL, types, nudge_location); } @@ -1494,14 +1482,14 @@ void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) { DVLOG(1) << "OnPassPhraseRequired Sent"; sync_pb::EncryptedData pending_keys = cryptographer->GetPendingKeys(); FOR_EACH_OBSERVER(SyncManager::Observer, observers_, - OnPassphraseRequired(syncer::REASON_DECRYPTION, + OnPassphraseRequired(REASON_DECRYPTION, pending_keys)); } else if (!cryptographer->is_ready() && - event.snapshot.initial_sync_ended().Has(syncer::NIGORI)) { + event.snapshot.initial_sync_ended().Has(NIGORI)) { DVLOG(1) << "OnPassphraseRequired sent because cryptographer is not " << "ready"; FOR_EACH_OBSERVER(SyncManager::Observer, observers_, - OnPassphraseRequired(syncer::REASON_ENCRYPTION, + OnPassphraseRequired(REASON_ENCRYPTION, sync_pb::EncryptedData())); } @@ -1520,8 +1508,7 @@ void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) { // that the nigori node is up to date at the end of each cycle. WriteTransaction trans(FROM_HERE, GetUserShare()); WriteNode nigori_node(&trans); - if (nigori_node.InitByTagLookup(kNigoriTag) == - syncer::BaseNode::INIT_OK) { + if (nigori_node.InitByTagLookup(kNigoriTag) == BaseNode::INIT_OK) { Cryptographer* cryptographer = trans.GetCryptographer(); UpdateNigoriEncryptionState(cryptographer, &nigori_node); } @@ -1540,8 +1527,7 @@ void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) { if (is_notifiable_commit) { if (sync_notifier_.get()) { const ModelTypeSet changed_types = - syncer::ModelTypePayloadMapToEnumSet( - event.snapshot.source().types); + ModelTypePayloadMapToEnumSet(event.snapshot.source().types); sync_notifier_->SendNotification(changed_types); } else { DVLOG(1) << "Not sending notification: sync_notifier_ is NULL"; @@ -1617,8 +1603,7 @@ DictionaryValue* SyncManagerImpl::NotificationInfoToValue( for (NotificationInfoMap::const_iterator it = notification_info.begin(); it != notification_info.end(); ++it) { - const std::string& model_type_str = - syncer::ModelTypeToString(it->first); + const std::string& model_type_str = ModelTypeToString(it->first); value->Set(model_type_str, it->second.ToValue()); } @@ -1690,7 +1675,7 @@ JsArgList GetNodeInfoById(const JsArgList& args, continue; } ReadNode node(&trans); - if (node.InitByIdLookup(id) != syncer::BaseNode::INIT_OK) { + if (node.InitByIdLookup(id) != BaseNode::INIT_OK) { continue; } node_summaries->Append((node.*info_getter)()); @@ -1747,7 +1732,7 @@ JsArgList SyncManagerImpl::GetChildNodeIds(const JsArgList& args) { } void SyncManagerImpl::OnEncryptedTypesChanged( - syncer::ModelTypeSet encrypted_types, + ModelTypeSet encrypted_types, bool encrypt_everything) { // NOTE: We're in a transaction. FOR_EACH_OBSERVER( @@ -1756,8 +1741,8 @@ void SyncManagerImpl::OnEncryptedTypesChanged( } void SyncManagerImpl::UpdateNotificationInfo( - const syncer::ModelTypePayloadMap& type_payloads) { - for (syncer::ModelTypePayloadMap::const_iterator it = type_payloads.begin(); + const ModelTypePayloadMap& type_payloads) { + for (ModelTypePayloadMap::const_iterator it = type_payloads.begin(); it != type_payloads.end(); ++it) { NotificationInfo* info = ¬ification_info_map_[it->first]; info->total_count++; @@ -1783,9 +1768,9 @@ void SyncManagerImpl::OnNotificationsEnabled() { } void SyncManagerImpl::OnNotificationsDisabled( - syncer::NotificationsDisabledReason reason) { + NotificationsDisabledReason reason) { DVLOG(1) << "Notifications disabled with reason " - << syncer::NotificationsDisabledReasonToString(reason); + << NotificationsDisabledReasonToString(reason); allstatus_.SetNotificationsEnabled(false); scheduler_->SetNotificationsEnabled(false); if (js_event_handler_.IsInitialized()) { @@ -1801,18 +1786,18 @@ void SyncManagerImpl::OnNotificationsDisabled( } void SyncManagerImpl::OnIncomingNotification( - const syncer::ModelTypePayloadMap& type_payloads, - syncer::IncomingNotificationSource source) { + const ModelTypePayloadMap& type_payloads, + IncomingNotificationSource source) { DCHECK(thread_checker_.CalledOnValidThread()); - if (source == syncer::LOCAL_NOTIFICATION) { + if (source == LOCAL_NOTIFICATION) { scheduler_->ScheduleNudgeWithPayloadsAsync( TimeDelta::FromMilliseconds(kSyncRefreshDelayMsec), - syncer::NUDGE_SOURCE_LOCAL_REFRESH, + NUDGE_SOURCE_LOCAL_REFRESH, type_payloads, FROM_HERE); } else if (!type_payloads.empty()) { scheduler_->ScheduleNudgeWithPayloadsAsync( TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec), - syncer::NUDGE_SOURCE_NOTIFICATION, + NUDGE_SOURCE_NOTIFICATION, type_payloads, FROM_HERE); allstatus_.IncrementNotificationsReceived(); UpdateNotificationInfo(type_payloads); @@ -1825,14 +1810,13 @@ void SyncManagerImpl::OnIncomingNotification( DictionaryValue details; ListValue* changed_types = new ListValue(); details.Set("changedTypes", changed_types); - for (syncer::ModelTypePayloadMap::const_iterator - it = type_payloads.begin(); + for (ModelTypePayloadMap::const_iterator it = type_payloads.begin(); it != type_payloads.end(); ++it) { const std::string& model_type_str = - syncer::ModelTypeToString(it->first); + ModelTypeToString(it->first); changed_types->Append(Value::CreateStringValue(model_type_str)); } - details.SetString("source", (source == syncer::LOCAL_NOTIFICATION) ? + details.SetString("source", (source == LOCAL_NOTIFICATION) ? "LOCAL_NOTIFICATION" : "REMOTE_NOTIFICATION"); js_event_handler_.Call(FROM_HERE, &JsEventHandler::HandleJsEvent, @@ -1858,15 +1842,15 @@ UserShare* SyncManagerImpl::GetUserShare() { return &share_; } -syncer::ModelTypeSet SyncManagerImpl::GetEncryptedDataTypesForTest() { +ModelTypeSet SyncManagerImpl::GetEncryptedDataTypesForTest() { ReadTransaction trans(FROM_HERE, GetUserShare()); return GetEncryptedTypes(&trans); } -bool SyncManagerImpl::ReceivedExperiment(syncer::Experiments* experiments) { +bool SyncManagerImpl::ReceivedExperiment(Experiments* experiments) { ReadTransaction trans(FROM_HERE, GetUserShare()); ReadNode node(&trans); - if (node.InitByTagLookup(kNigoriTag) != syncer::BaseNode::INIT_OK) { + if (node.InitByTagLookup(kNigoriTag) != BaseNode::INIT_OK) { DVLOG(1) << "Couldn't find Nigori node."; return false; } @@ -1879,7 +1863,7 @@ bool SyncManagerImpl::ReceivedExperiment(syncer::Experiments* experiments) { } bool SyncManagerImpl::HasUnsyncedItems() { - syncer::ReadTransaction trans(FROM_HERE, GetUserShare()); + ReadTransaction trans(FROM_HERE, GetUserShare()); return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0); } @@ -1890,19 +1874,17 @@ void SyncManagerImpl::SimulateEnableNotificationsForTest() { void SyncManagerImpl::SimulateDisableNotificationsForTest(int reason) { DCHECK(thread_checker_.CalledOnValidThread()); - OnNotificationsDisabled( - static_cast<syncer::NotificationsDisabledReason>(reason)); + OnNotificationsDisabled(static_cast<NotificationsDisabledReason>(reason)); } void SyncManagerImpl::TriggerOnIncomingNotificationForTest( ModelTypeSet model_types) { DCHECK(thread_checker_.CalledOnValidThread()); - syncer::ModelTypePayloadMap model_types_with_payloads = - syncer::ModelTypePayloadMapFromEnumSet(model_types, + ModelTypePayloadMap model_types_with_payloads = + ModelTypePayloadMapFromEnumSet(model_types, std::string()); - OnIncomingNotification(model_types_with_payloads, - syncer::REMOTE_NOTIFICATION); + OnIncomingNotification(model_types_with_payloads, REMOTE_NOTIFICATION); } // static. diff --git a/sync/internal_api/sync_manager_impl.h b/sync/internal_api/sync_manager_impl.h index 7f9691f..75f9c337 100644 --- a/sync/internal_api/sync_manager_impl.h +++ b/sync/internal_api/sync_manager_impl.h @@ -59,41 +59,41 @@ class SyncManagerImpl : public SyncManager, // SyncManager implementation. virtual bool Init( const FilePath& database_location, - const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, + const WeakHandle<JsEventHandler>& event_handler, const std::string& sync_server_and_path, int sync_server_port, bool use_ssl, const scoped_refptr<base::TaskRunner>& blocking_task_runner, scoped_ptr<HttpPostProviderFactory> post_factory, - const syncer::ModelSafeRoutingInfo& model_safe_routing_info, - const std::vector<syncer::ModelSafeWorker*>& workers, - syncer::ExtensionsActivityMonitor* extensions_activity_monitor, + const ModelSafeRoutingInfo& model_safe_routing_info, + const std::vector<ModelSafeWorker*>& workers, + ExtensionsActivityMonitor* extensions_activity_monitor, SyncManager::ChangeDelegate* change_delegate, const SyncCredentials& credentials, - scoped_ptr<syncer::SyncNotifier> sync_notifier, + scoped_ptr<SyncNotifier> sync_notifier, const std::string& restored_key_for_bootstrapping, scoped_ptr<InternalComponentsFactory> internal_components_factory, - syncer::Encryptor* encryptor, - syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, - syncer::ReportUnrecoverableErrorFunction + Encryptor* encryptor, + UnrecoverableErrorHandler* unrecoverable_error_handler, + ReportUnrecoverableErrorFunction report_unrecoverable_error_function) OVERRIDE; virtual void ThrowUnrecoverableError() OVERRIDE; - virtual syncer::ModelTypeSet InitialSyncEndedTypes() OVERRIDE; - virtual syncer::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( - syncer::ModelTypeSet types) OVERRIDE; + virtual ModelTypeSet InitialSyncEndedTypes() OVERRIDE; + virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( + ModelTypeSet types) OVERRIDE; virtual bool PurgePartiallySyncedTypes() OVERRIDE; virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE; virtual void UpdateEnabledTypes( - const syncer::ModelTypeSet& enabled_types) OVERRIDE; + const ModelTypeSet& enabled_types) OVERRIDE; virtual void StartSyncingNormally( - const syncer::ModelSafeRoutingInfo& routing_info) OVERRIDE; + const ModelSafeRoutingInfo& routing_info) OVERRIDE; virtual void SetEncryptionPassphrase(const std::string& passphrase, bool is_explicit) OVERRIDE; virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE; virtual void ConfigureSyncer( ConfigureReason reason, - const syncer::ModelTypeSet& types_to_config, - const syncer::ModelSafeRoutingInfo& new_routing_info, + const ModelTypeSet& types_to_config, + const ModelSafeRoutingInfo& new_routing_info, const base::Closure& ready_task, const base::Closure& retry_task) OVERRIDE; virtual void AddObserver(SyncManager::Observer* observer) OVERRIDE; @@ -117,7 +117,7 @@ class SyncManagerImpl : public SyncManager, const base::Closure& done_callback) OVERRIDE; virtual void EnableEncryptEverything() OVERRIDE; - virtual bool ReceivedExperiment(syncer::Experiments* experiments) OVERRIDE; + virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE; virtual bool HasUnsyncedItems() OVERRIDE; // Return the currently active (validated) username for use with syncable @@ -132,11 +132,11 @@ class SyncManagerImpl : public SyncManager, // Gets the set of encrypted types from the cryptographer // Note: opens a transaction. May be called from any thread. - syncer::ModelTypeSet GetEncryptedDataTypesForTest(); + ModelTypeSet GetEncryptedDataTypesForTest(); void SimulateEnableNotificationsForTest(); void SimulateDisableNotificationsForTest(int reason); - void TriggerOnIncomingNotificationForTest(syncer::ModelTypeSet model_types); + void TriggerOnIncomingNotificationForTest(ModelTypeSet model_types); static int GetDefaultNudgeDelay(); static int GetPreferencesNudgeDelay(); @@ -173,16 +173,16 @@ class SyncManagerImpl : public SyncManager, // Cryptographer::Observer implementation. virtual void OnEncryptedTypesChanged( - syncer::ModelTypeSet encrypted_types, + ModelTypeSet encrypted_types, bool encrypt_everything) OVERRIDE; // SyncNotifierObserver implementation. virtual void OnNotificationsEnabled() OVERRIDE; virtual void OnNotificationsDisabled( - syncer::NotificationsDisabledReason reason) OVERRIDE; + NotificationsDisabledReason reason) OVERRIDE; virtual void OnIncomingNotification( - const syncer::ModelTypePayloadMap& type_payloads, - syncer::IncomingNotificationSource source) OVERRIDE; + const ModelTypePayloadMap& type_payloads, + IncomingNotificationSource source) OVERRIDE; // Called only by our NetworkChangeNotifier. virtual void OnIPAddressChanged() OVERRIDE; @@ -206,9 +206,9 @@ class SyncManagerImpl : public SyncManager, DictionaryValue* ToValue() const; }; - base::TimeDelta GetNudgeDelayTimeDelta(const syncer::ModelType& model_type); + base::TimeDelta GetNudgeDelayTimeDelta(const ModelType& model_type); - typedef std::map<syncer::ModelType, NotificationInfo> NotificationInfoMap; + typedef std::map<ModelType, NotificationInfo> NotificationInfoMap; typedef JsArgList (SyncManagerImpl::*UnboundJsMessageHandler)( const JsArgList&); typedef base::Callback<JsArgList(const JsArgList&)> JsMessageHandler; @@ -251,7 +251,7 @@ class SyncManagerImpl : public SyncManager, // ExtraPasswordChangeRecordData field of |buffer|. Otherwise sets // |buffer|'s specifics field to contain the unencrypted data. void SetExtraChangeRecordData(int64 id, - syncer::ModelType type, + ModelType type, ChangeReorderBuffer* buffer, Cryptographer* cryptographer, const syncable::EntryKernel& original, @@ -298,7 +298,7 @@ class SyncManagerImpl : public SyncManager, // Called for every notification. This updates the notification statistics // to be displayed in about:sync. void UpdateNotificationInfo( - const syncer::ModelTypePayloadMap& type_payloads); + const ModelTypePayloadMap& type_payloads); // Checks for server reachabilty and requests a nudge. void OnIPAddressChangedImpl(); @@ -352,7 +352,7 @@ class SyncManagerImpl : public SyncManager, // This can be called from any thread, but only between calls to // OpenDirectory() and ShutdownOnSyncThread(). - syncer::WeakHandle<SyncManager::ChangeObserver> change_observer_; + WeakHandle<SyncManager::ChangeObserver> change_observer_; ObserverList<SyncManager::Observer> observers_; @@ -369,7 +369,7 @@ class SyncManagerImpl : public SyncManager, scoped_ptr<SyncScheduler> scheduler_; // The SyncNotifier which notifies us when updates need to be downloaded. - scoped_ptr<syncer::SyncNotifier> sync_notifier_; + scoped_ptr<SyncNotifier> sync_notifier_; // A multi-purpose status watch object that aggregates stats from various // sync components. @@ -381,7 +381,7 @@ class SyncManagerImpl : public SyncManager, // forwarded to the observer slightly later, at the TRANSACTION_ENDING // step by HandleTransactionEndingChangeEvent. The list is cleared in the // TRANSACTION_COMPLETE step by HandleTransactionCompleteChangeEvent. - ChangeReorderBuffer change_buffers_[syncer::MODEL_TYPE_COUNT]; + ChangeReorderBuffer change_buffers_[MODEL_TYPE_COUNT]; SyncManager::ChangeDelegate* change_delegate_; @@ -400,12 +400,12 @@ class SyncManagerImpl : public SyncManager, JsSyncManagerObserver js_sync_manager_observer_; JsMutationEventObserver js_mutation_event_observer_; - syncer::ThrottledDataTypeTracker throttled_data_type_tracker_; + ThrottledDataTypeTracker throttled_data_type_tracker_; // This is for keeping track of client events to send to the server. DebugInfoEventListener debug_info_event_listener_; - syncer::TrafficRecorder traffic_recorder_; + TrafficRecorder traffic_recorder_; Encryptor* encryptor_; UnrecoverableErrorHandler* unrecoverable_error_handler_; diff --git a/sync/internal_api/syncapi_internal.cc b/sync/internal_api/syncapi_internal.cc index 282082b..a6530ac 100644 --- a/sync/internal_api/syncapi_internal.cc +++ b/sync/internal_api/syncapi_internal.cc @@ -9,8 +9,6 @@ #include "sync/protocol/sync.pb.h" #include "sync/util/cryptographer.h" -using syncer::Cryptographer; - namespace syncer { sync_pb::PasswordSpecificsData* DecryptPasswordSpecifics( @@ -54,7 +52,7 @@ bool IsNameServerIllegalAfterTrimming(const std::string& name) { } // Compare the values of two EntitySpecifics, accounting for encryption. -bool AreSpecificsEqual(const syncer::Cryptographer* cryptographer, +bool AreSpecificsEqual(const Cryptographer* cryptographer, const sync_pb::EntitySpecifics& left, const sync_pb::EntitySpecifics& right) { // Note that we can't compare encrypted strings directly as they are seeded diff --git a/sync/internal_api/syncapi_internal.h b/sync/internal_api/syncapi_internal.h index afc9c0a..19932e8 100644 --- a/sync/internal_api/syncapi_internal.h +++ b/sync/internal_api/syncapi_internal.h @@ -21,14 +21,14 @@ class Cryptographer; sync_pb::PasswordSpecificsData* DecryptPasswordSpecifics( const sync_pb::EntitySpecifics& specifics, - syncer::Cryptographer* crypto); + Cryptographer* crypto); void SyncAPINameToServerName(const std::string& syncer_name, std::string* out); bool IsNameServerIllegalAfterTrimming(const std::string& name); -bool AreSpecificsEqual(const syncer::Cryptographer* cryptographer, +bool AreSpecificsEqual(const Cryptographer* cryptographer, const sync_pb::EntitySpecifics& left, const sync_pb::EntitySpecifics& right); } // namespace syncer diff --git a/sync/internal_api/syncapi_server_connection_manager.cc b/sync/internal_api/syncapi_server_connection_manager.cc index 63f96c9..319a5aa 100644 --- a/sync/internal_api/syncapi_server_connection_manager.cc +++ b/sync/internal_api/syncapi_server_connection_manager.cc @@ -9,12 +9,10 @@ #include "sync/internal_api/public/http_post_provider_factory.h" #include "sync/internal_api/public/http_post_provider_interface.h" -using syncer::HttpResponse; - namespace syncer { SyncAPIBridgedConnection::SyncAPIBridgedConnection( - syncer::ServerConnectionManager* scm, + ServerConnectionManager* scm, HttpPostProviderFactory* factory) : Connection(scm), factory_(factory) { post_provider_ = factory_->Create(); @@ -97,7 +95,7 @@ SyncAPIServerConnectionManager::SyncAPIServerConnectionManager( SyncAPIServerConnectionManager::~SyncAPIServerConnectionManager() {} -syncer::ServerConnectionManager::Connection* +ServerConnectionManager::Connection* SyncAPIServerConnectionManager::MakeConnection() { return new SyncAPIBridgedConnection(this, post_provider_factory_.get()); } diff --git a/sync/internal_api/syncapi_server_connection_manager.h b/sync/internal_api/syncapi_server_connection_manager.h index 37b6fed..99656c1 100644 --- a/sync/internal_api/syncapi_server_connection_manager.h +++ b/sync/internal_api/syncapi_server_connection_manager.h @@ -19,10 +19,9 @@ class HttpPostProviderInterface; // This provides HTTP Post functionality through the interface provided // to the sync API by the application hosting the syncer backend. -class SyncAPIBridgedConnection - : public syncer::ServerConnectionManager::Connection { +class SyncAPIBridgedConnection : public ServerConnectionManager::Connection { public: - SyncAPIBridgedConnection(syncer::ServerConnectionManager* scm, + SyncAPIBridgedConnection(ServerConnectionManager* scm, HttpPostProviderFactory* factory); virtual ~SyncAPIBridgedConnection(); @@ -30,7 +29,7 @@ class SyncAPIBridgedConnection virtual bool Init(const char* path, const std::string& auth_token, const std::string& payload, - syncer::HttpResponse* response) OVERRIDE; + HttpResponse* response) OVERRIDE; virtual void Abort() OVERRIDE; @@ -47,8 +46,7 @@ class SyncAPIBridgedConnection // A ServerConnectionManager subclass used by the syncapi layer. We use a // subclass so that we can override MakePost() to generate a POST object using // an instance of the HttpPostProviderFactory class. -class SyncAPIServerConnectionManager - : public syncer::ServerConnectionManager { +class SyncAPIServerConnectionManager : public ServerConnectionManager { public: // Takes ownership of factory. SyncAPIServerConnectionManager(const std::string& server, diff --git a/sync/internal_api/syncapi_server_connection_manager_unittest.cc b/sync/internal_api/syncapi_server_connection_manager_unittest.cc index cf5dbf8..f90c5e8 100644 --- a/sync/internal_api/syncapi_server_connection_manager_unittest.cc +++ b/sync/internal_api/syncapi_server_connection_manager_unittest.cc @@ -16,14 +16,11 @@ #include "sync/internal_api/public/http_post_provider_interface.h" #include "testing/gtest/include/gtest/gtest.h" -using base::TimeDelta; -using syncer::HttpResponse; -using syncer::ServerConnectionManager; -using syncer::ScopedServerStatusWatcher; - namespace syncer { namespace { +using base::TimeDelta; + class BlockingHttpPost : public HttpPostProviderInterface { public: BlockingHttpPost() : wait_for_abort_(false, false) {} diff --git a/sync/internal_api/syncapi_unittest.cc b/sync/internal_api/syncapi_unittest.cc index 3fd67a6..f5eb675 100644 --- a/sync/internal_api/syncapi_unittest.cc +++ b/sync/internal_api/syncapi_unittest.cc @@ -109,7 +109,7 @@ void ExpectTimeValue(const base::Time& expected_value, const DictionaryValue& value, const std::string& key) { std::string time_str; EXPECT_TRUE(value.GetString(key, &time_str)); - EXPECT_EQ(syncer::GetTimeDebugString(expected_value), time_str); + EXPECT_EQ(GetTimeDebugString(expected_value), time_str); } // Makes a non-folder child of the root node. Returns the id of the @@ -121,9 +121,9 @@ int64 MakeNode(UserShare* share, ReadNode root_node(&trans); root_node.InitByRootLookup(); WriteNode node(&trans); - syncer::WriteNode::InitUniqueByCreationResult result = + WriteNode::InitUniqueByCreationResult result = node.InitUniqueByCreation(model_type, root_node, client_tag); - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); + EXPECT_EQ(WriteNode::INIT_SUCCESS, result); node.SetIsFolder(false); return node.GetId(); } @@ -138,9 +138,9 @@ int64 MakeNodeWithParent(UserShare* share, ReadNode parent_node(&trans); EXPECT_EQ(BaseNode::INIT_OK, parent_node.InitByIdLookup(parent_id)); WriteNode node(&trans); - syncer::WriteNode::InitUniqueByCreationResult result = + WriteNode::InitUniqueByCreationResult result = node.InitUniqueByCreation(model_type, parent_node, client_tag); - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); + EXPECT_EQ(WriteNode::INIT_SUCCESS, result); node.SetIsFolder(false); return node.GetId(); } @@ -166,11 +166,11 @@ int64 MakeFolderWithParent(UserShare* share, int64 MakeServerNodeForType(UserShare* share, ModelType model_type) { sync_pb::EntitySpecifics specifics; - syncer::AddDefaultFieldValue(model_type, &specifics); + AddDefaultFieldValue(model_type, &specifics); syncable::WriteTransaction trans( FROM_HERE, syncable::UNITTEST, share->directory.get()); // Attempt to lookup by nigori tag. - std::string type_tag = syncer::ModelTypeToRootTag(model_type); + std::string type_tag = ModelTypeToRootTag(model_type); syncable::Id node_id = syncable::Id::CreateFromServerId(type_tag); syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, node_id); @@ -197,7 +197,7 @@ int64 MakeServerNode(UserShare* share, ModelType model_type, syncable::WriteTransaction trans( FROM_HERE, syncable::UNITTEST, share->directory.get()); syncable::Entry root_entry(&trans, syncable::GET_BY_SERVER_TAG, - syncer::ModelTypeToRootTag(model_type)); + ModelTypeToRootTag(model_type)); EXPECT_TRUE(root_entry.good()); syncable::Id root_id = root_entry.Get(syncable::ID); syncable::Id node_id = syncable::Id::CreateFromServerId(client_tag); @@ -233,7 +233,7 @@ class SyncApiTest : public testing::Test { protected: MessageLoop message_loop_; - syncer::TestUserShare test_user_share_; + TestUserShare test_user_share_; }; TEST_F(SyncApiTest, SanityCheckTest) { @@ -263,13 +263,13 @@ TEST_F(SyncApiTest, BasicTagWrite) { } ignore_result(MakeNode(test_user_share_.user_share(), - syncer::BOOKMARKS, "testtag")); + BOOKMARKS, "testtag")); { ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, "testtag")); + node.InitByClientTagLookup(BOOKMARKS, "testtag")); ReadNode root_node(&trans); root_node.InitByRootLookup(); @@ -280,18 +280,18 @@ TEST_F(SyncApiTest, BasicTagWrite) { TEST_F(SyncApiTest, GenerateSyncableHash) { EXPECT_EQ("OyaXV5mEzrPS4wbogmtKvRfekAI=", - BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, "tag1")); + BaseNode::GenerateSyncableHash(BOOKMARKS, "tag1")); EXPECT_EQ("iNFQtRFQb+IZcn1kKUJEZDDkLs4=", - BaseNode::GenerateSyncableHash(syncer::PREFERENCES, "tag1")); + BaseNode::GenerateSyncableHash(PREFERENCES, "tag1")); EXPECT_EQ("gO1cPZQXaM73sHOvSA+tKCKFs58=", - BaseNode::GenerateSyncableHash(syncer::AUTOFILL, "tag1")); + BaseNode::GenerateSyncableHash(AUTOFILL, "tag1")); EXPECT_EQ("A0eYIHXM1/jVwKDDp12Up20IkKY=", - BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, "tag2")); + BaseNode::GenerateSyncableHash(BOOKMARKS, "tag2")); EXPECT_EQ("XYxkF7bhS4eItStFgiOIAU23swI=", - BaseNode::GenerateSyncableHash(syncer::PREFERENCES, "tag2")); + BaseNode::GenerateSyncableHash(PREFERENCES, "tag2")); EXPECT_EQ("GFiWzo5NGhjLlN+OyCfhy28DJTQ=", - BaseNode::GenerateSyncableHash(syncer::AUTOFILL, "tag2")); + BaseNode::GenerateSyncableHash(AUTOFILL, "tag2")); } TEST_F(SyncApiTest, ModelTypesSiloed) { @@ -303,28 +303,28 @@ TEST_F(SyncApiTest, ModelTypesSiloed) { } ignore_result(MakeNode(test_user_share_.user_share(), - syncer::BOOKMARKS, "collideme")); + BOOKMARKS, "collideme")); ignore_result(MakeNode(test_user_share_.user_share(), - syncer::PREFERENCES, "collideme")); + PREFERENCES, "collideme")); ignore_result(MakeNode(test_user_share_.user_share(), - syncer::AUTOFILL, "collideme")); + AUTOFILL, "collideme")); { ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); ReadNode bookmarknode(&trans); EXPECT_EQ(BaseNode::INIT_OK, - bookmarknode.InitByClientTagLookup(syncer::BOOKMARKS, + bookmarknode.InitByClientTagLookup(BOOKMARKS, "collideme")); ReadNode prefnode(&trans); EXPECT_EQ(BaseNode::INIT_OK, - prefnode.InitByClientTagLookup(syncer::PREFERENCES, + prefnode.InitByClientTagLookup(PREFERENCES, "collideme")); ReadNode autofillnode(&trans); EXPECT_EQ(BaseNode::INIT_OK, - autofillnode.InitByClientTagLookup(syncer::AUTOFILL, + autofillnode.InitByClientTagLookup(AUTOFILL, "collideme")); EXPECT_NE(bookmarknode.GetId(), prefnode.GetId()); @@ -338,14 +338,14 @@ TEST_F(SyncApiTest, ReadMissingTagsFails) { ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_NOT_GOOD, - node.InitByClientTagLookup(syncer::BOOKMARKS, + node.InitByClientTagLookup(BOOKMARKS, "testtag")); } { WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_NOT_GOOD, - node.InitByClientTagLookup(syncer::BOOKMARKS, + node.InitByClientTagLookup(BOOKMARKS, "testtag")); } } @@ -364,14 +364,14 @@ TEST_F(SyncApiTest, TestDeleteBehavior) { // we'll use this spare folder later WriteNode folder_node(&trans); - EXPECT_TRUE(folder_node.InitByCreation(syncer::BOOKMARKS, + EXPECT_TRUE(folder_node.InitByCreation(BOOKMARKS, root_node, NULL)); folder_id = folder_node.GetId(); WriteNode wnode(&trans); - syncer::WriteNode::InitUniqueByCreationResult result = - wnode.InitUniqueByCreation(syncer::BOOKMARKS, root_node, "testtag"); - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); + WriteNode::InitUniqueByCreationResult result = + wnode.InitUniqueByCreation(BOOKMARKS, root_node, "testtag"); + EXPECT_EQ(WriteNode::INIT_SUCCESS, result); wnode.SetIsFolder(false); wnode.SetTitle(UTF8ToWide(test_title)); @@ -383,7 +383,7 @@ TEST_F(SyncApiTest, TestDeleteBehavior) { WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); WriteNode wnode(&trans); EXPECT_EQ(BaseNode::INIT_OK, - wnode.InitByClientTagLookup(syncer::BOOKMARKS, + wnode.InitByClientTagLookup(BOOKMARKS, "testtag")); EXPECT_FALSE(wnode.GetIsFolder()); EXPECT_EQ(wnode.GetTitle(), test_title); @@ -397,7 +397,7 @@ TEST_F(SyncApiTest, TestDeleteBehavior) { ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_IS_DEL, - node.InitByClientTagLookup(syncer::BOOKMARKS, + node.InitByClientTagLookup(BOOKMARKS, "testtag")); // Note that for proper function of this API this doesn't need to be // filled, we're checking just to make sure the DB worked in this test. @@ -411,9 +411,9 @@ TEST_F(SyncApiTest, TestDeleteBehavior) { WriteNode wnode(&trans); // This will undelete the tag. - syncer::WriteNode::InitUniqueByCreationResult result = - wnode.InitUniqueByCreation(syncer::BOOKMARKS, folder_node, "testtag"); - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); + WriteNode::InitUniqueByCreationResult result = + wnode.InitUniqueByCreation(BOOKMARKS, folder_node, "testtag"); + EXPECT_EQ(WriteNode::INIT_SUCCESS, result); EXPECT_EQ(wnode.GetIsFolder(), false); EXPECT_EQ(wnode.GetParentId(), folder_node.GetId()); EXPECT_EQ(wnode.GetId(), node_id); @@ -426,10 +426,10 @@ TEST_F(SyncApiTest, TestDeleteBehavior) { ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, + node.InitByClientTagLookup(BOOKMARKS, "testtag")); EXPECT_EQ(node.GetTitle(), test_title); - EXPECT_EQ(node.GetModelType(), syncer::BOOKMARKS); + EXPECT_EQ(node.GetModelType(), BOOKMARKS); } } @@ -445,10 +445,10 @@ TEST_F(SyncApiTest, WriteAndReadPassword) { root_node.InitByRootLookup(); WriteNode password_node(&trans); - syncer::WriteNode::InitUniqueByCreationResult result = - password_node.InitUniqueByCreation(syncer::PASSWORDS, + WriteNode::InitUniqueByCreationResult result = + password_node.InitUniqueByCreation(PASSWORDS, root_node, "foo"); - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); + EXPECT_EQ(WriteNode::INIT_SUCCESS, result); sync_pb::PasswordSpecificsData data; data.set_password_value("secret"); password_node.SetPasswordSpecifics(data); @@ -460,8 +460,7 @@ TEST_F(SyncApiTest, WriteAndReadPassword) { ReadNode password_node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - password_node.InitByClientTagLookup(syncer::PASSWORDS, - "foo")); + password_node.InitByClientTagLookup(PASSWORDS, "foo")); const sync_pb::PasswordSpecificsData& data = password_node.GetPasswordSpecifics(); EXPECT_EQ("secret", data.password_value()); @@ -481,16 +480,16 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) { root_node.InitByRootLookup(); WriteNode bookmark_node(&trans); - syncer::WriteNode::InitUniqueByCreationResult result = - bookmark_node.InitUniqueByCreation(syncer::BOOKMARKS, + WriteNode::InitUniqueByCreationResult result = + bookmark_node.InitUniqueByCreation(BOOKMARKS, root_node, "foo"); - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); + EXPECT_EQ(WriteNode::INIT_SUCCESS, result); bookmark_node.SetTitle(UTF8ToWide("foo")); WriteNode pref_node(&trans); result = - pref_node.InitUniqueByCreation(syncer::PREFERENCES, root_node, "bar"); - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); + pref_node.InitUniqueByCreation(PREFERENCES, root_node, "bar"); + EXPECT_EQ(WriteNode::INIT_SUCCESS, result); pref_node.SetTitle(UTF8ToWide("bar")); } { @@ -500,7 +499,7 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) { ReadNode bookmark_node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - bookmark_node.InitByClientTagLookup(syncer::BOOKMARKS, + bookmark_node.InitByClientTagLookup(BOOKMARKS, "foo")); EXPECT_EQ("foo", bookmark_node.GetTitle()); EXPECT_EQ(kEncryptedString, @@ -508,7 +507,7 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) { ReadNode pref_node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - pref_node.InitByClientTagLookup(syncer::PREFERENCES, + pref_node.InitByClientTagLookup(PREFERENCES, "bar")); EXPECT_EQ(kEncryptedString, pref_node.GetTitle()); } @@ -516,7 +515,7 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) { TEST_F(SyncApiTest, BaseNodeSetSpecifics) { int64 child_id = MakeNode(test_user_share_.user_share(), - syncer::BOOKMARKS, "testtag"); + BOOKMARKS, "testtag"); WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(child_id)); @@ -533,7 +532,7 @@ TEST_F(SyncApiTest, BaseNodeSetSpecifics) { TEST_F(SyncApiTest, BaseNodeSetSpecificsPreservesUnknownFields) { int64 child_id = MakeNode(test_user_share_.user_share(), - syncer::BOOKMARKS, "testtag"); + BOOKMARKS, "testtag"); WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(child_id)); @@ -565,12 +564,12 @@ void CheckNodeValue(const BaseNode& node, const DictionaryValue& value, ModelType expected_model_type = node.GetModelType(); std::string type_str; EXPECT_TRUE(value.GetString("type", &type_str)); - if (expected_model_type >= syncer::FIRST_REAL_MODEL_TYPE) { - ModelType model_type = syncer::ModelTypeFromString(type_str); + if (expected_model_type >= FIRST_REAL_MODEL_TYPE) { + ModelType model_type = ModelTypeFromString(type_str); EXPECT_EQ(expected_model_type, model_type); - } else if (expected_model_type == syncer::TOP_LEVEL_FOLDER) { + } else if (expected_model_type == TOP_LEVEL_FOLDER) { EXPECT_EQ("Top-level folder", type_str); - } else if (expected_model_type == syncer::UNSPECIFIED) { + } else if (expected_model_type == UNSPECIFIED) { EXPECT_EQ("Unspecified", type_str); } else { ADD_FAILURE(); @@ -627,9 +626,9 @@ TEST_F(SyncApiTest, EmptyTags) { root_node.InitByRootLookup(); WriteNode node(&trans); std::string empty_tag; - syncer::WriteNode::InitUniqueByCreationResult result = - node.InitUniqueByCreation(syncer::TYPED_URLS, root_node, empty_tag); - EXPECT_NE(syncer::WriteNode::INIT_SUCCESS, result); + WriteNode::InitUniqueByCreationResult result = + node.InitUniqueByCreation(TYPED_URLS, root_node, empty_tag); + EXPECT_NE(WriteNode::INIT_SUCCESS, result); EXPECT_EQ(BaseNode::INIT_FAILED_PRECONDITION, node.InitByTagLookup(empty_tag)); } @@ -681,7 +680,7 @@ class SyncManagerObserverMock : public SyncManager::Observer { void(const WeakHandle<JsBackend>&, bool)); // NOLINT MOCK_METHOD1(OnConnectionStatusChange, void(ConnectionStatus)); // NOLINT MOCK_METHOD2(OnPassphraseRequired, - void(syncer::PassphraseRequiredReason, + void(PassphraseRequiredReason, const sync_pb::EncryptedData&)); // NOLINT MOCK_METHOD0(OnPassphraseAccepted, void()); // NOLINT MOCK_METHOD1(OnBootstrapTokenUpdated, void(const std::string&)); // NOLINT @@ -691,20 +690,20 @@ class SyncManagerObserverMock : public SyncManager::Observer { void(ModelTypeSet, bool)); // NOLINT MOCK_METHOD0(OnEncryptionComplete, void()); // NOLINT MOCK_METHOD1(OnActionableError, - void(const syncer::SyncProtocolError&)); // NOLINT + void(const SyncProtocolError&)); // NOLINT }; -class SyncNotifierMock : public syncer::SyncNotifier { +class SyncNotifierMock : public SyncNotifier { public: - MOCK_METHOD1(AddObserver, void(syncer::SyncNotifierObserver*)); - MOCK_METHOD1(RemoveObserver, void(syncer::SyncNotifierObserver*)); + MOCK_METHOD1(AddObserver, void(SyncNotifierObserver*)); + MOCK_METHOD1(RemoveObserver, void(SyncNotifierObserver*)); MOCK_METHOD1(SetUniqueId, void(const std::string&)); MOCK_METHOD1(SetStateDeprecated, void(const std::string&)); MOCK_METHOD2(UpdateCredentials, void(const std::string&, const std::string&)); MOCK_METHOD1(UpdateEnabledTypes, - void(syncer::ModelTypeSet)); - MOCK_METHOD1(SendNotification, void(syncer::ModelTypeSet)); + void(ModelTypeSet)); + MOCK_METHOD1(SendNotification, void(ModelTypeSet)); }; } // namespace @@ -804,29 +803,29 @@ class SyncManagerTest : public testing::Test, } void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { - (*out)[syncer::NIGORI] = syncer::GROUP_PASSIVE; - (*out)[syncer::BOOKMARKS] = syncer::GROUP_PASSIVE; - (*out)[syncer::THEMES] = syncer::GROUP_PASSIVE; - (*out)[syncer::SESSIONS] = syncer::GROUP_PASSIVE; - (*out)[syncer::PASSWORDS] = syncer::GROUP_PASSIVE; - (*out)[syncer::PREFERENCES] = syncer::GROUP_PASSIVE; + (*out)[NIGORI] = GROUP_PASSIVE; + (*out)[BOOKMARKS] = GROUP_PASSIVE; + (*out)[THEMES] = GROUP_PASSIVE; + (*out)[SESSIONS] = GROUP_PASSIVE; + (*out)[PASSWORDS] = GROUP_PASSIVE; + (*out)[PREFERENCES] = GROUP_PASSIVE; } virtual void OnChangesApplied( - syncer::ModelType model_type, + ModelType model_type, const BaseTransaction* trans, const ImmutableChangeRecordList& changes) OVERRIDE {} - virtual void OnChangesComplete(syncer::ModelType model_type) OVERRIDE {} + virtual void OnChangesComplete(ModelType model_type) OVERRIDE {} // Helper methods. bool SetUpEncryption(NigoriStatus nigori_status, EncryptionStatus encryption_status) { UserShare* share = sync_manager_.GetUserShare(); - share->directory->set_initial_sync_ended_for_type(syncer::NIGORI, true); + share->directory->set_initial_sync_ended_for_type(NIGORI, true); // We need to create the nigori node as if it were an applied server update. - int64 nigori_id = GetIdForDataType(syncer::NIGORI); + int64 nigori_id = GetIdForDataType(NIGORI); if (nigori_id == kInvalidId) return false; @@ -861,21 +860,21 @@ class SyncManagerTest : public testing::Test, } void SyncNotifierAddObserver( - syncer::SyncNotifierObserver* sync_notifier_observer) { + SyncNotifierObserver* sync_notifier_observer) { EXPECT_EQ(NULL, sync_notifier_observer_); sync_notifier_observer_ = sync_notifier_observer; } void SyncNotifierRemoveObserver( - syncer::SyncNotifierObserver* sync_notifier_observer) { + SyncNotifierObserver* sync_notifier_observer) { EXPECT_EQ(sync_notifier_observer_, sync_notifier_observer); sync_notifier_observer_ = NULL; } - void SyncNotifierUpdateEnabledTypes(syncer::ModelTypeSet types) { + void SyncNotifierUpdateEnabledTypes(ModelTypeSet types) { ModelSafeRoutingInfo routes; GetModelSafeRoutingInfo(&routes); - const syncer::ModelTypeSet expected_types = GetRoutingInfoTypes(routes); + const ModelTypeSet expected_types = GetRoutingInfoTypes(routes); EXPECT_TRUE(types.Equals(expected_types)); ++update_enabled_types_call_count_; } @@ -900,7 +899,7 @@ class SyncManagerTest : public testing::Test, // Looks up an entry by client tag and resets IS_UNSYNCED value to false. // Returns true if entry was previously unsynced, false if IS_UNSYNCED was // already false. - bool ResetUnsyncedEntry(syncer::ModelType type, + bool ResetUnsyncedEntry(ModelType type, const std::string& client_tag) { UserShare* share = sync_manager_.GetUserShare(); syncable::WriteTransaction trans( @@ -936,7 +935,7 @@ class SyncManagerTest : public testing::Test, SyncManagerImpl sync_manager_; WeakHandle<JsBackend> js_backend_; StrictMock<SyncManagerObserverMock> observer_; - syncer::SyncNotifierObserver* sync_notifier_observer_; + SyncNotifierObserver* sync_notifier_observer_; int update_enabled_types_call_count_; }; @@ -945,7 +944,7 @@ TEST_F(SyncManagerTest, UpdateEnabledTypes) { ModelSafeRoutingInfo routes; GetModelSafeRoutingInfo(&routes); - const syncer::ModelTypeSet enabled_types = GetRoutingInfoTypes(routes); + const ModelTypeSet enabled_types = GetRoutingInfoTypes(routes); sync_manager_.UpdateEnabledTypes(enabled_types); EXPECT_EQ(1, update_enabled_types_call_count_); @@ -1027,7 +1026,7 @@ class SyncManagerGetNodesByIdTest : public SyncManagerTest { } int64 child_id = - MakeNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, "testtag"); + MakeNode(sync_manager_.GetUserShare(), BOOKMARKS, "testtag"); StrictMock<MockJsReplyHandler> reply_handler; @@ -1258,17 +1257,17 @@ TEST_F(SyncManagerTest, OnNotificationStateChange) { sync_manager_.SimulateEnableNotificationsForTest(); sync_manager_.SimulateDisableNotificationsForTest( - syncer::TRANSIENT_NOTIFICATION_ERROR); + TRANSIENT_NOTIFICATION_ERROR); SetJsEventHandler(event_handler.AsWeakHandle()); sync_manager_.SimulateEnableNotificationsForTest(); sync_manager_.SimulateDisableNotificationsForTest( - syncer::TRANSIENT_NOTIFICATION_ERROR); + TRANSIENT_NOTIFICATION_ERROR); SetJsEventHandler(WeakHandle<JsEventHandler>()); sync_manager_.SimulateEnableNotificationsForTest(); sync_manager_.SimulateDisableNotificationsForTest( - syncer::TRANSIENT_NOTIFICATION_ERROR); + TRANSIENT_NOTIFICATION_ERROR); // Should trigger the replies. PumpLoop(); @@ -1277,9 +1276,9 @@ TEST_F(SyncManagerTest, OnNotificationStateChange) { TEST_F(SyncManagerTest, OnIncomingNotification) { StrictMock<MockJsEventHandler> event_handler; - const syncer::ModelTypeSet empty_model_types; - const syncer::ModelTypeSet model_types( - syncer::BOOKMARKS, syncer::THEMES); + const ModelTypeSet empty_model_types; + const ModelTypeSet model_types( + BOOKMARKS, THEMES); // Build expected_args to have a single argument with the string // equivalents of model_types. @@ -1288,10 +1287,10 @@ TEST_F(SyncManagerTest, OnIncomingNotification) { ListValue* model_type_list = new ListValue(); expected_details.SetString("source", "REMOTE_NOTIFICATION"); expected_details.Set("changedTypes", model_type_list); - for (syncer::ModelTypeSet::Iterator it = model_types.First(); + for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { model_type_list->Append( - Value::CreateStringValue(syncer::ModelTypeToString(it.Get()))); + Value::CreateStringValue(ModelTypeToString(it.Get()))); } } @@ -1320,15 +1319,15 @@ TEST_F(SyncManagerTest, RefreshEncryptionReady) { sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing)); PumpLoop(); - const syncer::ModelTypeSet encrypted_types = + const ModelTypeSet encrypted_types = sync_manager_.GetEncryptedDataTypesForTest(); - EXPECT_TRUE(encrypted_types.Has(syncer::PASSWORDS)); + EXPECT_TRUE(encrypted_types.Has(PASSWORDS)); EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByIdLookup(GetIdForDataType(syncer::NIGORI))); + node.InitByIdLookup(GetIdForDataType(NIGORI))); sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics(); EXPECT_TRUE(nigori.has_encrypted()); Cryptographer* cryptographer = trans.GetCryptographer(); @@ -1345,9 +1344,9 @@ TEST_F(SyncManagerTest, RefreshEncryptionNotReady) { sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing)); PumpLoop(); - const syncer::ModelTypeSet encrypted_types = + const ModelTypeSet encrypted_types = sync_manager_.GetEncryptedDataTypesForTest(); - EXPECT_TRUE(encrypted_types.Has(syncer::PASSWORDS)); // Hardcoded. + EXPECT_TRUE(encrypted_types.Has(PASSWORDS)); // Hardcoded. EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest()); } @@ -1360,15 +1359,15 @@ TEST_F(SyncManagerTest, RefreshEncryptionEmptyNigori) { sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing)); PumpLoop(); - const syncer::ModelTypeSet encrypted_types = + const ModelTypeSet encrypted_types = sync_manager_.GetEncryptedDataTypesForTest(); - EXPECT_TRUE(encrypted_types.Has(syncer::PASSWORDS)); // Hardcoded. + EXPECT_TRUE(encrypted_types.Has(PASSWORDS)); // Hardcoded. EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByIdLookup(GetIdForDataType(syncer::NIGORI))); + node.InitByIdLookup(GetIdForDataType(NIGORI))); sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics(); EXPECT_TRUE(nigori.has_encrypted()); Cryptographer* cryptographer = trans.GetCryptographer(); @@ -1381,7 +1380,7 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithNoData) { EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncer::ModelTypeSet::All()), true)); + HasModelTypes(ModelTypeSet::All()), true)); EXPECT_CALL(observer_, OnEncryptionComplete()); sync_manager_.EnableEncryptEverything(); EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest()); @@ -1393,26 +1392,26 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) { // Create some unencrypted unsynced data. int64 folder = MakeFolderWithParent(sync_manager_.GetUserShare(), - syncer::BOOKMARKS, - GetIdForDataType(syncer::BOOKMARKS), + BOOKMARKS, + GetIdForDataType(BOOKMARKS), NULL); // First batch_size nodes are children of folder. size_t i; for (i = 0; i < batch_size; ++i) { - MakeNodeWithParent(sync_manager_.GetUserShare(), syncer::BOOKMARKS, + MakeNodeWithParent(sync_manager_.GetUserShare(), BOOKMARKS, base::StringPrintf("%"PRIuS"", i), folder); } // Next batch_size nodes are a different type and on their own. for (; i < 2*batch_size; ++i) { - MakeNodeWithParent(sync_manager_.GetUserShare(), syncer::SESSIONS, + MakeNodeWithParent(sync_manager_.GetUserShare(), SESSIONS, base::StringPrintf("%"PRIuS"", i), - GetIdForDataType(syncer::SESSIONS)); + GetIdForDataType(SESSIONS)); } // Last batch_size nodes are a third type that will not need encryption. for (; i < 3*batch_size; ++i) { - MakeNodeWithParent(sync_manager_.GetUserShare(), syncer::THEMES, + MakeNodeWithParent(sync_manager_.GetUserShare(), THEMES, base::StringPrintf("%"PRIuS"", i), - GetIdForDataType(syncer::THEMES)); + GetIdForDataType(THEMES)); } { @@ -1422,44 +1421,44 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) { EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncer::BOOKMARKS, + BOOKMARKS, false /* not encrypted */)); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncer::SESSIONS, + SESSIONS, false /* not encrypted */)); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncer::THEMES, + THEMES, false /* not encrypted */)); } EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncer::ModelTypeSet::All()), true)); + HasModelTypes(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( - syncer::ModelTypeSet::All())); + ModelTypeSet::All())); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncer::BOOKMARKS, + BOOKMARKS, true /* is encrypted */)); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncer::SESSIONS, + SESSIONS, true /* is encrypted */)); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncer::THEMES, + THEMES, true /* is encrypted */)); } @@ -1472,21 +1471,21 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) { EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); - EXPECT_TRUE(GetEncryptedTypes(&trans).Equals(syncer::ModelTypeSet::All())); + EXPECT_TRUE(GetEncryptedTypes(&trans).Equals(ModelTypeSet::All())); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncer::BOOKMARKS, + BOOKMARKS, true /* is encrypted */)); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncer::SESSIONS, + SESSIONS, true /* is encrypted */)); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncer::THEMES, + THEMES, true /* is encrypted */)); } // Calling EncryptDataTypes with an empty encrypted types should not trigger @@ -1567,10 +1566,10 @@ TEST_F(SyncManagerTest, SetPassphraseWithPassword) { root_node.InitByRootLookup(); WriteNode password_node(&trans); - syncer::WriteNode::InitUniqueByCreationResult result = - password_node.InitUniqueByCreation(syncer::PASSWORDS, + WriteNode::InitUniqueByCreationResult result = + password_node.InitUniqueByCreation(PASSWORDS, root_node, "foo"); - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); + EXPECT_EQ(WriteNode::INIT_SUCCESS, result); sync_pb::PasswordSpecificsData data; data.set_password_value("secret"); password_node.SetPasswordSpecifics(data); @@ -1591,7 +1590,7 @@ TEST_F(SyncManagerTest, SetPassphraseWithPassword) { ReadNode password_node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - password_node.InitByClientTagLookup(syncer::PASSWORDS, + password_node.InitByClientTagLookup(PASSWORDS, "foo")); const sync_pb::PasswordSpecificsData& data = password_node.GetPasswordSpecifics(); @@ -1801,9 +1800,9 @@ TEST_F(SyncManagerTest, SetPassphraseWithEmptyPasswordNode) { root_node.InitByRootLookup(); WriteNode password_node(&trans); - syncer::WriteNode::InitUniqueByCreationResult result = - password_node.InitUniqueByCreation(syncer::PASSWORDS, root_node, tag); - EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); + WriteNode::InitUniqueByCreationResult result = + password_node.InitUniqueByCreation(PASSWORDS, root_node, tag); + EXPECT_EQ(WriteNode::INIT_SUCCESS, result); node_id = password_node.GetId(); } EXPECT_CALL(observer_, OnBootstrapTokenUpdated(_)); @@ -1815,7 +1814,7 @@ TEST_F(SyncManagerTest, SetPassphraseWithEmptyPasswordNode) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode password_node(&trans); EXPECT_EQ(BaseNode::INIT_FAILED_DECRYPT_IF_NECESSARY, - password_node.InitByClientTagLookup(syncer::PASSWORDS, + password_node.InitByClientTagLookup(PASSWORDS, tag)); } { @@ -1827,15 +1826,15 @@ TEST_F(SyncManagerTest, SetPassphraseWithEmptyPasswordNode) { } TEST_F(SyncManagerTest, NudgeDelayTest) { - EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncer::BOOKMARKS), + EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(BOOKMARKS), base::TimeDelta::FromMilliseconds( SyncManagerImpl::GetDefaultNudgeDelay())); - EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncer::AUTOFILL), + EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(AUTOFILL), base::TimeDelta::FromSeconds( - syncer::kDefaultShortPollIntervalSeconds)); + kDefaultShortPollIntervalSeconds)); - EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncer::PREFERENCES), + EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(PREFERENCES), base::TimeDelta::FromMilliseconds( SyncManagerImpl::GetPreferencesNudgeDelay())); } @@ -1853,10 +1852,10 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { // Create a bookmark using the legacy format. int64 node_id1 = MakeNode(sync_manager_.GetUserShare(), - syncer::BOOKMARKS, + BOOKMARKS, "testtag"); int64 node_id2 = MakeNode(sync_manager_.GetUserShare(), - syncer::BOOKMARKS, + BOOKMARKS, "testtag2"); { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); @@ -1887,14 +1886,14 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(node_id1)); - EXPECT_EQ(syncer::BOOKMARKS, node.GetModelType()); + EXPECT_EQ(BOOKMARKS, node.GetModelType()); EXPECT_EQ(title, node.GetTitle()); EXPECT_EQ(title, node.GetBookmarkSpecifics().title()); EXPECT_EQ(url, node.GetBookmarkSpecifics().url()); ReadNode node2(&trans); EXPECT_EQ(BaseNode::INIT_OK, node2.InitByIdLookup(node_id2)); - EXPECT_EQ(syncer::BOOKMARKS, node2.GetModelType()); + EXPECT_EQ(BOOKMARKS, node2.GetModelType()); // We should de-canonicalize the title in GetTitle(), but the title in the // specifics should be stored in the server legal form. EXPECT_EQ(raw_title2, node2.GetTitle()); @@ -1907,36 +1906,36 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncer::BOOKMARKS, + BOOKMARKS, false /* not encrypted */)); } EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncer::ModelTypeSet::All()), true)); + HasModelTypes(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(syncer::ModelTypeSet::All())); + EXPECT_TRUE(GetEncryptedTypes(&trans).Equals(ModelTypeSet::All())); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncer::BOOKMARKS, + BOOKMARKS, true /* is encrypted */)); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(node_id1)); - EXPECT_EQ(syncer::BOOKMARKS, node.GetModelType()); + EXPECT_EQ(BOOKMARKS, node.GetModelType()); EXPECT_EQ(title, node.GetTitle()); EXPECT_EQ(title, node.GetBookmarkSpecifics().title()); EXPECT_EQ(url, node.GetBookmarkSpecifics().url()); ReadNode node2(&trans); EXPECT_EQ(BaseNode::INIT_OK, node2.InitByIdLookup(node_id2)); - EXPECT_EQ(syncer::BOOKMARKS, node2.GetModelType()); + EXPECT_EQ(BOOKMARKS, node2.GetModelType()); // We should de-canonicalize the title in GetTitle(), but the title in the // specifics should be stored in the server legal form. EXPECT_EQ(raw_title2, node2.GetTitle()); @@ -1956,7 +1955,7 @@ TEST_F(SyncManagerTest, CreateLocalBookmark) { ReadNode root_node(&trans); root_node.InitByRootLookup(); WriteNode node(&trans); - ASSERT_TRUE(node.InitByCreation(syncer::BOOKMARKS, root_node, NULL)); + ASSERT_TRUE(node.InitByCreation(BOOKMARKS, root_node, NULL)); node.SetIsFolder(false); node.SetTitle(UTF8ToWide(title)); node.SetURL(url); @@ -1982,26 +1981,26 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { sync_pb::EntitySpecifics entity_specifics; entity_specifics.mutable_bookmark()->set_url("url"); entity_specifics.mutable_bookmark()->set_title("title"); - MakeServerNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, client_tag, - BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, + MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag, + BaseNode::GenerateSyncableHash(BOOKMARKS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); // Manually change to the same data. Should not set is_unsynced. { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); node.SetEntitySpecifics(entity_specifics); } - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); // Encrypt the datatatype, should set is_unsynced. EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncer::ModelTypeSet::All()), true)); + HasModelTypes(ModelTypeSet::All()), true)); EXPECT_CALL(observer_, OnEncryptionComplete()); EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, FULL_ENCRYPTION)); @@ -2011,7 +2010,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); EXPECT_TRUE(specifics.has_encrypted()); @@ -2021,7 +2020,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey( specifics.encrypted())); } - EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); // Set a new passphrase. Should set is_unsynced. testing::Mock::VerifyAndClearExpectations(&observer_); @@ -2033,7 +2032,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); EXPECT_TRUE(specifics.has_encrypted()); @@ -2043,7 +2042,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey( specifics.encrypted())); } - EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); // Force a re-encrypt everything. Should not set is_unsynced. testing::Mock::VerifyAndClearExpectations(&observer_); @@ -2056,7 +2055,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); EXPECT_TRUE(specifics.has_encrypted()); @@ -2065,14 +2064,14 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey( specifics.encrypted())); } - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); // Manually change to the same data. Should not set is_unsynced. { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); node.SetEntitySpecifics(entity_specifics); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); @@ -2083,7 +2082,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey( specifics.encrypted())); } - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); // Manually change to different data. Should set is_unsynced. { @@ -2092,7 +2091,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); node.SetEntitySpecifics(entity_specifics); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); @@ -2121,12 +2120,12 @@ TEST_F(SyncManagerTest, UpdatePasswordSetEntitySpecificsNoChange) { entity_specifics.mutable_password()-> mutable_encrypted()); } - MakeServerNode(sync_manager_.GetUserShare(), syncer::PASSWORDS, client_tag, - BaseNode::GenerateSyncableHash(syncer::PASSWORDS, + MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag, + BaseNode::GenerateSyncableHash(PASSWORDS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); // Manually change to the same data via SetEntitySpecifics. Should not set // is_unsynced. @@ -2134,10 +2133,10 @@ TEST_F(SyncManagerTest, UpdatePasswordSetEntitySpecificsNoChange) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::PASSWORDS, client_tag)); + node.InitByClientTagLookup(PASSWORDS, client_tag)); node.SetEntitySpecifics(entity_specifics); } - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); } // Passwords have their own handling for encryption. Verify it does not result @@ -2156,12 +2155,12 @@ TEST_F(SyncManagerTest, UpdatePasswordSetPasswordSpecifics) { entity_specifics.mutable_password()-> mutable_encrypted()); } - MakeServerNode(sync_manager_.GetUserShare(), syncer::PASSWORDS, client_tag, - BaseNode::GenerateSyncableHash(syncer::PASSWORDS, + MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag, + BaseNode::GenerateSyncableHash(PASSWORDS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); // Manually change to the same data via SetPasswordSpecifics. Should not set // is_unsynced. @@ -2169,17 +2168,17 @@ TEST_F(SyncManagerTest, UpdatePasswordSetPasswordSpecifics) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::PASSWORDS, client_tag)); + node.InitByClientTagLookup(PASSWORDS, client_tag)); node.SetPasswordSpecifics(node.GetPasswordSpecifics()); } - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); // Manually change to different data. Should set is_unsynced. { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::PASSWORDS, client_tag)); + node.InitByClientTagLookup(PASSWORDS, client_tag)); Cryptographer* cryptographer = trans.GetCryptographer(); sync_pb::PasswordSpecificsData data; data.set_password_value("secret2"); @@ -2207,12 +2206,12 @@ TEST_F(SyncManagerTest, UpdatePasswordNewPassphrase) { data, entity_specifics.mutable_password()->mutable_encrypted()); } - MakeServerNode(sync_manager_.GetUserShare(), syncer::PASSWORDS, client_tag, - BaseNode::GenerateSyncableHash(syncer::PASSWORDS, + MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag, + BaseNode::GenerateSyncableHash(PASSWORDS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); // Set a new passphrase. Should set is_unsynced. testing::Mock::VerifyAndClearExpectations(&observer_); @@ -2220,7 +2219,7 @@ TEST_F(SyncManagerTest, UpdatePasswordNewPassphrase) { EXPECT_CALL(observer_, OnPassphraseAccepted()); EXPECT_CALL(observer_, OnEncryptionComplete()); sync_manager_.SetEncryptionPassphrase("new_passphrase", true); - EXPECT_TRUE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(PASSWORDS, client_tag)); } // Passwords have their own handling for encryption. Verify it does not result @@ -2238,19 +2237,19 @@ TEST_F(SyncManagerTest, UpdatePasswordReencryptEverything) { data, entity_specifics.mutable_password()->mutable_encrypted()); } - MakeServerNode(sync_manager_.GetUserShare(), syncer::PASSWORDS, client_tag, - BaseNode::GenerateSyncableHash(syncer::PASSWORDS, + MakeServerNode(sync_manager_.GetUserShare(), PASSWORDS, client_tag, + BaseNode::GenerateSyncableHash(PASSWORDS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); // Force a re-encrypt everything. Should not set is_unsynced. testing::Mock::VerifyAndClearExpectations(&observer_); EXPECT_CALL(observer_, OnEncryptionComplete()); sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing)); PumpLoop(); - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(PASSWORDS, client_tag)); } // Verify SetTitle(..) doesn't unnecessarily set IS_UNSYNCED for bookmarks @@ -2260,32 +2259,32 @@ TEST_F(SyncManagerTest, SetBookmarkTitle) { sync_pb::EntitySpecifics entity_specifics; entity_specifics.mutable_bookmark()->set_url("url"); entity_specifics.mutable_bookmark()->set_title("title"); - MakeServerNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, client_tag, - BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, + MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag, + BaseNode::GenerateSyncableHash(BOOKMARKS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); // Manually change to the same title. Should not set is_unsynced. { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); node.SetTitle(UTF8ToWide(client_tag)); } - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); // Manually change to new title. Should set is_unsynced. { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); node.SetTitle(UTF8ToWide("title2")); } - EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); } // Verify SetTitle(..) doesn't unnecessarily set IS_UNSYNCED for encrypted @@ -2296,22 +2295,22 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) { sync_pb::EntitySpecifics entity_specifics; entity_specifics.mutable_bookmark()->set_url("url"); entity_specifics.mutable_bookmark()->set_title("title"); - MakeServerNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, client_tag, - BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, + MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag, + BaseNode::GenerateSyncableHash(BOOKMARKS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); // Encrypt the datatatype, should set is_unsynced. EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncer::ModelTypeSet::All()), true)); + HasModelTypes(ModelTypeSet::All()), true)); EXPECT_CALL(observer_, OnEncryptionComplete()); EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, FULL_ENCRYPTION)); sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing)); PumpLoop(); - EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); // Manually change to the same title. Should not set is_unsynced. // NON_UNIQUE_NAME should be kEncryptedString. @@ -2319,14 +2318,14 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); node.SetTitle(UTF8ToWide(client_tag)); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); EXPECT_TRUE(specifics.has_encrypted()); EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); } - EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); // Manually change to new title. Should set is_unsynced. NON_UNIQUE_NAME // should still be kEncryptedString. @@ -2334,14 +2333,14 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); node.SetTitle(UTF8ToWide("title2")); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); EXPECT_TRUE(specifics.has_encrypted()); EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); } - EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); } // Verify SetTitle(..) doesn't unnecessarily set IS_UNSYNCED for non-bookmarks @@ -2352,33 +2351,33 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitle) { entity_specifics.mutable_preference()->set_name("name"); entity_specifics.mutable_preference()->set_value("value"); MakeServerNode(sync_manager_.GetUserShare(), - syncer::PREFERENCES, + PREFERENCES, client_tag, - BaseNode::GenerateSyncableHash(syncer::PREFERENCES, + BaseNode::GenerateSyncableHash(PREFERENCES, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, client_tag)); // Manually change to the same title. Should not set is_unsynced. { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::PREFERENCES, client_tag)); + node.InitByClientTagLookup(PREFERENCES, client_tag)); node.SetTitle(UTF8ToWide(client_tag)); } - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, client_tag)); // Manually change to new title. Should set is_unsynced. { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::PREFERENCES, client_tag)); + node.InitByClientTagLookup(PREFERENCES, client_tag)); node.SetTitle(UTF8ToWide("title2")); } - EXPECT_TRUE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(PREFERENCES, client_tag)); } // Verify SetTitle(..) doesn't unnecessarily set IS_UNSYNCED for encrypted @@ -2390,23 +2389,23 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) { entity_specifics.mutable_preference()->set_name("name"); entity_specifics.mutable_preference()->set_value("value"); MakeServerNode(sync_manager_.GetUserShare(), - syncer::PREFERENCES, + PREFERENCES, client_tag, - BaseNode::GenerateSyncableHash(syncer::PREFERENCES, + BaseNode::GenerateSyncableHash(PREFERENCES, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, client_tag)); // Encrypt the datatatype, should set is_unsynced. EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncer::ModelTypeSet::All()), true)); + HasModelTypes(ModelTypeSet::All()), true)); EXPECT_CALL(observer_, OnEncryptionComplete()); EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, FULL_ENCRYPTION)); sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing)); PumpLoop(); - EXPECT_TRUE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(PREFERENCES, client_tag)); // Manually change to the same title. Should not set is_unsynced. // NON_UNIQUE_NAME should be kEncryptedString. @@ -2414,14 +2413,14 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::PREFERENCES, client_tag)); + node.InitByClientTagLookup(PREFERENCES, client_tag)); node.SetTitle(UTF8ToWide(client_tag)); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); EXPECT_TRUE(specifics.has_encrypted()); EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); } - EXPECT_FALSE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, client_tag)); // Manually change to new title. Should not set is_unsynced because the // NON_UNIQUE_NAME should still be kEncryptedString. @@ -2429,7 +2428,7 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::PREFERENCES, client_tag)); + node.InitByClientTagLookup(PREFERENCES, client_tag)); node.SetTitle(UTF8ToWide("title2")); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); @@ -2451,17 +2450,17 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) { EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); - syncer::Cryptographer* crypto = trans.GetCryptographer(); + Cryptographer* crypto = trans.GetCryptographer(); sync_pb::EntitySpecifics bm_specifics; bm_specifics.mutable_bookmark()->set_title("title"); bm_specifics.mutable_bookmark()->set_url("url"); sync_pb::EncryptedData encrypted; crypto->Encrypt(bm_specifics, &encrypted); entity_specifics.mutable_encrypted()->CopyFrom(encrypted); - syncer::AddDefaultFieldValue(syncer::BOOKMARKS, &entity_specifics); + AddDefaultFieldValue(BOOKMARKS, &entity_specifics); } - MakeServerNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, client_tag, - BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, + MakeServerNode(sync_manager_.GetUserShare(), BOOKMARKS, client_tag, + BaseNode::GenerateSyncableHash(BOOKMARKS, client_tag), entity_specifics); @@ -2470,7 +2469,7 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); EXPECT_EQ(title, node.GetTitle()); EXPECT_EQ(GURL(url), node.GetURL()); } @@ -2480,7 +2479,7 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); node.SetURL(GURL(url2)); } @@ -2489,7 +2488,7 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(BOOKMARKS, client_tag)); EXPECT_EQ(title, node.GetTitle()); EXPECT_EQ(GURL(url2), node.GetURL()); const syncable::Entry* node_entry = node.GetEntry(); @@ -2538,9 +2537,8 @@ class SyncManagerTestWithMockScheduler : public SyncManagerTest { // ScheduleConfigure. No callback should be invoked. TEST_F(SyncManagerTestWithMockScheduler, BasicConfiguration) { ConfigureReason reason = CONFIGURE_REASON_RECONFIGURATION; - syncer::ModelTypeSet types_to_download(syncer::BOOKMARKS, - syncer::PREFERENCES); - syncer::ModelSafeRoutingInfo new_routing_info; + ModelTypeSet types_to_download(BOOKMARKS, PREFERENCES); + ModelSafeRoutingInfo new_routing_info; GetModelSafeRoutingInfo(&new_routing_info); ConfigurationParams params; @@ -2568,9 +2566,8 @@ TEST_F(SyncManagerTestWithMockScheduler, BasicConfiguration) { // Test that the retry callback is invoked on configuration failure. TEST_F(SyncManagerTestWithMockScheduler, ConfigurationRetry) { ConfigureReason reason = CONFIGURE_REASON_RECONFIGURATION; - syncer::ModelTypeSet types_to_download(syncer::BOOKMARKS, - syncer::PREFERENCES); - syncer::ModelSafeRoutingInfo new_routing_info; + ModelTypeSet types_to_download(BOOKMARKS, PREFERENCES); + ModelSafeRoutingInfo new_routing_info; GetModelSafeRoutingInfo(&new_routing_info); ConfigurationParams params; diff --git a/sync/internal_api/test/fake_sync_manager.cc b/sync/internal_api/test/fake_sync_manager.cc index 85a0a69..1951e7f 100644 --- a/sync/internal_api/test/fake_sync_manager.cc +++ b/sync/internal_api/test/fake_sync_manager.cc @@ -18,57 +18,55 @@ FakeSyncManager::FakeSyncManager() { FakeSyncManager::~FakeSyncManager() { } -void FakeSyncManager::set_initial_sync_ended_types( - syncer::ModelTypeSet types) { +void FakeSyncManager::set_initial_sync_ended_types(ModelTypeSet types) { initial_sync_ended_types_ = types; } -void FakeSyncManager::set_progress_marker_types( - syncer::ModelTypeSet types) { +void FakeSyncManager::set_progress_marker_types(ModelTypeSet types) { progress_marker_types_ = types; } -void FakeSyncManager::set_configure_fail_types(syncer::ModelTypeSet types) { +void FakeSyncManager::set_configure_fail_types(ModelTypeSet types) { configure_fail_types_ = types; } -syncer::ModelTypeSet FakeSyncManager::GetAndResetCleanedTypes() { - syncer::ModelTypeSet cleaned_types = cleaned_types_; +ModelTypeSet FakeSyncManager::GetAndResetCleanedTypes() { + ModelTypeSet cleaned_types = cleaned_types_; cleaned_types_.Clear(); return cleaned_types; } -syncer::ModelTypeSet FakeSyncManager::GetAndResetDownloadedTypes() { - syncer::ModelTypeSet downloaded_types = downloaded_types_; +ModelTypeSet FakeSyncManager::GetAndResetDownloadedTypes() { + ModelTypeSet downloaded_types = downloaded_types_; downloaded_types_.Clear(); return downloaded_types; } bool FakeSyncManager::Init( const FilePath& database_location, - const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, + const WeakHandle<JsEventHandler>& event_handler, const std::string& sync_server_and_path, int sync_server_port, bool use_ssl, const scoped_refptr<base::TaskRunner>& blocking_task_runner, scoped_ptr<HttpPostProviderFactory> post_factory, - const syncer::ModelSafeRoutingInfo& model_safe_routing_info, - const std::vector<syncer::ModelSafeWorker*>& workers, - syncer::ExtensionsActivityMonitor* extensions_activity_monitor, + const ModelSafeRoutingInfo& model_safe_routing_info, + const std::vector<ModelSafeWorker*>& workers, + ExtensionsActivityMonitor* extensions_activity_monitor, ChangeDelegate* change_delegate, const SyncCredentials& credentials, - scoped_ptr<syncer::SyncNotifier> sync_notifier, + scoped_ptr<SyncNotifier> sync_notifier, const std::string& restored_key_for_bootstrapping, scoped_ptr<InternalComponentsFactory> internal_components_factory, - syncer::Encryptor* encryptor, - syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, - syncer::ReportUnrecoverableErrorFunction + Encryptor* encryptor, + UnrecoverableErrorHandler* unrecoverable_error_handler, + ReportUnrecoverableErrorFunction report_unrecoverable_error_function) { sync_loop_ = MessageLoop::current(); PurgePartiallySyncedTypes(); FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnInitializationComplete( - syncer::WeakHandle<syncer::JsBackend>(), + WeakHandle<JsBackend>(), true)); return true; } @@ -77,20 +75,20 @@ void FakeSyncManager::ThrowUnrecoverableError() { NOTIMPLEMENTED(); } -syncer::ModelTypeSet FakeSyncManager::InitialSyncEndedTypes() { +ModelTypeSet FakeSyncManager::InitialSyncEndedTypes() { return initial_sync_ended_types_; } -syncer::ModelTypeSet FakeSyncManager::GetTypesWithEmptyProgressMarkerToken( - syncer::ModelTypeSet types) { - syncer::ModelTypeSet empty_types = types; +ModelTypeSet FakeSyncManager::GetTypesWithEmptyProgressMarkerToken( + ModelTypeSet types) { + ModelTypeSet empty_types = types; empty_types.RemoveAll(progress_marker_types_); return empty_types; } bool FakeSyncManager::PurgePartiallySyncedTypes() { ModelTypeSet partial_types; - for (syncer::ModelTypeSet::Iterator i = progress_marker_types_.First(); + for (ModelTypeSet::Iterator i = progress_marker_types_.First(); i.Good(); i.Inc()) { if (!initial_sync_ended_types_.Has(i.Get())) partial_types.Put(i.Get()); @@ -103,12 +101,12 @@ void FakeSyncManager::UpdateCredentials(const SyncCredentials& credentials) { NOTIMPLEMENTED(); } -void FakeSyncManager::UpdateEnabledTypes(const syncer::ModelTypeSet& types) { +void FakeSyncManager::UpdateEnabledTypes(const ModelTypeSet& types) { // Do nothing. } void FakeSyncManager::StartSyncingNormally( - const syncer::ModelSafeRoutingInfo& routing_info) { + const ModelSafeRoutingInfo& routing_info) { // Do nothing. } @@ -123,19 +121,19 @@ void FakeSyncManager::SetDecryptionPassphrase(const std::string& passphrase) { void FakeSyncManager::ConfigureSyncer( ConfigureReason reason, - const syncer::ModelTypeSet& types_to_config, - const syncer::ModelSafeRoutingInfo& new_routing_info, + const ModelTypeSet& types_to_config, + const ModelSafeRoutingInfo& new_routing_info, const base::Closure& ready_task, const base::Closure& retry_task) { - syncer::ModelTypeSet enabled_types = GetRoutingInfoTypes(new_routing_info); - syncer::ModelTypeSet disabled_types = Difference( - syncer::ModelTypeSet::All(), enabled_types); - syncer::ModelTypeSet success_types = types_to_config; + ModelTypeSet enabled_types = GetRoutingInfoTypes(new_routing_info); + ModelTypeSet disabled_types = Difference( + ModelTypeSet::All(), enabled_types); + ModelTypeSet success_types = types_to_config; success_types.RemoveAll(configure_fail_types_); DVLOG(1) << "Faking configuration. Downloading: " - << syncer::ModelTypeSetToString(success_types) << ". Cleaning: " - << syncer::ModelTypeSetToString(disabled_types); + << ModelTypeSetToString(success_types) << ". Cleaning: " + << ModelTypeSetToString(disabled_types); // Simulate cleaning up disabled types. // TODO(sync): consider only cleaning those types that were recently disabled, @@ -198,7 +196,7 @@ void FakeSyncManager::EnableEncryptEverything() { NOTIMPLEMENTED(); } -bool FakeSyncManager::ReceivedExperiment(syncer::Experiments* experiments) { +bool FakeSyncManager::ReceivedExperiment(Experiments* experiments) { return false; } diff --git a/sync/internal_api/test/test_entry_factory.cc b/sync/internal_api/test/test_entry_factory.cc index 5527c1f..512fe55 100644 --- a/sync/internal_api/test/test_entry_factory.cc +++ b/sync/internal_api/test/test_entry_factory.cc @@ -65,7 +65,7 @@ void TestEntryFactory::CreateUnsyncedItem( const Id& parent_id, const string& name, bool is_folder, - syncer::ModelType model_type, + ModelType model_type, int64* metahandle_out) { WriteTransaction trans(FROM_HERE, UNITTEST, directory_); Id predecessor_id; @@ -82,7 +82,7 @@ void TestEntryFactory::CreateUnsyncedItem( entry.Put(syncable::PARENT_ID, parent_id); CHECK(entry.PutPredecessor(predecessor_id)); sync_pb::EntitySpecifics default_specifics; - syncer::AddDefaultFieldValue(model_type, &default_specifics); + AddDefaultFieldValue(model_type, &default_specifics); entry.Put(syncable::SPECIFICS, default_specifics); if (item_id.ServerKnows()) { entry.Put(syncable::SERVER_SPECIFICS, default_specifics); @@ -96,7 +96,7 @@ void TestEntryFactory::CreateUnsyncedItem( int64 TestEntryFactory::CreateUnappliedAndUnsyncedItem( const string& name, - syncer::ModelType model_type) { + ModelType model_type) { int64 metahandle = 0; CreateUnsyncedItem( TestIdFactory::MakeServer(name), TestIdFactory::root(), @@ -116,7 +116,7 @@ int64 TestEntryFactory::CreateUnappliedAndUnsyncedItem( } int64 TestEntryFactory::CreateSyncedItem( - const std::string& name, syncer::ModelType + const std::string& name, ModelType model_type, bool is_folder) { WriteTransaction trans(FROM_HERE, UNITTEST, directory_); @@ -125,7 +125,7 @@ int64 TestEntryFactory::CreateSyncedItem( int64 version = GetNextRevision(); sync_pb::EntitySpecifics default_specifics; - syncer::AddDefaultFieldValue(model_type, &default_specifics); + AddDefaultFieldValue(model_type, &default_specifics); MutableEntry entry(&trans, syncable::CREATE, parent_id, name); if (!entry.good()) { diff --git a/sync/internal_api/test/test_internal_components_factory.cc b/sync/internal_api/test/test_internal_components_factory.cc index df60771..37aab64 100644 --- a/sync/internal_api/test/test_internal_components_factory.cc +++ b/sync/internal_api/test/test_internal_components_factory.cc @@ -33,7 +33,7 @@ TestInternalComponentsFactory::BuildContext( ThrottledDataTypeTracker* throttled_data_type_tracker, const std::vector<SyncEngineEventListener*>& listeners, sessions::DebugInfoGetter* debug_info_getter, - syncer::TrafficRecorder* traffic_recorder) { + TrafficRecorder* traffic_recorder) { // Tests don't wire up listeners. std::vector<SyncEngineEventListener*> empty_listeners; diff --git a/sync/internal_api/test/test_user_share.cc b/sync/internal_api/test/test_user_share.cc index 136b438..21433b1 100644 --- a/sync/internal_api/test/test_user_share.cc +++ b/sync/internal_api/test/test_user_share.cc @@ -19,7 +19,7 @@ TestUserShare::~TestUserShare() { } void TestUserShare::SetUp() { - user_share_.reset(new syncer::UserShare()); + user_share_.reset(new UserShare()); dir_maker_->SetUp(); // The pointer is owned by dir_maker_, we should not be storing it in a @@ -35,7 +35,7 @@ void TestUserShare::TearDown() { dir_maker_->TearDown(); } -syncer::UserShare* TestUserShare::user_share() { +UserShare* TestUserShare::user_share() { return user_share_.get(); } diff --git a/sync/internal_api/write_node.cc b/sync/internal_api/write_node.cc index 7eb4ff7..22d7e5f 100644 --- a/sync/internal_api/write_node.cc +++ b/sync/internal_api/write_node.cc @@ -40,8 +40,8 @@ void WriteNode::SetIsFolder(bool folder) { } void WriteNode::SetTitle(const std::wstring& title) { - DCHECK_NE(GetModelType(), syncer::UNSPECIFIED); - syncer::ModelType type = GetModelType(); + DCHECK_NE(GetModelType(), UNSPECIFIED); + ModelType type = GetModelType(); Cryptographer* cryptographer = GetTransaction()->GetCryptographer(); // It's possible the nigori lost the set of encrypted types. If the current // specifics are already encrypted, we want to ensure we continue encrypting. @@ -53,14 +53,14 @@ void WriteNode::SetTitle(const std::wstring& title) { // NON_UNIQUE_NAME will still be kEncryptedString, but we store the real title // into the specifics. All strings compared are server legal strings. std::string new_legal_title; - if (type != syncer::BOOKMARKS && needs_encryption) { + if (type != BOOKMARKS && needs_encryption) { new_legal_title = kEncryptedString; } else { SyncAPINameToServerName(WideToUTF8(title), &new_legal_title); } std::string current_legal_title; - if (syncer::BOOKMARKS == type && + if (BOOKMARKS == type && entry_->Get(syncable::SPECIFICS).has_encrypted()) { // Encrypted bookmarks only have their title in the unencrypted specifics. current_legal_title = GetBookmarkSpecifics().title(); @@ -84,7 +84,7 @@ void WriteNode::SetTitle(const std::wstring& title) { // For bookmarks, we also set the title field in the specifics. // TODO(zea): refactor bookmarks to not need this functionality. - if (GetModelType() == syncer::BOOKMARKS) { + if (GetModelType() == BOOKMARKS) { sync_pb::EntitySpecifics specifics = GetEntitySpecifics(); specifics.mutable_bookmark()->set_title(new_legal_title); SetEntitySpecifics(specifics); // Does it's own encryption checking. @@ -100,7 +100,7 @@ void WriteNode::SetTitle(const std::wstring& title) { entry_->Put(syncable::NON_UNIQUE_NAME, new_legal_title); DVLOG(1) << "Overwriting title of type " - << syncer::ModelTypeToString(type) + << ModelTypeToString(type) << " and marking for syncing."; MarkForSyncing(); } @@ -149,7 +149,7 @@ void WriteNode::SetNigoriSpecifics( void WriteNode::SetPasswordSpecifics( const sync_pb::PasswordSpecificsData& data) { - DCHECK_EQ(syncer::PASSWORDS, GetModelType()); + DCHECK_EQ(GetModelType(), PASSWORDS); Cryptographer* cryptographer = GetTransaction()->GetCryptographer(); @@ -159,10 +159,10 @@ void WriteNode::SetPasswordSpecifics( const sync_pb::EntitySpecifics& old_specifics = GetEntry()->Get(SPECIFICS); sync_pb::EntitySpecifics entity_specifics; // Copy over the old specifics if they exist. - if (syncer::GetModelTypeFromSpecifics(old_specifics) == syncer::PASSWORDS) { + if (GetModelTypeFromSpecifics(old_specifics) == PASSWORDS) { entity_specifics.CopyFrom(old_specifics); } else { - syncer::AddDefaultFieldValue(syncer::PASSWORDS, &entity_specifics); + AddDefaultFieldValue(PASSWORDS, &entity_specifics); } sync_pb::PasswordSpecifics* password_specifics = entity_specifics.mutable_password(); @@ -192,19 +192,18 @@ void WriteNode::SetSessionSpecifics( void WriteNode::SetEntitySpecifics( const sync_pb::EntitySpecifics& new_value) { - syncer::ModelType new_specifics_type = - syncer::GetModelTypeFromSpecifics(new_value); - DCHECK_NE(new_specifics_type, syncer::UNSPECIFIED); + ModelType new_specifics_type = + GetModelTypeFromSpecifics(new_value); + DCHECK_NE(new_specifics_type, UNSPECIFIED); DVLOG(1) << "Writing entity specifics of type " - << syncer::ModelTypeToString(new_specifics_type); + << ModelTypeToString(new_specifics_type); // GetModelType() can be unspecified if this is the first time this // node is being initialized (see PutModelType()). Otherwise, it // should match |new_specifics_type|. - if (GetModelType() != syncer::UNSPECIFIED) { + if (GetModelType() != UNSPECIFIED) { DCHECK_EQ(new_specifics_type, GetModelType()); } - syncer::Cryptographer* cryptographer = - GetTransaction()->GetCryptographer(); + Cryptographer* cryptographer = GetTransaction()->GetCryptographer(); // Preserve unknown fields. const sync_pb::EntitySpecifics& old_specifics = entry_->Get(SPECIFICS); @@ -279,7 +278,7 @@ BaseNode::InitByLookupResult WriteNode::InitByIdLookup(int64 id) { // Return true if the write node was found, and was not deleted. // Undeleting a deleted node is possible by ClientTag. BaseNode::InitByLookupResult WriteNode::InitByClientTagLookup( - syncer::ModelType model_type, + ModelType model_type, const std::string& tag) { DCHECK(!entry_) << "Init called twice"; if (tag.empty()) @@ -307,25 +306,25 @@ BaseNode::InitByLookupResult WriteNode::InitByTagLookup( return INIT_FAILED_ENTRY_NOT_GOOD; if (entry_->Get(syncable::IS_DEL)) return INIT_FAILED_ENTRY_IS_DEL; - syncer::ModelType model_type = GetModelType(); - DCHECK_EQ(syncer::NIGORI, model_type); + ModelType model_type = GetModelType(); + DCHECK_EQ(model_type, NIGORI); return INIT_OK; } -void WriteNode::PutModelType(syncer::ModelType model_type) { +void WriteNode::PutModelType(ModelType model_type) { // Set an empty specifics of the appropriate datatype. The presence // of the specific field will identify the model type. DCHECK(GetModelType() == model_type || - GetModelType() == syncer::UNSPECIFIED); // Immutable once set. + GetModelType() == UNSPECIFIED); // Immutable once set. sync_pb::EntitySpecifics specifics; - syncer::AddDefaultFieldValue(model_type, &specifics); + AddDefaultFieldValue(model_type, &specifics); SetEntitySpecifics(specifics); } // Create a new node with default properties, and bind this WriteNode to it. // Return true on success. -bool WriteNode::InitByCreation(syncer::ModelType model_type, +bool WriteNode::InitByCreation(ModelType model_type, const BaseNode& parent, const BaseNode* predecessor) { DCHECK(!entry_) << "Init called twice"; @@ -363,7 +362,7 @@ bool WriteNode::InitByCreation(syncer::ModelType model_type, // TODO(chron): Code datatype into hash tag. // TODO(chron): Is model type ever lost? WriteNode::InitUniqueByCreationResult WriteNode::InitUniqueByCreation( - syncer::ModelType model_type, + ModelType model_type, const BaseNode& parent, const std::string& tag) { // This DCHECK will only fail if init is called twice. diff --git a/sync/notifier/chrome_invalidation_client.cc b/sync/notifier/chrome_invalidation_client.cc index 85ef09b..7b47fc5 100644 --- a/sync/notifier/chrome_invalidation_client.cc +++ b/sync/notifier/chrome_invalidation_client.cc @@ -51,8 +51,7 @@ void ChromeInvalidationClient::Start( const std::string& client_id, const std::string& client_info, const std::string& state, const InvalidationVersionMap& initial_max_invalidation_versions, - const syncer::WeakHandle<InvalidationStateTracker>& - invalidation_state_tracker, + const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, Listener* listener) { DCHECK(CalledOnValidThread()); Stop(); diff --git a/sync/notifier/chrome_invalidation_client.h b/sync/notifier/chrome_invalidation_client.h index e4e5439..ddd5bb0 100644 --- a/sync/notifier/chrome_invalidation_client.h +++ b/sync/notifier/chrome_invalidation_client.h @@ -73,8 +73,7 @@ class ChromeInvalidationClient const std::string& client_id, const std::string& client_info, const std::string& state, const InvalidationVersionMap& initial_max_invalidation_versions, - const syncer::WeakHandle<InvalidationStateTracker>& - invalidation_state_tracker, + const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, Listener* listener); void UpdateCredentials(const std::string& email, const std::string& token); @@ -139,8 +138,7 @@ class ChromeInvalidationClient notifier::PushClient* const push_client_; ChromeSystemResources chrome_system_resources_; InvalidationVersionMap max_invalidation_versions_; - syncer::WeakHandle<InvalidationStateTracker> - invalidation_state_tracker_; + WeakHandle<InvalidationStateTracker> invalidation_state_tracker_; Listener* listener_; scoped_ptr<invalidation::InvalidationClient> invalidation_client_; scoped_ptr<RegistrationManager> registration_manager_; diff --git a/sync/notifier/chrome_invalidation_client_unittest.cc b/sync/notifier/chrome_invalidation_client_unittest.cc index d507cc0..465d259 100644 --- a/sync/notifier/chrome_invalidation_client_unittest.cc +++ b/sync/notifier/chrome_invalidation_client_unittest.cc @@ -79,8 +79,7 @@ class ChromeInvalidationClientTest : public testing::Test { virtual void SetUp() { client_.Start(kClientId, kClientInfo, kState, InvalidationVersionMap(), - syncer::MakeWeakHandle( - mock_invalidation_state_tracker_.AsWeakPtr()), + MakeWeakHandle(mock_invalidation_state_tracker_.AsWeakPtr()), &mock_listener_); } diff --git a/sync/notifier/invalidation_notifier.cc b/sync/notifier/invalidation_notifier.cc index 58ef89a0b..0c629c6 100644 --- a/sync/notifier/invalidation_notifier.cc +++ b/sync/notifier/invalidation_notifier.cc @@ -20,8 +20,7 @@ InvalidationNotifier::InvalidationNotifier( scoped_ptr<notifier::PushClient> push_client, const InvalidationVersionMap& initial_max_invalidation_versions, const std::string& initial_invalidation_state, - const syncer::WeakHandle<InvalidationStateTracker>& - invalidation_state_tracker, + const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, const std::string& client_info) : state_(STOPPED), initial_max_invalidation_versions_(initial_max_invalidation_versions), @@ -86,12 +85,11 @@ void InvalidationNotifier::UpdateCredentials( invalidation_client_.UpdateCredentials(email, token); } -void InvalidationNotifier::UpdateEnabledTypes( - syncer::ModelTypeSet enabled_types) { +void InvalidationNotifier::UpdateEnabledTypes(ModelTypeSet enabled_types) { DCHECK(CalledOnValidThread()); CHECK(!invalidation_client_id_.empty()); ObjectIdSet ids; - for (syncer::ModelTypeSet::Iterator it = enabled_types.First(); it.Good(); + for (ModelTypeSet::Iterator it = enabled_types.First(); it.Good(); it.Inc()) { invalidation::ObjectId id; if (!RealModelTypeToObjectId(it.Get(), &id)) { @@ -103,8 +101,7 @@ void InvalidationNotifier::UpdateEnabledTypes( invalidation_client_.RegisterIds(ids); } -void InvalidationNotifier::SendNotification( - syncer::ModelTypeSet changed_types) { +void InvalidationNotifier::SendNotification(ModelTypeSet changed_types) { DCHECK(CalledOnValidThread()); // Do nothing. } @@ -112,10 +109,10 @@ void InvalidationNotifier::SendNotification( void InvalidationNotifier::OnInvalidate(const ObjectIdPayloadMap& id_payloads) { DCHECK(CalledOnValidThread()); // TODO(dcheng): This should probably be a utility function somewhere... - syncer::ModelTypePayloadMap type_payloads; + ModelTypePayloadMap type_payloads; for (ObjectIdPayloadMap::const_iterator it = id_payloads.begin(); it != id_payloads.end(); ++it) { - syncer::ModelType model_type; + ModelType model_type; if (!ObjectIdToRealModelType(it->first, &model_type)) { DLOG(WARNING) << "Invalid object ID: " << ObjectIdToString(it->first); continue; @@ -124,8 +121,7 @@ void InvalidationNotifier::OnInvalidate(const ObjectIdPayloadMap& id_payloads) { } FOR_EACH_OBSERVER( SyncNotifierObserver, observers_, - OnIncomingNotification(type_payloads, - syncer::REMOTE_NOTIFICATION)); + OnIncomingNotification(type_payloads, REMOTE_NOTIFICATION)); } void InvalidationNotifier::OnNotificationsEnabled() { diff --git a/sync/notifier/invalidation_notifier.h b/sync/notifier/invalidation_notifier.h index e76732f..c287efb 100644 --- a/sync/notifier/invalidation_notifier.h +++ b/sync/notifier/invalidation_notifier.h @@ -42,7 +42,7 @@ class InvalidationNotifier scoped_ptr<notifier::PushClient> push_client, const InvalidationVersionMap& initial_max_invalidation_versions, const std::string& initial_invalidation_state, - const syncer::WeakHandle<InvalidationStateTracker>& + const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, const std::string& client_info); @@ -55,10 +55,8 @@ class InvalidationNotifier virtual void SetStateDeprecated(const std::string& state) OVERRIDE; virtual void UpdateCredentials( const std::string& email, const std::string& token) OVERRIDE; - virtual void UpdateEnabledTypes( - syncer::ModelTypeSet enabled_types) OVERRIDE; - virtual void SendNotification( - syncer::ModelTypeSet changed_types) OVERRIDE; + virtual void UpdateEnabledTypes(ModelTypeSet enabled_types) OVERRIDE; + virtual void SendNotification(ModelTypeSet changed_types) OVERRIDE; // ChromeInvalidationClient::Listener implementation. virtual void OnInvalidate(const ObjectIdPayloadMap& id_payloads) OVERRIDE; @@ -82,7 +80,7 @@ class InvalidationNotifier const InvalidationVersionMap initial_max_invalidation_versions_; // Passed to |invalidation_client_|. - const syncer::WeakHandle<InvalidationStateTracker> + const WeakHandle<InvalidationStateTracker> invalidation_state_tracker_; // Passed to |invalidation_client_|. diff --git a/sync/notifier/invalidation_notifier_unittest.cc b/sync/notifier/invalidation_notifier_unittest.cc index 0329ad9..b0b64c7 100644 --- a/sync/notifier/invalidation_notifier_unittest.cc +++ b/sync/notifier/invalidation_notifier_unittest.cc @@ -48,7 +48,7 @@ class InvalidationNotifierTest : public testing::Test { scoped_ptr<notifier::PushClient>(new notifier::FakePushClient()), InvalidationVersionMap(), initial_invalidation_state, - syncer::MakeWeakHandle(mock_tracker_.AsWeakPtr()), + MakeWeakHandle(mock_tracker_.AsWeakPtr()), "fake_client_info")); invalidation_notifier_->AddObserver(&mock_observer_); } @@ -75,10 +75,10 @@ TEST_F(InvalidationNotifierTest, Basic) { CreateAndObserveNotifier("fake_state"); InSequence dummy; - syncer::ModelTypePayloadMap type_payloads; - type_payloads[syncer::PREFERENCES] = "payload"; - type_payloads[syncer::BOOKMARKS] = "payload"; - type_payloads[syncer::AUTOFILL] = "payload"; + ModelTypePayloadMap type_payloads; + type_payloads[PREFERENCES] = "payload"; + type_payloads[BOOKMARKS] = "payload"; + type_payloads[AUTOFILL] = "payload"; EXPECT_CALL(mock_observer_, OnNotificationsEnabled()); EXPECT_CALL(mock_observer_, @@ -100,7 +100,7 @@ TEST_F(InvalidationNotifierTest, Basic) { invalidation_notifier_->OnNotificationsEnabled(); ObjectIdPayloadMap id_payloads; - for (syncer::ModelTypePayloadMap::const_iterator it = type_payloads.begin(); + for (ModelTypePayloadMap::const_iterator it = type_payloads.begin(); it != type_payloads.end(); ++it) { invalidation::ObjectId id; ASSERT_TRUE(RealModelTypeToObjectId(it->first, &id)); diff --git a/sync/notifier/invalidation_util.cc b/sync/notifier/invalidation_util.cc index 5574a8c..0065b50 100644 --- a/sync/notifier/invalidation_util.cc +++ b/sync/notifier/invalidation_util.cc @@ -17,11 +17,10 @@ bool ObjectIdLessThan::operator()(const invalidation::ObjectId& lhs, (lhs.source() == rhs.source() && lhs.name() < rhs.name()); } -bool RealModelTypeToObjectId(syncer::ModelType model_type, +bool RealModelTypeToObjectId(ModelType model_type, invalidation::ObjectId* object_id) { std::string notification_type; - if (!syncer::RealModelTypeToNotificationType( - model_type, ¬ification_type)) { + if (!RealModelTypeToNotificationType(model_type, ¬ification_type)) { return false; } object_id->Init(ipc::invalidation::ObjectSource::CHROME_SYNC, @@ -30,10 +29,8 @@ bool RealModelTypeToObjectId(syncer::ModelType model_type, } bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id, - syncer::ModelType* model_type) { - return - syncer::NotificationTypeToRealModelType( - object_id.name(), model_type); + ModelType* model_type) { + return NotificationTypeToRealModelType(object_id.name(), model_type); } std::string ObjectIdToString( diff --git a/sync/notifier/invalidation_util.h b/sync/notifier/invalidation_util.h index 55de454..1a706ef 100644 --- a/sync/notifier/invalidation_util.h +++ b/sync/notifier/invalidation_util.h @@ -28,11 +28,11 @@ struct ObjectIdLessThan { typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet; -bool RealModelTypeToObjectId(syncer::ModelType model_type, +bool RealModelTypeToObjectId(ModelType model_type, invalidation::ObjectId* object_id); bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id, - syncer::ModelType* model_type); + ModelType* model_type); std::string ObjectIdToString(const invalidation::ObjectId& object_id); diff --git a/sync/notifier/mock_sync_notifier_observer.h b/sync/notifier/mock_sync_notifier_observer.h index badb940..b3baeb9 100644 --- a/sync/notifier/mock_sync_notifier_observer.h +++ b/sync/notifier/mock_sync_notifier_observer.h @@ -20,8 +20,7 @@ class MockSyncNotifierObserver : public SyncNotifierObserver { MOCK_METHOD0(OnNotificationsEnabled, void()); MOCK_METHOD1(OnNotificationsDisabled, void(NotificationsDisabledReason)); MOCK_METHOD2(OnIncomingNotification, - void(const syncer::ModelTypePayloadMap&, - IncomingNotificationSource)); + void(const ModelTypePayloadMap&, IncomingNotificationSource)); }; } // namespace syncer diff --git a/sync/notifier/non_blocking_invalidation_notifier.cc b/sync/notifier/non_blocking_invalidation_notifier.cc index cf5e51a..6ec7849 100644 --- a/sync/notifier/non_blocking_invalidation_notifier.cc +++ b/sync/notifier/non_blocking_invalidation_notifier.cc @@ -23,22 +23,20 @@ class NonBlockingInvalidationNotifier::Core // Called on parent thread. |delegate_observer| should be // initialized. explicit Core( - const syncer::WeakHandle<SyncNotifierObserver>& - delegate_observer); + const WeakHandle<SyncNotifierObserver>& delegate_observer); // Helpers called on I/O thread. void Initialize( const notifier::NotifierOptions& notifier_options, const InvalidationVersionMap& initial_max_invalidation_versions, const std::string& initial_invalidation_state, - const syncer::WeakHandle<InvalidationStateTracker>& - invalidation_state_tracker, + const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, const std::string& client_info); void Teardown(); void SetUniqueId(const std::string& unique_id); void SetStateDeprecated(const std::string& state); void UpdateCredentials(const std::string& email, const std::string& token); - void UpdateEnabledTypes(syncer::ModelTypeSet enabled_types); + void UpdateEnabledTypes(ModelTypeSet enabled_types); // SyncNotifierObserver implementation (all called on I/O thread by // InvalidationNotifier). @@ -46,7 +44,7 @@ class NonBlockingInvalidationNotifier::Core virtual void OnNotificationsDisabled( NotificationsDisabledReason reason) OVERRIDE; virtual void OnIncomingNotification( - const syncer::ModelTypePayloadMap& type_payloads, + const ModelTypePayloadMap& type_payloads, IncomingNotificationSource source) OVERRIDE; private: @@ -56,7 +54,7 @@ class NonBlockingInvalidationNotifier::Core ~Core(); // The variables below should be used only on the I/O thread. - const syncer::WeakHandle<SyncNotifierObserver> delegate_observer_; + const WeakHandle<SyncNotifierObserver> delegate_observer_; scoped_ptr<InvalidationNotifier> invalidation_notifier_; scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; @@ -64,8 +62,7 @@ class NonBlockingInvalidationNotifier::Core }; NonBlockingInvalidationNotifier::Core::Core( - const syncer::WeakHandle<SyncNotifierObserver>& - delegate_observer) + const WeakHandle<SyncNotifierObserver>& delegate_observer) : delegate_observer_(delegate_observer) { DCHECK(delegate_observer_.IsInitialized()); } @@ -77,8 +74,7 @@ void NonBlockingInvalidationNotifier::Core::Initialize( const notifier::NotifierOptions& notifier_options, const InvalidationVersionMap& initial_max_invalidation_versions, const std::string& initial_invalidation_state, - const syncer::WeakHandle<InvalidationStateTracker>& - invalidation_state_tracker, + const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, const std::string& client_info) { DCHECK(notifier_options.request_context_getter); DCHECK_EQ(notifier::NOTIFICATION_SERVER, @@ -123,7 +119,7 @@ void NonBlockingInvalidationNotifier::Core::UpdateCredentials( } void NonBlockingInvalidationNotifier::Core::UpdateEnabledTypes( - syncer::ModelTypeSet enabled_types) { + ModelTypeSet enabled_types) { DCHECK(network_task_runner_->BelongsToCurrentThread()); invalidation_notifier_->UpdateEnabledTypes(enabled_types); } @@ -142,7 +138,7 @@ void NonBlockingInvalidationNotifier::Core::OnNotificationsDisabled( } void NonBlockingInvalidationNotifier::Core::OnIncomingNotification( - const syncer::ModelTypePayloadMap& type_payloads, + const ModelTypePayloadMap& type_payloads, IncomingNotificationSource source) { DCHECK(network_task_runner_->BelongsToCurrentThread()); delegate_observer_.Call(FROM_HERE, @@ -155,13 +151,12 @@ NonBlockingInvalidationNotifier::NonBlockingInvalidationNotifier( const notifier::NotifierOptions& notifier_options, const InvalidationVersionMap& initial_max_invalidation_versions, const std::string& initial_invalidation_state, - const syncer::WeakHandle<InvalidationStateTracker>& + const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, const std::string& client_info) : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), core_( - new Core(syncer::MakeWeakHandle( - weak_ptr_factory_.GetWeakPtr()))), + new Core(MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()))), parent_task_runner_( base::ThreadTaskRunnerHandle::Get()), network_task_runner_(notifier_options.request_context_getter-> @@ -237,7 +232,7 @@ void NonBlockingInvalidationNotifier::UpdateCredentials( } void NonBlockingInvalidationNotifier::UpdateEnabledTypes( - syncer::ModelTypeSet enabled_types) { + ModelTypeSet enabled_types) { DCHECK(parent_task_runner_->BelongsToCurrentThread()); if (!network_task_runner_->PostTask( FROM_HERE, @@ -248,7 +243,7 @@ void NonBlockingInvalidationNotifier::UpdateEnabledTypes( } void NonBlockingInvalidationNotifier::SendNotification( - syncer::ModelTypeSet changed_types) { + ModelTypeSet changed_types) { DCHECK(parent_task_runner_->BelongsToCurrentThread()); // InvalidationClient doesn't implement SendNotification(), so no // need to forward on the call. @@ -268,7 +263,7 @@ void NonBlockingInvalidationNotifier::OnNotificationsDisabled( } void NonBlockingInvalidationNotifier::OnIncomingNotification( - const syncer::ModelTypePayloadMap& type_payloads, + const ModelTypePayloadMap& type_payloads, IncomingNotificationSource source) { DCHECK(parent_task_runner_->BelongsToCurrentThread()); FOR_EACH_OBSERVER(SyncNotifierObserver, observers_, diff --git a/sync/notifier/non_blocking_invalidation_notifier.h b/sync/notifier/non_blocking_invalidation_notifier.h index 0cea979..4756a81 100644 --- a/sync/notifier/non_blocking_invalidation_notifier.h +++ b/sync/notifier/non_blocking_invalidation_notifier.h @@ -37,7 +37,7 @@ class NonBlockingInvalidationNotifier const notifier::NotifierOptions& notifier_options, const InvalidationVersionMap& initial_max_invalidation_versions, const std::string& initial_invalidation_state, - const syncer::WeakHandle<InvalidationStateTracker>& + const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, const std::string& client_info); @@ -50,17 +50,15 @@ class NonBlockingInvalidationNotifier virtual void SetStateDeprecated(const std::string& state) OVERRIDE; virtual void UpdateCredentials( const std::string& email, const std::string& token) OVERRIDE; - virtual void UpdateEnabledTypes( - syncer::ModelTypeSet enabled_types) OVERRIDE; - virtual void SendNotification( - syncer::ModelTypeSet changed_types) OVERRIDE; + virtual void UpdateEnabledTypes(ModelTypeSet enabled_types) OVERRIDE; + virtual void SendNotification(ModelTypeSet changed_types) OVERRIDE; // SyncNotifierObserver implementation. virtual void OnNotificationsEnabled() OVERRIDE; virtual void OnNotificationsDisabled( NotificationsDisabledReason reason) OVERRIDE; virtual void OnIncomingNotification( - const syncer::ModelTypePayloadMap& type_payloads, + const ModelTypePayloadMap& type_payloads, IncomingNotificationSource source) OVERRIDE; private: diff --git a/sync/notifier/non_blocking_invalidation_notifier_unittest.cc b/sync/notifier/non_blocking_invalidation_notifier_unittest.cc index bd8cceb..7a30f58 100644 --- a/sync/notifier/non_blocking_invalidation_notifier_unittest.cc +++ b/sync/notifier/non_blocking_invalidation_notifier_unittest.cc @@ -43,8 +43,7 @@ class NonBlockingInvalidationNotifierTest : public testing::Test { notifier_options, InvalidationVersionMap(), std::string(), // initial_invalidation_state - syncer::MakeWeakHandle( - base::WeakPtr<syncer::InvalidationStateTracker>()), + MakeWeakHandle(base::WeakPtr<InvalidationStateTracker>()), "fake_client_info")); invalidation_notifier_->AddObserver(&mock_observer_); } @@ -68,10 +67,10 @@ class NonBlockingInvalidationNotifierTest : public testing::Test { TEST_F(NonBlockingInvalidationNotifierTest, Basic) { InSequence dummy; - syncer::ModelTypePayloadMap type_payloads; - type_payloads[syncer::PREFERENCES] = "payload"; - type_payloads[syncer::BOOKMARKS] = ""; - type_payloads[syncer::AUTOFILL] = ""; + ModelTypePayloadMap type_payloads; + type_payloads[PREFERENCES] = "payload"; + type_payloads[BOOKMARKS] = ""; + type_payloads[AUTOFILL] = ""; EXPECT_CALL(mock_observer_, OnNotificationsEnabled()); EXPECT_CALL(mock_observer_, diff --git a/sync/notifier/p2p_notifier.cc b/sync/notifier/p2p_notifier.cc index c72895e..e2a4209 100644 --- a/sync/notifier/p2p_notifier.cc +++ b/sync/notifier/p2p_notifier.cc @@ -64,7 +64,7 @@ P2PNotificationData::P2PNotificationData() : target_(NOTIFY_SELF) {} P2PNotificationData::P2PNotificationData( const std::string& sender_id, P2PNotificationTarget target, - syncer::ModelTypeSet changed_types) + ModelTypeSet changed_types) : sender_id_(sender_id), target_(target), changed_types_(changed_types) {} @@ -85,7 +85,7 @@ bool P2PNotificationData::IsTargeted(const std::string& id) const { } } -syncer::ModelTypeSet P2PNotificationData::GetChangedTypes() const { +ModelTypeSet P2PNotificationData::GetChangedTypes() const { return changed_types_; } @@ -101,7 +101,7 @@ std::string P2PNotificationData::ToString() const { dict->SetString(kSenderIdKey, sender_id_); dict->SetString(kNotificationTypeKey, P2PNotificationTargetToString(target_)); - dict->Set(kChangedTypesKey, syncer::ModelTypeSetToValue(changed_types_)); + dict->Set(kChangedTypesKey, ModelTypeSetToValue(changed_types_)); std::string json; base::JSONWriter::Write(dict.get(), &json); return json; @@ -136,7 +136,7 @@ bool P2PNotificationData::ResetFromString(const std::string& str) { << kChangedTypesKey; return false; } - changed_types_ = syncer::ModelTypeSetFromValue(*changed_types_list); + changed_types_ = ModelTypeSetFromValue(*changed_types_list); return true; } @@ -193,10 +193,9 @@ void P2PNotifier::UpdateCredentials( logged_in_ = true; } -void P2PNotifier::UpdateEnabledTypes( - syncer::ModelTypeSet enabled_types) { +void P2PNotifier::UpdateEnabledTypes(ModelTypeSet enabled_types) { DCHECK(thread_checker_.CalledOnValidThread()); - const syncer::ModelTypeSet new_enabled_types = + const ModelTypeSet new_enabled_types = Difference(enabled_types, enabled_types_); enabled_types_ = enabled_types; const P2PNotificationData notification_data( @@ -204,8 +203,7 @@ void P2PNotifier::UpdateEnabledTypes( SendNotificationData(notification_data); } -void P2PNotifier::SendNotification( - syncer::ModelTypeSet changed_types) { +void P2PNotifier::SendNotification(ModelTypeSet changed_types) { DCHECK(thread_checker_.CalledOnValidThread()); const P2PNotificationData notification_data( unique_id_, send_notification_target_, changed_types); @@ -266,8 +264,8 @@ void P2PNotifier::OnIncomingNotification( DVLOG(1) << "No changed types -- not emitting notification"; return; } - const syncer::ModelTypePayloadMap& type_payloads = - syncer::ModelTypePayloadMapFromEnumSet( + const ModelTypePayloadMap& type_payloads = + ModelTypePayloadMapFromEnumSet( notification_data.GetChangedTypes(), std::string()); FOR_EACH_OBSERVER(SyncNotifierObserver, observer_list_, OnIncomingNotification(type_payloads, REMOTE_NOTIFICATION)); diff --git a/sync/notifier/p2p_notifier.h b/sync/notifier/p2p_notifier.h index 83ce595..a360f25 100644 --- a/sync/notifier/p2p_notifier.h +++ b/sync/notifier/p2p_notifier.h @@ -55,14 +55,14 @@ class P2PNotificationData { P2PNotificationData(); P2PNotificationData(const std::string& sender_id, P2PNotificationTarget target, - syncer::ModelTypeSet changed_types); + ModelTypeSet changed_types); ~P2PNotificationData(); // Returns true if the given ID is targeted by this notification. bool IsTargeted(const std::string& id) const; - syncer::ModelTypeSet GetChangedTypes() const; + ModelTypeSet GetChangedTypes() const; bool Equals(const P2PNotificationData& other) const; @@ -78,7 +78,7 @@ class P2PNotificationData { // The intendent recipient(s) of the notification. P2PNotificationTarget target_; // The types the notification is for. - syncer::ModelTypeSet changed_types_; + ModelTypeSet changed_types_; }; class P2PNotifier @@ -102,10 +102,8 @@ class P2PNotifier virtual void SetStateDeprecated(const std::string& state) OVERRIDE; virtual void UpdateCredentials( const std::string& email, const std::string& token) OVERRIDE; - virtual void UpdateEnabledTypes( - syncer::ModelTypeSet enabled_types) OVERRIDE; - virtual void SendNotification( - syncer::ModelTypeSet changed_types) OVERRIDE; + virtual void UpdateEnabledTypes(ModelTypeSet enabled_types) OVERRIDE; + virtual void SendNotification(ModelTypeSet changed_types) OVERRIDE; // PushClientObserver implementation. virtual void OnNotificationsEnabled() OVERRIDE; @@ -134,7 +132,7 @@ class P2PNotifier // Which set of clients should be sent notifications. P2PNotificationTarget send_notification_target_; - syncer::ModelTypeSet enabled_types_; + ModelTypeSet enabled_types_; }; } // namespace syncer diff --git a/sync/notifier/p2p_notifier_unittest.cc b/sync/notifier/p2p_notifier_unittest.cc index a219824..e6e406a 100644 --- a/sync/notifier/p2p_notifier_unittest.cc +++ b/sync/notifier/p2p_notifier_unittest.cc @@ -34,8 +34,8 @@ class P2PNotifierTest : public testing::Test { p2p_notifier_.RemoveObserver(&mock_observer_); } - syncer::ModelTypePayloadMap MakePayloadMap(syncer::ModelTypeSet types) { - return syncer::ModelTypePayloadMapFromEnumSet(types, ""); + ModelTypePayloadMap MakePayloadMap(ModelTypeSet types) { + return ModelTypePayloadMapFromEnumSet(types, ""); } // Simulate receiving all the notifications we sent out since last @@ -75,21 +75,21 @@ TEST_F(P2PNotifierTest, P2PNotificationTarget) { TEST_F(P2PNotifierTest, P2PNotificationDataIsTargeted) { { const P2PNotificationData notification_data( - "sender", NOTIFY_SELF, syncer::ModelTypeSet()); + "sender", NOTIFY_SELF, 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, syncer::ModelTypeSet()); + "sender", NOTIFY_OTHERS, 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, syncer::ModelTypeSet()); + "sender", NOTIFY_ALL, ModelTypeSet()); EXPECT_TRUE(notification_data.IsTargeted("sender")); EXPECT_TRUE(notification_data.IsTargeted("other1")); EXPECT_TRUE(notification_data.IsTargeted("other2")); @@ -117,7 +117,7 @@ TEST_F(P2PNotifierTest, P2PNotificationDataDefault) { // Make sure the P2PNotificationData <-> string conversions work for a // non-default-constructed P2PNotificationData. TEST_F(P2PNotifierTest, P2PNotificationDataNonDefault) { - const syncer::ModelTypeSet changed_types(syncer::BOOKMARKS, syncer::THEMES); + const ModelTypeSet changed_types(BOOKMARKS, THEMES); const P2PNotificationData notification_data( "sender", NOTIFY_ALL, changed_types); EXPECT_TRUE(notification_data.IsTargeted("sender")); @@ -140,7 +140,7 @@ TEST_F(P2PNotifierTest, P2PNotificationDataNonDefault) { // observer should receive only a notification from the call to // UpdateEnabledTypes(). TEST_F(P2PNotifierTest, NotificationsBasic) { - syncer::ModelTypeSet enabled_types(syncer::BOOKMARKS, syncer::PREFERENCES); + ModelTypeSet enabled_types(BOOKMARKS, PREFERENCES); EXPECT_CALL(mock_observer_, OnNotificationsEnabled()); EXPECT_CALL(mock_observer_, @@ -171,7 +171,7 @@ TEST_F(P2PNotifierTest, NotificationsBasic) { // Sent with target NOTIFY_OTHERS so should not be propagated to // |mock_observer_|. { - syncer::ModelTypeSet changed_types(syncer::THEMES, syncer::APPS); + ModelTypeSet changed_types(THEMES, APPS); p2p_notifier_.SendNotification(changed_types); } @@ -182,11 +182,11 @@ TEST_F(P2PNotifierTest, NotificationsBasic) { // target settings. The notifications received by the observer should // be consistent with the target settings. TEST_F(P2PNotifierTest, SendNotificationData) { - syncer::ModelTypeSet enabled_types(syncer::BOOKMARKS, syncer::PREFERENCES); + ModelTypeSet enabled_types(BOOKMARKS, PREFERENCES); - syncer::ModelTypeSet changed_types(syncer::THEMES, syncer::APPS); + ModelTypeSet changed_types(THEMES, APPS); - const syncer::ModelTypePayloadMap& changed_payload_map = + const ModelTypePayloadMap& changed_payload_map = MakePayloadMap(changed_types); EXPECT_CALL(mock_observer_, OnNotificationsEnabled()); @@ -228,7 +228,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) { // Should be dropped. Mock::VerifyAndClearExpectations(&mock_observer_); p2p_notifier_.SendNotificationDataForTest( - P2PNotificationData("sender", NOTIFY_SELF, syncer::ModelTypeSet())); + P2PNotificationData("sender", NOTIFY_SELF, ModelTypeSet())); ReflectSentNotifications(); @@ -250,7 +250,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) { // Should be dropped. Mock::VerifyAndClearExpectations(&mock_observer_); p2p_notifier_.SendNotificationDataForTest( - P2PNotificationData("sender2", NOTIFY_OTHERS, syncer::ModelTypeSet())); + P2PNotificationData("sender2", NOTIFY_OTHERS, ModelTypeSet())); ReflectSentNotifications(); @@ -275,7 +275,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) { // Should be dropped. Mock::VerifyAndClearExpectations(&mock_observer_); p2p_notifier_.SendNotificationDataForTest( - P2PNotificationData("sender2", NOTIFY_ALL, syncer::ModelTypeSet())); + P2PNotificationData("sender2", NOTIFY_ALL, ModelTypeSet())); ReflectSentNotifications(); } diff --git a/sync/notifier/sync_notifier.h b/sync/notifier/sync_notifier.h index 24c59a0..0c775f4 100644 --- a/sync/notifier/sync_notifier.h +++ b/sync/notifier/sync_notifier.h @@ -40,13 +40,13 @@ class SyncNotifier { virtual void UpdateCredentials( const std::string& email, const std::string& token) = 0; - virtual void UpdateEnabledTypes(syncer::ModelTypeSet enabled_types) = 0; + virtual void UpdateEnabledTypes(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(syncer::ModelTypeSet changed_types) = 0; + virtual void SendNotification(ModelTypeSet changed_types) = 0; }; } // namespace syncer diff --git a/sync/notifier/sync_notifier_factory.cc b/sync/notifier/sync_notifier_factory.cc index 66077bd..3737f71 100644 --- a/sync/notifier/sync_notifier_factory.cc +++ b/sync/notifier/sync_notifier_factory.cc @@ -19,8 +19,7 @@ SyncNotifier* CreateDefaultSyncNotifier( const notifier::NotifierOptions& notifier_options, const InvalidationVersionMap& initial_max_invalidation_versions, const std::string& initial_invalidation_state, - const syncer::WeakHandle<InvalidationStateTracker>& - invalidation_state_tracker, + const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, const std::string& client_info) { if (notifier_options.notification_method == notifier::NOTIFICATION_P2P) { // TODO(rlarocque): Ideally, the notification target would be diff --git a/sync/notifier/sync_notifier_factory.h b/sync/notifier/sync_notifier_factory.h index 1d8dcd1..0c8a2d3 100644 --- a/sync/notifier/sync_notifier_factory.h +++ b/sync/notifier/sync_notifier_factory.h @@ -40,7 +40,7 @@ class SyncNotifierFactory { const std::string client_info_; const InvalidationVersionMap initial_max_invalidation_versions_; const std::string initial_invalidation_state_; - const syncer::WeakHandle<InvalidationStateTracker> + const WeakHandle<InvalidationStateTracker> invalidation_state_tracker_; }; diff --git a/sync/notifier/sync_notifier_factory_unittest.cc b/sync/notifier/sync_notifier_factory_unittest.cc index e11d9cf..52fd505 100644 --- a/sync/notifier/sync_notifier_factory_unittest.cc +++ b/sync/notifier/sync_notifier_factory_unittest.cc @@ -54,7 +54,7 @@ TEST_F(SyncNotifierFactoryTest, Basic) { SyncNotifierFactory factory( notifier_options_, "test client info", - base::WeakPtr<syncer::InvalidationStateTracker>()); + base::WeakPtr<InvalidationStateTracker>()); scoped_ptr<SyncNotifier> notifier(factory.CreateSyncNotifier()); #if defined(OS_ANDROID) ASSERT_FALSE(notifier.get()); @@ -71,7 +71,7 @@ TEST_F(SyncNotifierFactoryTest, Basic_P2P) { SyncNotifierFactory factory( notifier_options_, "test client info", - base::WeakPtr<syncer::InvalidationStateTracker>()); + base::WeakPtr<InvalidationStateTracker>()); scoped_ptr<SyncNotifier> notifier(factory.CreateSyncNotifier()); #if defined(OS_ANDROID) ASSERT_FALSE(notifier.get()); diff --git a/sync/notifier/sync_notifier_observer.h b/sync/notifier/sync_notifier_observer.h index 54a0b2f..eaea91f 100644 --- a/sync/notifier/sync_notifier_observer.h +++ b/sync/notifier/sync_notifier_observer.h @@ -30,7 +30,7 @@ class SyncNotifierObserver { // Called when a notification is received. The per-type payloads // are in |type_payloads| and the source is in |source|. virtual void OnIncomingNotification( - const syncer::ModelTypePayloadMap& type_payloads, + const ModelTypePayloadMap& type_payloads, IncomingNotificationSource source) = 0; protected: diff --git a/sync/protocol/proto_value_conversions_unittest.cc b/sync/protocol/proto_value_conversions_unittest.cc index 096ec0f..4bd5f07 100644 --- a/sync/protocol/proto_value_conversions_unittest.cc +++ b/sync/protocol/proto_value_conversions_unittest.cc @@ -47,7 +47,7 @@ TEST_F(ProtoValueConversionsTest, ProtoChangeCheck) { // If this number changes, that means we added or removed a data // type. Don't forget to add a unit test for {New // type}SpecificsToValue below. - EXPECT_EQ(17, syncer::MODEL_TYPE_COUNT); + EXPECT_EQ(17, MODEL_TYPE_COUNT); // We'd also like to check if we changed any field in our messages. // However, that's hard to do: sizeof could work, but it's @@ -183,7 +183,7 @@ TEST_F(ProtoValueConversionsTest, EntitySpecificsToValue) { #undef SET_FIELD scoped_ptr<DictionaryValue> value(EntitySpecificsToValue(specifics)); - EXPECT_EQ(syncer::MODEL_TYPE_COUNT - syncer::FIRST_REAL_MODEL_TYPE, + EXPECT_EQ(MODEL_TYPE_COUNT - FIRST_REAL_MODEL_TYPE, static_cast<int>(value->size())); } diff --git a/sync/protocol/sync_protocol_error.h b/sync/protocol/sync_protocol_error.h index 930f39d..f23659b 100644 --- a/sync/protocol/sync_protocol_error.h +++ b/sync/protocol/sync_protocol_error.h @@ -67,7 +67,7 @@ struct SyncProtocolError { std::string error_description; std::string url; ClientAction action; - syncer::ModelTypeSet error_data_types; + ModelTypeSet error_data_types; SyncProtocolError(); ~SyncProtocolError(); DictionaryValue* ToValue() const; diff --git a/sync/sessions/ordered_commit_set.cc b/sync/sessions/ordered_commit_set.cc index 06a5988..f2f3755 100644 --- a/sync/sessions/ordered_commit_set.cc +++ b/sync/sessions/ordered_commit_set.cc @@ -11,8 +11,7 @@ namespace syncer { namespace sessions { -OrderedCommitSet::OrderedCommitSet( - const syncer::ModelSafeRoutingInfo& routes) +OrderedCommitSet::OrderedCommitSet(const ModelSafeRoutingInfo& routes) : routes_(routes) { } @@ -20,7 +19,7 @@ OrderedCommitSet::~OrderedCommitSet() {} void OrderedCommitSet::AddCommitItem(const int64 metahandle, const syncable::Id& commit_id, - syncer::ModelType type) { + ModelType type) { if (!HaveCommitItem(metahandle)) { inserted_metahandles_.insert(metahandle); metahandle_order_.push_back(metahandle); @@ -32,7 +31,7 @@ void OrderedCommitSet::AddCommitItem(const int64 metahandle, } const OrderedCommitSet::Projection& OrderedCommitSet::GetCommitIdProjection( - syncer::ModelSafeGroup group) const { + ModelSafeGroup group) const { Projections::const_iterator i = projections_.find(group); DCHECK(i != projections_.end()); return i->second; @@ -99,8 +98,7 @@ OrderedCommitSet::CommitItem OrderedCommitSet::GetCommitItemAt( } bool OrderedCommitSet::HasBookmarkCommitId() const { - ModelSafeRoutingInfo::const_iterator group - = routes_.find(syncer::BOOKMARKS); + ModelSafeRoutingInfo::const_iterator group = routes_.find(BOOKMARKS); if (group == routes_.end()) return false; Projections::const_iterator proj = projections_.find(group->second); @@ -108,7 +106,7 @@ bool OrderedCommitSet::HasBookmarkCommitId() const { return false; DCHECK_LE(proj->second.size(), types_.size()); for (size_t i = 0; i < proj->second.size(); i++) { - if (types_[proj->second[i]] == syncer::BOOKMARKS) + if (types_[proj->second[i]] == BOOKMARKS) return true; } return false; diff --git a/sync/sessions/ordered_commit_set.h b/sync/sessions/ordered_commit_set.h index 4226d28..cc6940a 100644 --- a/sync/sessions/ordered_commit_set.h +++ b/sync/sessions/ordered_commit_set.h @@ -29,7 +29,7 @@ class OrderedCommitSet { typedef std::vector<size_t> Projection; // TODO(chron): Reserve space according to batch size? - explicit OrderedCommitSet(const syncer::ModelSafeRoutingInfo& routes); + explicit OrderedCommitSet(const ModelSafeRoutingInfo& routes); ~OrderedCommitSet(); bool HaveCommitItem(const int64 metahandle) const { @@ -37,7 +37,7 @@ class OrderedCommitSet { } void AddCommitItem(const int64 metahandle, const syncable::Id& commit_id, - syncer::ModelType type); + ModelType type); const std::vector<syncable::Id>& GetAllCommitIds() const { return commit_ids_; @@ -55,7 +55,7 @@ class OrderedCommitSet { } // Same as above, but for ModelType of the item. - syncer::ModelType GetModelTypeAt(const size_t position) const { + ModelType GetModelTypeAt(const size_t position) const { return types_[position]; } @@ -64,7 +64,7 @@ class OrderedCommitSet { // response one ModelSafeGroup at a time. See GetCommitIdAt for how the // indices contained in the returned Projection can be used. const Projection& GetCommitIdProjection( - syncer::ModelSafeGroup group) const; + ModelSafeGroup group) const; size_t Size() const { return commit_ids_.size(); @@ -88,13 +88,13 @@ class OrderedCommitSet { void operator=(const OrderedCommitSet& other); private: // A set of CommitIdProjections associated with particular ModelSafeGroups. - typedef std::map<syncer::ModelSafeGroup, Projection> Projections; + typedef std::map<ModelSafeGroup, Projection> Projections; // Helper container for return value of GetCommitItemAt. struct CommitItem { int64 meta; syncable::Id id; - syncer::ModelType group; + ModelType group; }; CommitItem GetCommitItemAt(const size_t position) const; @@ -112,9 +112,9 @@ class OrderedCommitSet { // projection. We could store it in commit_ids_, but sometimes we want // to just return the vector of Ids, so this is more straightforward // and shouldn't take up too much extra space since commit lists are small. - std::vector<syncer::ModelType> types_; + std::vector<ModelType> types_; - syncer::ModelSafeRoutingInfo routes_; + ModelSafeRoutingInfo routes_; }; } // namespace sessions diff --git a/sync/sessions/ordered_commit_set_unittest.cc b/sync/sessions/ordered_commit_set_unittest.cc index 9be2992..afb76b7 100644 --- a/sync/sessions/ordered_commit_set_unittest.cc +++ b/sync/sessions/ordered_commit_set_unittest.cc @@ -15,14 +15,14 @@ namespace { class OrderedCommitSetTest : public testing::Test { public: OrderedCommitSetTest() { - routes_[syncer::BOOKMARKS] = syncer::GROUP_UI; - routes_[syncer::PREFERENCES] = syncer::GROUP_UI; - routes_[syncer::AUTOFILL] = syncer::GROUP_DB; - routes_[syncer::TOP_LEVEL_FOLDER] = syncer::GROUP_PASSIVE; + routes_[BOOKMARKS] = GROUP_UI; + routes_[PREFERENCES] = GROUP_UI; + routes_[AUTOFILL] = GROUP_DB; + routes_[TOP_LEVEL_FOLDER] = GROUP_PASSIVE; } protected: - syncer::TestIdFactory ids_; - syncer::ModelSafeRoutingInfo routes_; + TestIdFactory ids_; + ModelSafeRoutingInfo routes_; }; TEST_F(OrderedCommitSetTest, Projections) { @@ -31,18 +31,18 @@ TEST_F(OrderedCommitSetTest, Projections) { expected.push_back(ids_.NewLocalId()); OrderedCommitSet commit_set1(routes_), commit_set2(routes_); - commit_set1.AddCommitItem(0, expected[0], syncer::BOOKMARKS); - commit_set1.AddCommitItem(1, expected[1], syncer::BOOKMARKS); - commit_set1.AddCommitItem(2, expected[2], syncer::PREFERENCES); + commit_set1.AddCommitItem(0, expected[0], BOOKMARKS); + commit_set1.AddCommitItem(1, expected[1], BOOKMARKS); + commit_set1.AddCommitItem(2, expected[2], PREFERENCES); // Duplicates should be dropped. - commit_set1.AddCommitItem(2, expected[2], syncer::PREFERENCES); - commit_set1.AddCommitItem(3, expected[3], syncer::TOP_LEVEL_FOLDER); - commit_set1.AddCommitItem(4, expected[4], syncer::TOP_LEVEL_FOLDER); - commit_set2.AddCommitItem(7, expected[7], syncer::AUTOFILL); - commit_set2.AddCommitItem(6, expected[6], syncer::AUTOFILL); - commit_set2.AddCommitItem(5, expected[5], syncer::AUTOFILL); + commit_set1.AddCommitItem(2, expected[2], PREFERENCES); + commit_set1.AddCommitItem(3, expected[3], TOP_LEVEL_FOLDER); + commit_set1.AddCommitItem(4, expected[4], TOP_LEVEL_FOLDER); + commit_set2.AddCommitItem(7, expected[7], AUTOFILL); + commit_set2.AddCommitItem(6, expected[6], AUTOFILL); + commit_set2.AddCommitItem(5, expected[5], AUTOFILL); // Add something in set1 to set2, which should get dropped by AppendReverse. - commit_set2.AddCommitItem(0, expected[0], syncer::BOOKMARKS); + commit_set2.AddCommitItem(0, expected[0], BOOKMARKS); commit_set1.AppendReverse(commit_set2); // First, we should verify the projections are correct. Second, we want to @@ -101,15 +101,15 @@ TEST_F(OrderedCommitSetTest, Projections) { TEST_F(OrderedCommitSetTest, HasBookmarkCommitId) { OrderedCommitSet commit_set(routes_); - commit_set.AddCommitItem(0, ids_.NewLocalId(), syncer::AUTOFILL); - commit_set.AddCommitItem(1, ids_.NewLocalId(), syncer::TOP_LEVEL_FOLDER); + commit_set.AddCommitItem(0, ids_.NewLocalId(), AUTOFILL); + commit_set.AddCommitItem(1, ids_.NewLocalId(), TOP_LEVEL_FOLDER); EXPECT_FALSE(commit_set.HasBookmarkCommitId()); - commit_set.AddCommitItem(2, ids_.NewLocalId(), syncer::PREFERENCES); - commit_set.AddCommitItem(3, ids_.NewLocalId(), syncer::PREFERENCES); + commit_set.AddCommitItem(2, ids_.NewLocalId(), PREFERENCES); + commit_set.AddCommitItem(3, ids_.NewLocalId(), PREFERENCES); EXPECT_FALSE(commit_set.HasBookmarkCommitId()); - commit_set.AddCommitItem(4, ids_.NewLocalId(), syncer::BOOKMARKS); + commit_set.AddCommitItem(4, ids_.NewLocalId(), BOOKMARKS); EXPECT_TRUE(commit_set.HasBookmarkCommitId()); commit_set.Truncate(4); @@ -121,7 +121,7 @@ TEST_F(OrderedCommitSetTest, AddAndRemoveEntries) { ASSERT_TRUE(commit_set.Empty()); - commit_set.AddCommitItem(0, ids_.NewLocalId(), syncer::AUTOFILL); + commit_set.AddCommitItem(0, ids_.NewLocalId(), AUTOFILL); ASSERT_EQ(static_cast<size_t>(1), commit_set.Size()); commit_set.Clear(); diff --git a/sync/sessions/session_state_unittest.cc b/sync/sessions/session_state_unittest.cc index b227ac7..5685e28 100644 --- a/sync/sessions/session_state_unittest.cc +++ b/sync/sessions/session_state_unittest.cc @@ -30,11 +30,11 @@ class SessionStateTest : public testing::Test {}; TEST_F(SessionStateTest, SyncSourceInfoToValue) { sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source = sync_pb::GetUpdatesCallerInfo::PERIODIC; - syncer::ModelTypePayloadMap types; - types[syncer::PREFERENCES] = "preferencespayload"; - types[syncer::EXTENSIONS] = ""; + ModelTypePayloadMap types; + types[PREFERENCES] = "preferencespayload"; + types[EXTENSIONS] = ""; scoped_ptr<DictionaryValue> expected_types_value( - syncer::ModelTypePayloadMapToValue(types)); + ModelTypePayloadMapToValue(types)); SyncSourceInfo source_info(updates_source, types); @@ -57,16 +57,15 @@ TEST_F(SessionStateTest, SyncSessionSnapshotToValue) { const bool kIsShareUsable = true; - const syncer::ModelTypeSet initial_sync_ended( - syncer::BOOKMARKS, syncer::PREFERENCES); + const ModelTypeSet initial_sync_ended(BOOKMARKS, PREFERENCES); scoped_ptr<ListValue> expected_initial_sync_ended_value( - syncer::ModelTypeSetToValue(initial_sync_ended)); + ModelTypeSetToValue(initial_sync_ended)); - syncer::ModelTypePayloadMap download_progress_markers; - download_progress_markers[syncer::BOOKMARKS] = "test"; - download_progress_markers[syncer::APPS] = "apps"; + ModelTypePayloadMap download_progress_markers; + download_progress_markers[BOOKMARKS] = "test"; + download_progress_markers[APPS] = "apps"; scoped_ptr<DictionaryValue> expected_download_progress_markers_value( - syncer::ModelTypePayloadMapToValue(download_progress_markers)); + ModelTypePayloadMapToValue(download_progress_markers)); const bool kHasMoreToSync = false; const bool kIsSilenced = true; diff --git a/sync/sessions/status_controller.cc b/sync/sessions/status_controller.cc index 92bef9f..3694fe4 100644 --- a/sync/sessions/status_controller.cc +++ b/sync/sessions/status_controller.cc @@ -94,8 +94,7 @@ void StatusController::increment_num_updates_downloaded_by(int value) { model_neutral_.num_updates_downloaded_total += value; } -void StatusController::set_types_needing_local_migration( - syncer::ModelTypeSet types) { +void StatusController::set_types_needing_local_migration(ModelTypeSet types) { model_neutral_.types_needing_local_migration = types; } diff --git a/sync/sessions/status_controller.h b/sync/sessions/status_controller.h index 9ffc93f..8542b48 100644 --- a/sync/sessions/status_controller.h +++ b/sync/sessions/status_controller.h @@ -67,10 +67,10 @@ class StatusController { ModelSafeGroup group); // ClientToServer messages. - const syncer::ModelTypeSet updates_request_types() const { + const ModelTypeSet updates_request_types() const { return model_neutral_.updates_request_types; } - void set_updates_request_types(syncer::ModelTypeSet value) { + void set_updates_request_types(ModelTypeSet value) { model_neutral_.updates_request_types = value; } const sync_pb::ClientToServerResponse& updates_response() const { @@ -142,7 +142,7 @@ class StatusController { } bool HasBookmarkCommitActivity() const { - return ActiveGroupRestrictionIncludesModel(syncer::BOOKMARKS); + return ActiveGroupRestrictionIncludesModel(BOOKMARKS); } const ModelNeutralState& model_neutral_state() const { @@ -157,7 +157,7 @@ class StatusController { void increment_num_updates_downloaded_by(int value); void increment_num_tombstone_updates_downloaded_by(int value); void increment_num_reflected_updates_downloaded_by(int value); - void set_types_needing_local_migration(syncer::ModelTypeSet types); + void set_types_needing_local_migration(ModelTypeSet types); void increment_num_local_overwrites(); void increment_num_server_overwrites(); void set_sync_protocol_error(const SyncProtocolError& error); @@ -178,7 +178,7 @@ class StatusController { // Check whether a particular model is included by the active group // restriction. - bool ActiveGroupRestrictionIncludesModel(syncer::ModelType model) const { + bool ActiveGroupRestrictionIncludesModel(ModelType model) const { if (!group_restriction_in_effect_) return true; ModelSafeRoutingInfo::const_iterator it = routing_info_.find(model); diff --git a/sync/sessions/status_controller_unittest.cc b/sync/sessions/status_controller_unittest.cc index ee1a737..8fec64d 100644 --- a/sync/sessions/status_controller_unittest.cc +++ b/sync/sessions/status_controller_unittest.cc @@ -12,7 +12,7 @@ namespace sessions { class StatusControllerTest : public testing::Test { public: virtual void SetUp() { - routes_[syncer::BOOKMARKS] = GROUP_UI; + routes_[BOOKMARKS] = GROUP_UI; } protected: ModelSafeRoutingInfo routes_; diff --git a/sync/sessions/sync_session.cc b/sync/sessions/sync_session.cc index 0281dcd..7af4c50 100644 --- a/sync/sessions/sync_session.cc +++ b/sync/sessions/sync_session.cc @@ -48,17 +48,17 @@ std::set<ModelSafeGroup> ComputeEnabledGroups( return enabled_groups; } -void PurgeStalePayload(syncer::ModelTypePayloadMap* original, +void PurgeStalePayload(ModelTypePayloadMap* original, const ModelSafeRoutingInfo& routing_info) { - std::vector<syncer::ModelTypePayloadMap::iterator> iterators_to_delete; - for (syncer::ModelTypePayloadMap::iterator i = original->begin(); + std::vector<ModelTypePayloadMap::iterator> iterators_to_delete; + for (ModelTypePayloadMap::iterator i = original->begin(); i != original->end(); ++i) { if (routing_info.end() == routing_info.find(i->first)) { iterators_to_delete.push_back(i); } } - for (std::vector<syncer::ModelTypePayloadMap::iterator>::iterator + for (std::vector<ModelTypePayloadMap::iterator>::iterator it = iterators_to_delete.begin(); it != iterators_to_delete.end(); ++it) { original->erase(*it); @@ -156,11 +156,10 @@ SyncSessionSnapshot SyncSession::TakeSnapshot() const { syncable::Directory* dir = context_->directory(); bool is_share_useable = true; - syncer::ModelTypeSet initial_sync_ended; - syncer::ModelTypePayloadMap download_progress_markers; - for (int i = syncer::FIRST_REAL_MODEL_TYPE; - i < syncer::MODEL_TYPE_COUNT; ++i) { - syncer::ModelType type(syncer::ModelTypeFromInt(i)); + ModelTypeSet initial_sync_ended; + ModelTypePayloadMap download_progress_markers; + for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { + ModelType type(ModelTypeFromInt(i)); if (routing_info_.count(type) != 0) { if (dir->initial_sync_ended_for_type(type)) initial_sync_ended.Put(type); diff --git a/sync/sessions/sync_session_context.cc b/sync/sessions/sync_session_context.cc index 8edb458..8e28b5f 100644 --- a/sync/sessions/sync_session_context.cc +++ b/sync/sessions/sync_session_context.cc @@ -23,7 +23,7 @@ SyncSessionContext::SyncSessionContext( ThrottledDataTypeTracker* throttled_data_type_tracker, const std::vector<SyncEngineEventListener*>& listeners, DebugInfoGetter* debug_info_getter, - syncer::TrafficRecorder* traffic_recorder) + TrafficRecorder* traffic_recorder) : resolver_(NULL), connection_manager_(connection_manager), directory_(directory), diff --git a/sync/sessions/sync_session_context.h b/sync/sessions/sync_session_context.h index 28baeaf..3255b94 100644 --- a/sync/sessions/sync_session_context.h +++ b/sync/sessions/sync_session_context.h @@ -57,7 +57,7 @@ class SyncSessionContext { ThrottledDataTypeTracker* throttled_data_type_tracker, const std::vector<SyncEngineEventListener*>& listeners, DebugInfoGetter* debug_info_getter, - syncer::TrafficRecorder* traffic_recorder); + TrafficRecorder* traffic_recorder); ~SyncSessionContext(); ConflictResolver* resolver() { return resolver_; } @@ -123,7 +123,7 @@ class SyncSessionContext { OnSyncEngineEvent(event)); } - syncer::TrafficRecorder* traffic_recorder() { + TrafficRecorder* traffic_recorder() { return traffic_recorder_; } @@ -173,7 +173,7 @@ class SyncSessionContext { // client behavior on server side. DebugInfoGetter* const debug_info_getter_; - syncer::TrafficRecorder* traffic_recorder_; + TrafficRecorder* traffic_recorder_; DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); }; diff --git a/sync/sessions/sync_session_unittest.cc b/sync/sessions/sync_session_unittest.cc index 6fe3bb0..1029e1d 100644 --- a/sync/sessions/sync_session_unittest.cc +++ b/sync/sessions/sync_session_unittest.cc @@ -53,8 +53,8 @@ class SyncSessionTest : public testing::Test, throttled_data_type_tracker_.get(), std::vector<SyncEngineEventListener*>(), NULL, NULL)); routes_.clear(); - routes_[syncer::BOOKMARKS] = GROUP_UI; - routes_[syncer::AUTOFILL] = GROUP_DB; + routes_[BOOKMARKS] = GROUP_UI; + routes_[AUTOFILL] = GROUP_DB; scoped_refptr<ModelSafeWorker> passive_worker( new FakeModelWorker(GROUP_PASSIVE)); scoped_refptr<ModelSafeWorker> ui_worker( @@ -118,13 +118,13 @@ class SyncSessionTest : public testing::Test, FAIL() << msg; } - syncer::ModelTypeSet ParamsMeaningAllEnabledTypes() { - syncer::ModelTypeSet request_params(syncer::BOOKMARKS, syncer::AUTOFILL); + ModelTypeSet ParamsMeaningAllEnabledTypes() { + ModelTypeSet request_params(BOOKMARKS, AUTOFILL); return request_params; } - syncer::ModelTypeSet ParamsMeaningJustOneEnabledType() { - return syncer::ModelTypeSet(syncer::AUTOFILL); + ModelTypeSet ParamsMeaningJustOneEnabledType() { + return ModelTypeSet(AUTOFILL); } MessageLoop message_loop_; @@ -266,12 +266,12 @@ TEST_F(SyncSessionTest, ResetTransientState) { TEST_F(SyncSessionTest, Coalesce) { std::vector<ModelSafeWorker*> workers_one, workers_two; ModelSafeRoutingInfo routes_one, routes_two; - syncer::ModelTypePayloadMap one_type = - syncer::ModelTypePayloadMapFromEnumSet( + ModelTypePayloadMap one_type = + ModelTypePayloadMapFromEnumSet( ParamsMeaningJustOneEnabledType(), std::string()); - syncer::ModelTypePayloadMap all_types = - syncer::ModelTypePayloadMapFromEnumSet( + ModelTypePayloadMap all_types = + ModelTypePayloadMapFromEnumSet( ParamsMeaningAllEnabledTypes(), std::string()); SyncSourceInfo source_one(sync_pb::GetUpdatesCallerInfo::PERIODIC, one_type); @@ -286,9 +286,9 @@ TEST_F(SyncSessionTest, Coalesce) { workers_two.push_back(passive_worker); workers_two.push_back(db_worker); workers_two.push_back(ui_worker); - routes_one[syncer::AUTOFILL] = GROUP_DB; - routes_two[syncer::AUTOFILL] = GROUP_DB; - routes_two[syncer::BOOKMARKS] = GROUP_UI; + routes_one[AUTOFILL] = GROUP_DB; + routes_two[AUTOFILL] = GROUP_DB; + routes_two[BOOKMARKS] = GROUP_UI; SyncSession one(context_.get(), this, source_one, routes_one, workers_one); SyncSession two(context_.get(), this, source_two, routes_two, workers_two); @@ -323,12 +323,12 @@ TEST_F(SyncSessionTest, Coalesce) { TEST_F(SyncSessionTest, RebaseRoutingInfoWithLatestRemoveOneType) { std::vector<ModelSafeWorker*> workers_one, workers_two; ModelSafeRoutingInfo routes_one, routes_two; - syncer::ModelTypePayloadMap one_type = - syncer::ModelTypePayloadMapFromEnumSet( + ModelTypePayloadMap one_type = + ModelTypePayloadMapFromEnumSet( ParamsMeaningJustOneEnabledType(), std::string()); - syncer::ModelTypePayloadMap all_types = - syncer::ModelTypePayloadMapFromEnumSet( + ModelTypePayloadMap all_types = + ModelTypePayloadMapFromEnumSet( ParamsMeaningAllEnabledTypes(), std::string()); SyncSourceInfo source_one(sync_pb::GetUpdatesCallerInfo::PERIODIC, one_type); @@ -343,9 +343,9 @@ TEST_F(SyncSessionTest, RebaseRoutingInfoWithLatestRemoveOneType) { workers_two.push_back(passive_worker); workers_two.push_back(db_worker); workers_two.push_back(ui_worker); - routes_one[syncer::AUTOFILL] = GROUP_DB; - routes_two[syncer::AUTOFILL] = GROUP_DB; - routes_two[syncer::BOOKMARKS] = GROUP_UI; + routes_one[AUTOFILL] = GROUP_DB; + routes_two[AUTOFILL] = GROUP_DB; + routes_two[BOOKMARKS] = GROUP_UI; SyncSession one(context_.get(), this, source_one, routes_one, workers_one); SyncSession two(context_.get(), this, source_two, routes_two, workers_two); @@ -384,7 +384,7 @@ TEST_F(SyncSessionTest, RebaseRoutingInfoWithLatestRemoveOneType) { // Make sure the model safe routing info is reduced to one type. ModelSafeRoutingInfo::const_iterator it = - two.routing_info().find(syncer::AUTOFILL); + two.routing_info().find(AUTOFILL); // Note that attempting to use EXPECT_NE would fail for an Android build due // to seeming incompatibility with gtest and stlport. EXPECT_TRUE(it != two.routing_info().end()); @@ -395,8 +395,8 @@ TEST_F(SyncSessionTest, RebaseRoutingInfoWithLatestRemoveOneType) { TEST_F(SyncSessionTest, RebaseRoutingInfoWithLatestWithSameType) { std::vector<ModelSafeWorker*> workers_first, workers_second; ModelSafeRoutingInfo routes_first, routes_second; - syncer::ModelTypePayloadMap all_types = - syncer::ModelTypePayloadMapFromEnumSet( + ModelTypePayloadMap all_types = + ModelTypePayloadMapFromEnumSet( ParamsMeaningAllEnabledTypes(), std::string()); SyncSourceInfo source_first(sync_pb::GetUpdatesCallerInfo::PERIODIC, @@ -414,10 +414,10 @@ TEST_F(SyncSessionTest, RebaseRoutingInfoWithLatestWithSameType) { workers_second.push_back(passive_worker); workers_second.push_back(db_worker); workers_second.push_back(ui_worker); - routes_first[syncer::AUTOFILL] = GROUP_DB; - routes_first[syncer::BOOKMARKS] = GROUP_UI; - routes_second[syncer::AUTOFILL] = GROUP_DB; - routes_second[syncer::BOOKMARKS] = GROUP_UI; + routes_first[AUTOFILL] = GROUP_DB; + routes_first[BOOKMARKS] = GROUP_UI; + routes_second[AUTOFILL] = GROUP_DB; + routes_second[BOOKMARKS] = GROUP_UI; SyncSession first(context_.get(), this, source_first, routes_first, workers_first); SyncSession second(context_.get(), this, source_second, routes_second, @@ -458,9 +458,9 @@ TEST_F(SyncSessionTest, RebaseRoutingInfoWithLatestWithSameType) { // Make sure the model safe routing info is reduced to first type. ModelSafeRoutingInfo::const_iterator it1 = - second.routing_info().find(syncer::AUTOFILL); + second.routing_info().find(AUTOFILL); ModelSafeRoutingInfo::const_iterator it2 = - second.routing_info().find(syncer::BOOKMARKS); + second.routing_info().find(BOOKMARKS); // Note that attempting to use EXPECT_NE would fail for an Android build due // to seeming incompatibility with gtest and stlport. @@ -476,23 +476,22 @@ TEST_F(SyncSessionTest, RebaseRoutingInfoWithLatestWithSameType) { TEST_F(SyncSessionTest, MakeTypePayloadMapFromBitSet) { - syncer::ModelTypeSet types; + ModelTypeSet types; std::string payload = "test"; - syncer::ModelTypePayloadMap types_with_payloads = - syncer::ModelTypePayloadMapFromEnumSet(types, payload); + ModelTypePayloadMap types_with_payloads = + ModelTypePayloadMapFromEnumSet(types, payload); EXPECT_TRUE(types_with_payloads.empty()); - types.Put(syncer::BOOKMARKS); - types.Put(syncer::PASSWORDS); - types.Put(syncer::AUTOFILL); + types.Put(BOOKMARKS); + types.Put(PASSWORDS); + types.Put(AUTOFILL); payload = "test2"; - types_with_payloads = - syncer::ModelTypePayloadMapFromEnumSet(types, payload); + types_with_payloads = ModelTypePayloadMapFromEnumSet(types, payload); ASSERT_EQ(3U, types_with_payloads.size()); - EXPECT_EQ(types_with_payloads[syncer::BOOKMARKS], payload); - EXPECT_EQ(types_with_payloads[syncer::PASSWORDS], payload); - EXPECT_EQ(types_with_payloads[syncer::AUTOFILL], payload); + EXPECT_EQ(types_with_payloads[BOOKMARKS], payload); + EXPECT_EQ(types_with_payloads[PASSWORDS], payload); + EXPECT_EQ(types_with_payloads[AUTOFILL], payload); } } // namespace diff --git a/sync/syncable/directory.cc b/sync/syncable/directory.cc index a63538c..d30c0d5 100644 --- a/sync/syncable/directory.cc +++ b/sync/syncable/directory.cc @@ -108,8 +108,7 @@ const FilePath::CharType Directory::kSyncDatabaseFilename[] = void Directory::InitKernelForTest( const std::string& name, DirectoryChangeDelegate* delegate, - const syncer::WeakHandle<TransactionObserver>& - transaction_observer) { + const WeakHandle<TransactionObserver>& transaction_observer) { DCHECK(!kernel_); kernel_ = new Kernel(name, KernelLoadInfo(), delegate, transaction_observer); } @@ -140,8 +139,7 @@ Directory::SaveChangesSnapshot::~SaveChangesSnapshot() {} Directory::Kernel::Kernel( const std::string& name, const KernelLoadInfo& info, DirectoryChangeDelegate* delegate, - const syncer::WeakHandle<TransactionObserver>& - transaction_observer) + const WeakHandle<TransactionObserver>& transaction_observer) : next_write_transaction_id(0), name(name), metahandles_index(new Directory::MetahandlesIndex), @@ -194,8 +192,7 @@ Directory::~Directory() { DirOpenResult Directory::Open( const string& name, DirectoryChangeDelegate* delegate, - const syncer::WeakHandle<TransactionObserver>& - transaction_observer) { + const WeakHandle<TransactionObserver>& transaction_observer) { TRACE_EVENT0("sync", "SyncDatabaseOpen"); const DirOpenResult result = @@ -228,7 +225,7 @@ void Directory::InitializeIndices() { DirOpenResult Directory::OpenImpl( const string& name, DirectoryChangeDelegate* delegate, - const syncer::WeakHandle<TransactionObserver>& + const WeakHandle<TransactionObserver>& transaction_observer) { KernelLoadInfo info; @@ -623,7 +620,7 @@ bool Directory::PurgeEntriesWithTypeIn(ModelTypeSet types) { } // Ensure meta tracking for these data types reflects the deleted state. - for (syncer::ModelTypeSet::Iterator it = types.First(); + for (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()); @@ -757,8 +754,7 @@ string Directory::cache_guid() const { return kernel_->cache_guid; } -syncer::Cryptographer* Directory::GetCryptographer( - const BaseTransaction* trans) { +Cryptographer* Directory::GetCryptographer(const BaseTransaction* trans) { DCHECK_EQ(this, trans->directory()); return &cryptographer_; } @@ -799,7 +795,7 @@ int64 Directory::unsynced_entity_count() const { FullModelTypeSet Directory::GetServerTypesWithUnappliedUpdates( BaseTransaction* trans) const { - syncer::FullModelTypeSet server_types; + FullModelTypeSet server_types; ScopedKernelLock lock(this); for (int i = UNSPECIFIED; i < MODEL_TYPE_COUNT; ++i) { const ModelType type = ModelTypeFromInt(i); diff --git a/sync/syncable/directory.h b/sync/syncable/directory.h index 2385f03..5cf6d55 100644 --- a/sync/syncable/directory.h +++ b/sync/syncable/directory.h @@ -207,9 +207,9 @@ class Directory { // |report_unrecoverable_error_function| may be NULL. // Takes ownership of |store|. Directory( - syncer::Encryptor* encryptor, - syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, - syncer::ReportUnrecoverableErrorFunction + Encryptor* encryptor, + UnrecoverableErrorHandler* unrecoverable_error_handler, + ReportUnrecoverableErrorFunction report_unrecoverable_error_function, DirectoryBackingStore* store); virtual ~Directory(); @@ -220,7 +220,7 @@ class Directory { // thread. |transaction_observer| must be initialized. DirOpenResult Open(const std::string& name, DirectoryChangeDelegate* delegate, - const syncer::WeakHandle<TransactionObserver>& + const WeakHandle<TransactionObserver>& transaction_observer); // Stops sending events to the delegate and the transaction @@ -268,7 +268,7 @@ class Directory { // Returns a pointer to our cryptographer. Does not transfer ownership. The // cryptographer is not thread safe; it should not be accessed after the // transaction has been released. - syncer::Cryptographer* GetCryptographer(const BaseTransaction* trans); + Cryptographer* GetCryptographer(const BaseTransaction* trans); // Returns true if the directory had encountered an unrecoverable error. // Note: Any function in |Directory| that can be called without holding a @@ -314,8 +314,7 @@ class Directory { DirOpenResult OpenImpl( const std::string& name, DirectoryChangeDelegate* delegate, - const syncer::WeakHandle<TransactionObserver>& - transaction_observer); + const WeakHandle<TransactionObserver>& transaction_observer); private: // These private versions expect the kernel lock to already be held @@ -485,8 +484,7 @@ class Directory { void InitKernelForTest( const std::string& name, DirectoryChangeDelegate* delegate, - const syncer::WeakHandle<TransactionObserver>& - transaction_observer); + const WeakHandle<TransactionObserver>& transaction_observer); private: struct Kernel { @@ -494,8 +492,7 @@ class Directory { // initialized. Kernel(const std::string& name, const KernelLoadInfo& info, DirectoryChangeDelegate* delegate, - const syncer::WeakHandle<TransactionObserver>& - transaction_observer); + const WeakHandle<TransactionObserver>& transaction_observer); ~Kernel(); @@ -562,7 +559,7 @@ class Directory { DirectoryChangeDelegate* const delegate; // The transaction observer. - const syncer::WeakHandle<TransactionObserver> transaction_observer; + const WeakHandle<TransactionObserver> transaction_observer; }; // Helper method used to do searches on |parent_id_child_index|. @@ -595,15 +592,14 @@ class Directory { EntryKernel* GetPossibleFirstChild( const ScopedKernelLock& lock, const Id& parent_id); - syncer::Cryptographer cryptographer_; + Cryptographer cryptographer_; Kernel* kernel_; scoped_ptr<DirectoryBackingStore> store_; - syncer::UnrecoverableErrorHandler* const unrecoverable_error_handler_; - const syncer::ReportUnrecoverableErrorFunction - report_unrecoverable_error_function_; + UnrecoverableErrorHandler* const unrecoverable_error_handler_; + const ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; bool unrecoverable_error_set_; InvariantCheckLevel invariant_check_level_; diff --git a/sync/syncable/directory_backing_store.cc b/sync/syncable/directory_backing_store.cc index 293a444..f1bfe8c 100644 --- a/sync/syncable/directory_backing_store.cc +++ b/sync/syncable/directory_backing_store.cc @@ -51,7 +51,7 @@ void BindFields(const EntryKernel& entry, } for ( ; i < TIME_FIELDS_END; ++i) { statement->BindInt64(index++, - syncer::TimeToProtoTime( + TimeToProtoTime( entry.ref(static_cast<TimeField>(i)))); } for ( ; i < ID_FIELDS_END; ++i) { @@ -81,7 +81,7 @@ EntryKernel* UnpackEntry(sql::Statement* statement) { } for ( ; i < TIME_FIELDS_END; ++i) { kernel->put(static_cast<TimeField>(i), - syncer::ProtoTimeToTime(statement->ColumnInt64(i))); + ProtoTimeToTime(statement->ColumnInt64(i))); } for ( ; i < ID_FIELDS_END; ++i) { kernel->mutable_ref(static_cast<IdField>(i)).s_ = @@ -544,14 +544,14 @@ ModelType DirectoryBackingStore::ModelIdToModelTypeEnum( const void* data, int size) { sync_pb::EntitySpecifics specifics; if (!specifics.ParseFromArray(data, size)) - return syncer::UNSPECIFIED; - return syncer::GetModelTypeFromSpecifics(specifics); + return UNSPECIFIED; + return GetModelTypeFromSpecifics(specifics); } // static string DirectoryBackingStore::ModelTypeEnumToModelId(ModelType model_type) { sync_pb::EntitySpecifics specifics; - syncer::AddDefaultFieldValue(model_type, &specifics); + AddDefaultFieldValue(model_type, &specifics); return specifics.SerializeAsString(); } @@ -997,7 +997,7 @@ bool DirectoryBackingStore::CreateTables() { { // Insert the entry for the root into the metas table. - const int64 now = syncer::TimeToProtoTime(base::Time::Now()); + const int64 now = TimeToProtoTime(base::Time::Now()); sql::Statement s(db_->GetUniqueStatement( "INSERT INTO metas " "( id, metahandle, is_dir, ctime, mtime) " diff --git a/sync/syncable/directory_backing_store.h b/sync/syncable/directory_backing_store.h index 034f405..75fdad1 100644 --- a/sync/syncable/directory_backing_store.h +++ b/sync/syncable/directory_backing_store.h @@ -112,7 +112,7 @@ class DirectoryBackingStore : public base::NonThreadSafe { // Drop all tables in preparation for reinitialization. void DropAllTables(); - // Serialization helpers for syncer::ModelType. These convert between + // Serialization helpers for ModelType. These convert between // the ModelType enum and the values we persist in the database to identify // a model. We persist a default instance of the specifics protobuf as the // ID, rather than the enum value. diff --git a/sync/syncable/directory_backing_store_unittest.cc b/sync/syncable/directory_backing_store_unittest.cc index 1728da0..25aca63 100644 --- a/sync/syncable/directory_backing_store_unittest.cc +++ b/sync/syncable/directory_backing_store_unittest.cc @@ -287,8 +287,7 @@ std::map<int64, base::Time> GetExpectedMetaTimes() { for (std::map<int64, int64>::const_iterator it = expected_meta_proto_times.begin(); it != expected_meta_proto_times.end(); ++it) { - expected_meta_times[it->first] = - syncer::ProtoTimeToTime(it->second); + expected_meta_times[it->first] = ProtoTimeToTime(it->second); } return expected_meta_times; } @@ -328,8 +327,8 @@ std::map<int64, int64> GetMetaProtoTimes(sql::Connection *db) { << t1_expr << " and " << t2_expr << " (internal values: " << t1.ToInternalValue() << " and " << t2.ToInternalValue() - << ") (proto time: " << syncer::TimeToProtoTime(t1) - << " and " << syncer::TimeToProtoTime(t2) + << ") (proto time: " << TimeToProtoTime(t1) + << " and " << TimeToProtoTime(t2) << ") do not match"; } @@ -1952,25 +1951,25 @@ TEST_P(MigrationTest, ToCurrentVersion) { // Check download_progress state (v75 migration) ASSERT_EQ(694, - dir_info.kernel_info.download_progress[syncer::BOOKMARKS] + dir_info.kernel_info.download_progress[BOOKMARKS] .timestamp_token_for_migration()); ASSERT_FALSE( - dir_info.kernel_info.download_progress[syncer::BOOKMARKS] + dir_info.kernel_info.download_progress[BOOKMARKS] .has_token()); ASSERT_EQ(32904, - dir_info.kernel_info.download_progress[syncer::BOOKMARKS] + dir_info.kernel_info.download_progress[BOOKMARKS] .data_type_id()); ASSERT_FALSE( - dir_info.kernel_info.download_progress[syncer::THEMES] + dir_info.kernel_info.download_progress[THEMES] .has_timestamp_token_for_migration()); ASSERT_TRUE( - dir_info.kernel_info.download_progress[syncer::THEMES] + dir_info.kernel_info.download_progress[THEMES] .has_token()); ASSERT_TRUE( - dir_info.kernel_info.download_progress[syncer::THEMES] + dir_info.kernel_info.download_progress[THEMES] .token().empty()); ASSERT_EQ(41210, - dir_info.kernel_info.download_progress[syncer::THEMES] + dir_info.kernel_info.download_progress[THEMES] .data_type_id()); // Check metas diff --git a/sync/syncable/entry.cc b/sync/syncable/entry.cc index 948a0fc..ba64299 100644 --- a/sync/syncable/entry.cc +++ b/sync/syncable/entry.cc @@ -64,7 +64,7 @@ const string& Entry::Get(StringField field) const { return kernel_->ref(field); } -syncer::ModelType Entry::GetServerModelType() const { +ModelType Entry::GetServerModelType() const { ModelType specifics_type = kernel_->GetServerModelType(); if (specifics_type != UNSPECIFIED) return specifics_type; @@ -81,7 +81,7 @@ syncer::ModelType Entry::GetServerModelType() const { return UNSPECIFIED; } -syncer::ModelType Entry::GetModelType() const { +ModelType Entry::GetModelType() const { ModelType specifics_type = GetModelTypeFromSpecifics(Get(SPECIFICS)); if (specifics_type != UNSPECIFIED) return specifics_type; @@ -111,8 +111,7 @@ std::ostream& operator<<(std::ostream& os, const Entry& entry) { } for ( ; i < TIME_FIELDS_END; ++i) { os << g_metas_columns[i].name << ": " - << syncer::GetTimeDebugString( - kernel->ref(static_cast<TimeField>(i))) << ", "; + << GetTimeDebugString(kernel->ref(static_cast<TimeField>(i))) << ", "; } for ( ; i < ID_FIELDS_END; ++i) { os << g_metas_columns[i].name << ": " diff --git a/sync/syncable/entry_kernel.cc b/sync/syncable/entry_kernel.cc index 9308bcf..550fbb2 100644 --- a/sync/syncable/entry_kernel.cc +++ b/sync/syncable/entry_kernel.cc @@ -20,7 +20,7 @@ EntryKernel::EntryKernel() : dirty_(false) { EntryKernel::~EntryKernel() {} -syncer::ModelType EntryKernel::GetServerModelType() const { +ModelType EntryKernel::GetServerModelType() const { ModelType specifics_type = GetModelTypeFromSpecifics(ref(SERVER_SPECIFICS)); if (specifics_type != UNSPECIFIED) return specifics_type; @@ -62,7 +62,7 @@ StringValue* Int64ToValue(int64 i) { } StringValue* TimeToValue(const base::Time& t) { - return Value::CreateStringValue(syncer::GetTimeDebugString(t)); + return Value::CreateStringValue(GetTimeDebugString(t)); } StringValue* IdToValue(const Id& id) { @@ -120,7 +120,7 @@ DictionaryValue* EntryKernel::ToValue() const { // Proto fields. SetFieldValues(*this, kernel_info, - &GetProtoFieldString, &syncer::EntitySpecificsToValue, + &GetProtoFieldString, &EntitySpecificsToValue, PROTO_FIELDS_BEGIN, PROTO_FIELDS_END - 1); // Bit temps. diff --git a/sync/syncable/entry_kernel.h b/sync/syncable/entry_kernel.h index 1954da4..383ffd7 100644 --- a/sync/syncable/entry_kernel.h +++ b/sync/syncable/entry_kernel.h @@ -216,8 +216,7 @@ struct EntryKernel { // Round-trip to proto time format and back so that we have // consistent time resolutions (ms). time_fields[field - TIME_FIELDS_BEGIN] = - syncer::ProtoTimeToTime( - syncer::TimeToProtoTime(value)); + ProtoTimeToTime(TimeToProtoTime(value)); } inline void put(IdField field, const Id& value) { id_fields[field - ID_FIELDS_BEGIN] = value; @@ -290,7 +289,7 @@ struct EntryKernel { return id_fields[field - ID_FIELDS_BEGIN]; } - syncer::ModelType GetServerModelType() const; + ModelType GetServerModelType() const; // Dumps all kernel info into a DictionaryValue and returns it. // Transfers ownership of the DictionaryValue to the caller. @@ -307,8 +306,7 @@ struct EntryKernelMutation { typedef std::map<int64, EntryKernelMutation> EntryKernelMutationMap; -typedef syncer::Immutable<EntryKernelMutationMap> - ImmutableEntryKernelMutationMap; +typedef Immutable<EntryKernelMutationMap> ImmutableEntryKernelMutationMap; // Caller owns the return value. base::DictionaryValue* EntryKernelMutationToValue( diff --git a/sync/syncable/model_type_unittest.cc b/sync/syncable/model_type_unittest.cc index c40f899..559f0b2 100644 --- a/sync/syncable/model_type_unittest.cc +++ b/sync/syncable/model_type_unittest.cc @@ -17,8 +17,7 @@ namespace { class ModelTypeTest : public testing::Test {}; TEST_F(ModelTypeTest, ModelTypeToValue) { - for (int i = syncer::FIRST_REAL_MODEL_TYPE; - i < syncer::MODEL_TYPE_COUNT; ++i) { + for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { ModelType model_type = ModelTypeFromInt(i); base::ExpectStringValue(ModelTypeToString(model_type), ModelTypeToValue(model_type)); @@ -30,8 +29,7 @@ TEST_F(ModelTypeTest, ModelTypeToValue) { } TEST_F(ModelTypeTest, ModelTypeFromValue) { - for (int i = syncer::FIRST_REAL_MODEL_TYPE; - i < syncer::MODEL_TYPE_COUNT; ++i) { + for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { ModelType model_type = ModelTypeFromInt(i); scoped_ptr<StringValue> value(ModelTypeToValue(model_type)); EXPECT_EQ(model_type, ModelTypeFromValue(*value)); @@ -39,7 +37,7 @@ TEST_F(ModelTypeTest, ModelTypeFromValue) { } TEST_F(ModelTypeTest, ModelTypeSetToValue) { - const ModelTypeSet model_types(syncer::BOOKMARKS, syncer::APPS); + const ModelTypeSet model_types(BOOKMARKS, APPS); scoped_ptr<ListValue> value(ModelTypeSetToValue(model_types)); EXPECT_EQ(2u, value->GetSize()); diff --git a/sync/syncable/mutable_entry.cc b/sync/syncable/mutable_entry.cc index c61bcb3..869320f 100644 --- a/sync/syncable/mutable_entry.cc +++ b/sync/syncable/mutable_entry.cc @@ -232,8 +232,7 @@ bool MutableEntry::Put(ProtoField field, if (update_unapplied_updates_index) { // Remove ourselves from unapplied_update_metahandles with our // old server type. - const syncer::ModelType old_server_type = - kernel_->GetServerModelType(); + const ModelType old_server_type = kernel_->GetServerModelType(); const int64 metahandle = kernel_->ref(META_HANDLE); size_t erase_count = dir()->kernel_->unapplied_update_metahandles[old_server_type] @@ -247,8 +246,7 @@ bool MutableEntry::Put(ProtoField field, if (update_unapplied_updates_index) { // Add ourselves back into unapplied_update_metahandles with our // new server type. - const syncer::ModelType new_server_type = - kernel_->GetServerModelType(); + const ModelType new_server_type = kernel_->GetServerModelType(); const int64 metahandle = kernel_->ref(META_HANDLE); dir()->kernel_->unapplied_update_metahandles[new_server_type] .insert(metahandle); diff --git a/sync/syncable/nigori_util.cc b/sync/syncable/nigori_util.cc index 00ddf95..32a5fcf 100644 --- a/sync/syncable/nigori_util.cc +++ b/sync/syncable/nigori_util.cc @@ -21,7 +21,7 @@ namespace syncable { bool ProcessUnsyncedChangesForEncryption( WriteTransaction* const trans, - syncer::Cryptographer* cryptographer) { + Cryptographer* cryptographer) { DCHECK(cryptographer->is_ready()); // Get list of all datatypes with unsynced changes. It's possible that our // local changes need to be encrypted if encryption for that datatype was @@ -69,7 +69,7 @@ bool EntryNeedsEncryption(ModelTypeSet encrypted_types, const Entry& entry) { if (!entry.Get(UNIQUE_SERVER_TAG).empty()) return false; // We don't encrypt unique server nodes. - syncer::ModelType type = entry.GetModelType(); + ModelType type = entry.GetModelType(); if (type == PASSWORDS || type == NIGORI) return false; // Checking NON_UNIQUE_NAME is not necessary for the correctness of encrypting @@ -93,7 +93,7 @@ bool SpecificsNeedsEncryption(ModelTypeSet encrypted_types, // Mainly for testing. bool VerifyDataTypeEncryptionForTest( BaseTransaction* const trans, - syncer::Cryptographer* cryptographer, + Cryptographer* cryptographer, ModelType type, bool is_encrypted) { if (type == PASSWORDS || type == NIGORI) { @@ -157,14 +157,13 @@ bool VerifyDataTypeEncryptionForTest( } bool UpdateEntryWithEncryption( - syncer::Cryptographer* cryptographer, + Cryptographer* cryptographer, const sync_pb::EntitySpecifics& new_specifics, syncable::MutableEntry* entry) { - syncer::ModelType type = syncer::GetModelTypeFromSpecifics(new_specifics); - DCHECK_GE(type, syncer::FIRST_REAL_MODEL_TYPE); + ModelType type = GetModelTypeFromSpecifics(new_specifics); + DCHECK_GE(type, FIRST_REAL_MODEL_TYPE); const sync_pb::EntitySpecifics& old_specifics = entry->Get(SPECIFICS); - const syncer::ModelTypeSet encrypted_types = - cryptographer->GetEncryptedTypes(); + const ModelTypeSet encrypted_types = cryptographer->GetEncryptedTypes(); // It's possible the nigori lost the set of encrypted types. If the current // specifics are already encrypted, we want to ensure we continue encrypting. bool was_encrypted = old_specifics.has_encrypted(); @@ -187,7 +186,7 @@ bool UpdateEntryWithEncryption( base::JSONWriter::OPTIONS_PRETTY_PRINT, &info); DVLOG(2) << "Encrypting specifics of type " - << syncer::ModelTypeToString(type) + << ModelTypeToString(type) << " with content: " << info; } @@ -195,18 +194,18 @@ bool UpdateEntryWithEncryption( // encrypted. The first time we encrypt a node we start from scratch, hence // removing all the unencrypted data, but from then on we only want to // update the node if the data changes or the encryption key changes. - if (syncer::GetModelTypeFromSpecifics(old_specifics) == type && + if (GetModelTypeFromSpecifics(old_specifics) == type && was_encrypted) { generated_specifics.CopyFrom(old_specifics); } else { - syncer::AddDefaultFieldValue(type, &generated_specifics); + AddDefaultFieldValue(type, &generated_specifics); } // Does not change anything if underlying encrypted blob was already up // to date and encrypted with the default key. if (!cryptographer->Encrypt(new_specifics, generated_specifics.mutable_encrypted())) { NOTREACHED() << "Could not encrypt data for node of type " - << syncer::ModelTypeToString(type); + << ModelTypeToString(type); return false; } } @@ -221,7 +220,7 @@ bool UpdateEntryWithEncryption( if (!encrypted_without_overwriting_name && old_specifics.SerializeAsString() == generated_specifics.SerializeAsString()) { - DVLOG(2) << "Specifics of type " << syncer::ModelTypeToString(type) + DVLOG(2) << "Specifics of type " << ModelTypeToString(type) << " already match, dropping change."; return true; } @@ -231,7 +230,7 @@ bool UpdateEntryWithEncryption( entry->Put(syncable::NON_UNIQUE_NAME, kEncryptedString); // For bookmarks we actually put bogus data into the unencrypted specifics, // else the server will try to do it for us. - if (type == syncer::BOOKMARKS) { + if (type == BOOKMARKS) { sync_pb::BookmarkSpecifics* bookmark_specifics = generated_specifics.mutable_bookmark(); if (!entry->Get(syncable::IS_DIR)) @@ -241,7 +240,7 @@ bool UpdateEntryWithEncryption( } entry->Put(syncable::SPECIFICS, generated_specifics); DVLOG(1) << "Overwriting specifics of type " - << syncer::ModelTypeToString(type) + << ModelTypeToString(type) << " and marking for syncing."; syncable::MarkForSyncing(entry); return true; diff --git a/sync/syncable/nigori_util.h b/sync/syncable/nigori_util.h index 037c89e..2edc9cd 100644 --- a/sync/syncable/nigori_util.h +++ b/sync/syncable/nigori_util.h @@ -41,7 +41,7 @@ bool VerifyUnsyncedChangesAreEncrypted( // or unencrypted, based on |encrypted_types|. bool ProcessUnsyncedChangesForEncryption( WriteTransaction* const trans, - syncer::Cryptographer* cryptographer); + Cryptographer* cryptographer); // Returns true if the entry requires encryption but is not encrypted, false // otherwise. Note: this does not check that already encrypted entries are @@ -56,7 +56,7 @@ bool SpecificsNeedsEncryption(ModelTypeSet encrypted_types, // Verifies all data of type |type| is encrypted appropriately. bool VerifyDataTypeEncryptionForTest( BaseTransaction* const trans, - syncer::Cryptographer* cryptographer, + Cryptographer* cryptographer, ModelType type, bool is_encrypted) WARN_UNUSED_RESULT; @@ -64,7 +64,7 @@ bool VerifyDataTypeEncryptionForTest( // Returns false if an error encrypting occurred (does not modify |entry|). // Note: gracefully handles new_specifics aliasing with entry->Get(SPECIFICS). bool UpdateEntryWithEncryption( - syncer::Cryptographer* cryptographer, + Cryptographer* cryptographer, const sync_pb::EntitySpecifics& new_specifics, MutableEntry* entry); diff --git a/sync/syncable/syncable_id_unittest.cc b/sync/syncable/syncable_id_unittest.cc index 9ecdbdc..e0b0143 100644 --- a/sync/syncable/syncable_id_unittest.cc +++ b/sync/syncable/syncable_id_unittest.cc @@ -12,12 +12,10 @@ #include "sync/test/engine/test_id_factory.h" #include "testing/gtest/include/gtest/gtest.h" -using std::vector; - namespace syncer { namespace syncable { -using syncer::TestIdFactory; +using std::vector; class SyncableIdTest : public testing::Test { }; diff --git a/sync/syncable/syncable_mock.cc b/sync/syncable/syncable_mock.cc index 9a57e15..8000504 100644 --- a/sync/syncable/syncable_mock.cc +++ b/sync/syncable/syncable_mock.cc @@ -12,7 +12,7 @@ namespace syncer { namespace syncable { -MockDirectory::MockDirectory(syncer::UnrecoverableErrorHandler* handler) +MockDirectory::MockDirectory(UnrecoverableErrorHandler* handler) : Directory(&encryptor_, handler, NULL, new syncable::InMemoryDirectoryBackingStore("store")) { InitKernelForTest("myk", &delegate_, syncable::NullTransactionObserver()); diff --git a/sync/syncable/syncable_mock.h b/sync/syncable/syncable_mock.h index 7b5327f..83f5b95 100644 --- a/sync/syncable/syncable_mock.h +++ b/sync/syncable/syncable_mock.h @@ -19,20 +19,20 @@ namespace syncable { class MockDirectory : public Directory { public: - explicit MockDirectory(syncer::UnrecoverableErrorHandler* handler); + explicit MockDirectory(UnrecoverableErrorHandler* handler); virtual ~MockDirectory(); MOCK_METHOD1(GetEntryByHandle, syncable::EntryKernel*(int64)); - MOCK_METHOD2(set_last_downloadstamp, void(syncer::ModelType, int64)); + MOCK_METHOD2(set_last_downloadstamp, void(ModelType, int64)); MOCK_METHOD1(GetEntryByClientTag, syncable::EntryKernel*(const std::string&)); - MOCK_METHOD1(PurgeEntriesWithTypeIn, bool(syncer::ModelTypeSet)); + MOCK_METHOD1(PurgeEntriesWithTypeIn, bool(ModelTypeSet)); private: - syncer::FakeEncryptor encryptor_; + FakeEncryptor encryptor_; syncable::NullDirectoryChangeDelegate delegate_; }; diff --git a/sync/syncable/syncable_unittest.cc b/sync/syncable/syncable_unittest.cc index 2518ff5b..cf34a94 100644 --- a/sync/syncable/syncable_unittest.cc +++ b/sync/syncable/syncable_unittest.cc @@ -36,15 +36,12 @@ #include "sync/util/test_unrecoverable_error_handler.h" #include "testing/gtest/include/gtest/gtest.h" -using base::ExpectDictBooleanValue; -using base::ExpectDictStringValue; -using syncer::FakeEncryptor; -using syncer::TestIdFactory; -using syncer::TestUnrecoverableErrorHandler; - namespace syncer { namespace syncable { +using base::ExpectDictBooleanValue; +using base::ExpectDictStringValue; + class SyncableKernelTest : public testing::Test {}; // TODO(akalin): Add unit tests for EntryKernel::ContainsString(). @@ -548,7 +545,7 @@ TEST_F(SyncableDirectoryTest, TakeSnapshotGetsMetahandlesToPurge) { } } - syncer::ModelTypeSet to_purge(BOOKMARKS); + ModelTypeSet to_purge(BOOKMARKS); dir_->PurgeEntriesWithTypeIn(to_purge); Directory::SaveChangesSnapshot snapshot1; @@ -829,7 +826,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { std::vector<int64> handles; int64 handle1, handle2; - const syncer::FullModelTypeSet all_types = syncer::FullModelTypeSet::All(); + const FullModelTypeSet all_types = FullModelTypeSet::All(); { WriteTransaction trans(FROM_HERE, UNITTEST, dir_.get()); @@ -1403,7 +1400,7 @@ TEST_F(OnDiskSyncableDirectoryTest, TestPurgeEntriesWithTypeIn) { dir_->set_initial_sync_ended_for_type(PREFERENCES, true); dir_->set_initial_sync_ended_for_type(AUTOFILL, true); - syncer::ModelTypeSet types_to_purge(PREFERENCES, AUTOFILL); + ModelTypeSet types_to_purge(PREFERENCES, AUTOFILL); TestIdFactory id_factory; // Create some items for each type. @@ -1695,7 +1692,7 @@ TEST_F(OnDiskSyncableDirectoryTest, TestSaveChangesFailureWithPurge) { SwapInUnsaveableDirectory(); ASSERT_TRUE(dir_->good()); - syncer::ModelTypeSet set(BOOKMARKS); + ModelTypeSet set(BOOKMARKS); dir_->PurgeEntriesWithTypeIn(set); EXPECT_TRUE(IsInMetahandlesToPurge(handle1)); ASSERT_FALSE(dir_->SaveChanges()); diff --git a/sync/syncable/write_transaction_info.h b/sync/syncable/write_transaction_info.h index baaaceb..2bbe739 100644 --- a/sync/syncable/write_transaction_info.h +++ b/sync/syncable/write_transaction_info.h @@ -32,7 +32,7 @@ struct WriteTransactionInfo { }; typedef - syncer::Immutable<WriteTransactionInfo> + Immutable<WriteTransactionInfo> ImmutableWriteTransactionInfo; } // namespace syncable diff --git a/sync/test/engine/mock_connection_manager.cc b/sync/test/engine/mock_connection_manager.cc index 58bd0d1..5b5174d 100644 --- a/sync/test/engine/mock_connection_manager.cc +++ b/sync/test/engine/mock_connection_manager.cc @@ -76,7 +76,7 @@ void MockConnectionManager::SetMidCommitObserver( bool MockConnectionManager::PostBufferToPath(PostBufferParams* params, const string& path, const string& auth_token, - syncer::ScopedServerStatusWatcher* watcher) { + ScopedServerStatusWatcher* watcher) { ClientToServerMessage post; CHECK(post.ParseFromString(params->buffer_in)); CHECK(post.has_protocol_version()); @@ -245,8 +245,7 @@ sync_pb::SyncEntity* MockConnectionManager::SetNigori( sync_pb::SyncEntity* ent = GetUpdateResponse()->add_entries(); ent->set_id_string(TestIdFactory::FromNumber(id).GetServerId()); ent->set_parent_id_string(TestIdFactory::FromNumber(0).GetServerId()); - ent->set_server_defined_unique_tag(syncer::ModelTypeToRootTag( - syncer::NIGORI)); + ent->set_server_defined_unique_tag(ModelTypeToRootTag(NIGORI)); ent->set_name("Nigori"); ent->set_non_unique_name("Nigori"); ent->set_version(version); @@ -402,7 +401,7 @@ void MockConnectionManager::ProcessGetUpdates( // Verify that the GetUpdates filter sent by the Syncer matches the test // expectation. for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { - ModelType model_type = syncer::ModelTypeFromInt(i); + ModelType model_type = ModelTypeFromInt(i); sync_pb::DataTypeProgressMarker const* progress_marker = GetProgressMarkerForType(gu.from_progress_marker(), model_type); EXPECT_EQ(expected_filter_.Has(model_type), (progress_marker != NULL)) @@ -426,7 +425,7 @@ void MockConnectionManager::ProcessGetUpdates( sync_pb::GetUpdatesResponse* updates = &update_queue_.front(); for (int i = 0; i < updates->entries_size(); ++i) { if (!updates->entries(i).deleted()) { - ModelType entry_type = syncer::GetModelType(updates->entries(i)); + ModelType entry_type = GetModelType(updates->entries(i)); EXPECT_TRUE( IsModelTypePresentInSpecifics(gu.from_progress_marker(), entry_type)) << "Syncer did not request updates being provided by the test."; @@ -555,8 +554,8 @@ const CommitResponse& MockConnectionManager::last_commit_response() const { bool MockConnectionManager::IsModelTypePresentInSpecifics( const google::protobuf::RepeatedPtrField< sync_pb::DataTypeProgressMarker>& filter, - syncer::ModelType value) { - int data_type_id = syncer::GetSpecificsFieldNumberFromModelType(value); + ModelType value) { + int data_type_id = GetSpecificsFieldNumberFromModelType(value); for (int i = 0; i < filter.size(); ++i) { if (filter.Get(i).data_type_id() == data_type_id) { return true; @@ -569,8 +568,8 @@ sync_pb::DataTypeProgressMarker const* MockConnectionManager::GetProgressMarkerForType( const google::protobuf::RepeatedPtrField< sync_pb::DataTypeProgressMarker>& filter, - syncer::ModelType value) { - int data_type_id = syncer::GetSpecificsFieldNumberFromModelType(value); + ModelType value) { + int data_type_id = GetSpecificsFieldNumberFromModelType(value); for (int i = 0; i < filter.size(); ++i) { if (filter.Get(i).data_type_id() == data_type_id) { return &(filter.Get(i)); diff --git a/sync/test/engine/mock_connection_manager.h b/sync/test/engine/mock_connection_manager.h index f58cf22..eb98471 100644 --- a/sync/test/engine/mock_connection_manager.h +++ b/sync/test/engine/mock_connection_manager.h @@ -22,7 +22,7 @@ namespace syncer { -class MockConnectionManager : public syncer::ServerConnectionManager { +class MockConnectionManager : public ServerConnectionManager { public: class MidCommitObserver { public: @@ -40,7 +40,7 @@ class MockConnectionManager : public syncer::ServerConnectionManager { PostBufferParams*, const std::string& path, const std::string& auth_token, - syncer::ScopedServerStatusWatcher* watcher) OVERRIDE; + ScopedServerStatusWatcher* watcher) OVERRIDE; // Control of commit response. // NOTE: Commit callback is invoked only once then reset. @@ -182,13 +182,11 @@ class MockConnectionManager : public syncer::ServerConnectionManager { // Expect that GetUpdates will request exactly the types indicated in // the bitset. - void ExpectGetUpdatesRequestTypes( - syncer::ModelTypeSet expected_filter) { + void ExpectGetUpdatesRequestTypes(ModelTypeSet expected_filter) { expected_filter_ = expected_filter; } - void ExpectGetUpdatesRequestPayloads( - const syncer::ModelTypePayloadMap& payloads) { + void ExpectGetUpdatesRequestPayloads(const ModelTypePayloadMap& payloads) { expected_payloads_ = payloads; } @@ -259,12 +257,12 @@ class MockConnectionManager : public syncer::ServerConnectionManager { bool IsModelTypePresentInSpecifics( const google::protobuf::RepeatedPtrField< sync_pb::DataTypeProgressMarker>& filter, - syncer::ModelType value); + ModelType value); sync_pb::DataTypeProgressMarker const* GetProgressMarkerForType( const google::protobuf::RepeatedPtrField< sync_pb::DataTypeProgressMarker>& filter, - syncer::ModelType value); + ModelType value); // When false, we pretend to have network connectivity issues. bool server_reachable_; @@ -336,9 +334,9 @@ class MockConnectionManager : public syncer::ServerConnectionManager { // use the older sync_pb::SyncEntity_BookmarkData-style protocol. bool use_legacy_bookmarks_protocol_; - syncer::ModelTypeSet expected_filter_; + ModelTypeSet expected_filter_; - syncer::ModelTypePayloadMap expected_payloads_; + ModelTypePayloadMap expected_payloads_; int num_get_updates_requests_; diff --git a/sync/test/engine/syncer_command_test.h b/sync/test/engine/syncer_command_test.h index c99846c..6b957a8 100644 --- a/sync/test/engine/syncer_command_test.h +++ b/sync/test/engine/syncer_command_test.h @@ -31,7 +31,7 @@ using ::testing::NiceMock; namespace syncer { -class MockDebugInfoGetter : public syncer::sessions::DebugInfoGetter { +class MockDebugInfoGetter : public sessions::DebugInfoGetter { public: MockDebugInfoGetter(); virtual ~MockDebugInfoGetter(); @@ -100,7 +100,7 @@ class SyncerCommandTestBase : public testing::Test, // Lazily create a session requesting all datatypes with no payload. sessions::SyncSession* session() { - syncer::ModelTypePayloadMap types = + ModelTypePayloadMap types = ModelSafeRoutingInfoToPayloadMap(routing_info_, std::string()); return session(sessions::SyncSourceInfo(types)); } diff --git a/sync/test/null_transaction_observer.cc b/sync/test/null_transaction_observer.cc index f8313ba..abd99b0 100644 --- a/sync/test/null_transaction_observer.cc +++ b/sync/test/null_transaction_observer.cc @@ -9,8 +9,8 @@ namespace syncer { namespace syncable { -syncer::WeakHandle<TransactionObserver> NullTransactionObserver() { - return syncer::MakeWeakHandle(base::WeakPtr<TransactionObserver>()); +WeakHandle<TransactionObserver> NullTransactionObserver() { + return MakeWeakHandle(base::WeakPtr<TransactionObserver>()); } } // namespace syncable diff --git a/sync/test/null_transaction_observer.h b/sync/test/null_transaction_observer.h index 45f4f87..3b61112 100644 --- a/sync/test/null_transaction_observer.h +++ b/sync/test/null_transaction_observer.h @@ -14,7 +14,7 @@ class TransactionObserver; // Returns an initialized weak handle to a transaction observer that // does nothing. -syncer::WeakHandle<TransactionObserver> NullTransactionObserver(); +WeakHandle<TransactionObserver> NullTransactionObserver(); } // namespace syncable } // namespace syncer diff --git a/sync/tools/sync_client.cc b/sync/tools/sync_client.cc index 51d1c68..caa6ee6 100644 --- a/sync/tools/sync_client.cc +++ b/sync/tools/sync_client.cc @@ -53,6 +53,7 @@ // TODO(akalin): Refactor to combine shared code with // sync_listen_notifications. +namespace syncer { namespace { const char kEmailSwitch[] = "email"; @@ -65,22 +66,20 @@ const char kNotificationMethodSwitch[] = "notification-method"; class NullInvalidationStateTracker : public base::SupportsWeakPtr<NullInvalidationStateTracker>, - public syncer::InvalidationStateTracker { + public InvalidationStateTracker { public: NullInvalidationStateTracker() {} virtual ~NullInvalidationStateTracker() {} - virtual syncer::InvalidationVersionMap - GetAllMaxVersions() const OVERRIDE { - return syncer::InvalidationVersionMap(); + virtual InvalidationVersionMap GetAllMaxVersions() const OVERRIDE { + return InvalidationVersionMap(); } virtual void SetMaxVersion( const invalidation::ObjectId& id, int64 max_invalidation_version) OVERRIDE { VLOG(1) << "Setting max invalidation version for " - << syncer::ObjectIdToString(id) << " to " - << max_invalidation_version; + << ObjectIdToString(id) << " to " << max_invalidation_version; } virtual std::string GetInvalidationState() const OVERRIDE { @@ -130,7 +129,7 @@ class MyTestURLRequestContextGetter : public TestURLRequestContextGetter { }; // TODO(akalin): Use system encryptor once it's moved to sync/. -class NullEncryptor : public syncer::Encryptor { +class NullEncryptor : public Encryptor { public: virtual ~NullEncryptor() {} @@ -153,26 +152,26 @@ std::string ValueToString(const Value& value) { return str; } -class LoggingChangeDelegate : public syncer::SyncManager::ChangeDelegate { +class LoggingChangeDelegate : public SyncManager::ChangeDelegate { public: virtual ~LoggingChangeDelegate() {} virtual void OnChangesApplied( - syncer::ModelType model_type, - const syncer::BaseTransaction* trans, - const syncer::ImmutableChangeRecordList& changes) OVERRIDE { + ModelType model_type, + const BaseTransaction* trans, + const ImmutableChangeRecordList& changes) OVERRIDE { LOG(INFO) << "Changes applied for " - << syncer::ModelTypeToString(model_type); + << ModelTypeToString(model_type); size_t i = 1; size_t change_count = changes.Get().size(); - for (syncer::ChangeRecordList::const_iterator it = + for (ChangeRecordList::const_iterator it = changes.Get().begin(); it != changes.Get().end(); ++it) { scoped_ptr<base::DictionaryValue> change_value(it->ToValue()); LOG(INFO) << "Change (" << i << "/" << change_count << "): " << ValueToString(*change_value); - if (it->action != syncer::ChangeRecord::ACTION_DELETE) { - syncer::ReadNode node(trans); - CHECK_EQ(node.InitByIdLookup(it->id), syncer::BaseNode::INIT_OK); + if (it->action != ChangeRecord::ACTION_DELETE) { + ReadNode node(trans); + CHECK_EQ(node.InitByIdLookup(it->id), BaseNode::INIT_OK); scoped_ptr<base::DictionaryValue> details(node.GetDetailsAsValue()); VLOG(1) << "Details: " << ValueToString(*details); } @@ -180,14 +179,14 @@ class LoggingChangeDelegate : public syncer::SyncManager::ChangeDelegate { } } - virtual void OnChangesComplete(syncer::ModelType model_type) OVERRIDE { + virtual void OnChangesComplete(ModelType model_type) OVERRIDE { LOG(INFO) << "Changes complete for " - << syncer::ModelTypeToString(model_type); + << ModelTypeToString(model_type); } }; class LoggingUnrecoverableErrorHandler - : public syncer::UnrecoverableErrorHandler { + : public UnrecoverableErrorHandler { public: virtual ~LoggingUnrecoverableErrorHandler() {} @@ -202,14 +201,14 @@ class LoggingUnrecoverableErrorHandler }; class LoggingJsEventHandler - : public syncer::JsEventHandler, + : public JsEventHandler, public base::SupportsWeakPtr<LoggingJsEventHandler> { public: virtual ~LoggingJsEventHandler() {} virtual void HandleJsEvent( const std::string& name, - const syncer::JsEventDetails& details) OVERRIDE { + const JsEventDetails& details) OVERRIDE { VLOG(1) << name << ": " << details.ToString(); } }; @@ -253,9 +252,7 @@ notifier::NotifierOptions ParseNotifierOptions( return notifier_options; } -} // namespace - -int main(int argc, char* argv[]) { +int SyncClientMain(int argc, char* argv[]) { #if defined(OS_MACOSX) base::mac::ScopedNSAutoreleasePool pool; #endif @@ -276,7 +273,7 @@ int main(int argc, char* argv[]) { // Parse command line. const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - syncer::SyncCredentials credentials; + SyncCredentials credentials; credentials.email = command_line.GetSwitchValueASCII(kEmailSwitch); credentials.sync_token = command_line.GetSwitchValueASCII(kTokenSwitch); // TODO(akalin): Write a wrapper script that gets a token for an @@ -308,7 +305,7 @@ int main(int argc, char* argv[]) { ParseNotifierOptions(command_line, context_getter); const char kClientInfo[] = "sync_listen_notifications"; NullInvalidationStateTracker null_invalidation_state_tracker; - syncer::SyncNotifierFactory sync_notifier_factory( + SyncNotifierFactory sync_notifier_factory( notifier_options, kClientInfo, null_invalidation_state_tracker.AsWeakPtr()); @@ -317,20 +314,20 @@ int main(int argc, char* argv[]) { CHECK(database_dir.CreateUniqueTempDir()); // Set up model type parameters. - const syncer::ModelTypeSet model_types = syncer::ModelTypeSet::All(); - syncer::ModelSafeRoutingInfo routing_info; - for (syncer::ModelTypeSet::Iterator it = model_types.First(); + const ModelTypeSet model_types = ModelTypeSet::All(); + ModelSafeRoutingInfo routing_info; + for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { - routing_info[it.Get()] = syncer::GROUP_PASSIVE; + routing_info[it.Get()] = GROUP_PASSIVE; } - scoped_refptr<syncer::PassiveModelWorker> passive_model_safe_worker = - new syncer::PassiveModelWorker(&sync_loop); - std::vector<syncer::ModelSafeWorker*> workers; + scoped_refptr<PassiveModelWorker> passive_model_safe_worker = + new PassiveModelWorker(&sync_loop); + std::vector<ModelSafeWorker*> workers; workers.push_back(passive_model_safe_worker.get()); // Set up sync manager. - syncer::SyncManagerFactory sync_manager_factory; - scoped_ptr<syncer::SyncManager> sync_manager = + SyncManagerFactory sync_manager_factory; + scoped_ptr<SyncManager> sync_manager = sync_manager_factory.CreateSyncManager("sync_client manager"); LoggingJsEventHandler js_event_handler; const char kSyncServerAndPath[] = "clients4.google.com/chrome-sync/dev"; @@ -341,17 +338,17 @@ int main(int argc, char* argv[]) { const char kUserAgent[] = "sync_client"; // TODO(akalin): Replace this with just the context getter once // HttpPostProviderFactory is removed. - scoped_ptr<syncer::HttpPostProviderFactory> post_factory( - new syncer::HttpBridgeFactory(context_getter, kUserAgent)); + scoped_ptr<HttpPostProviderFactory> post_factory( + new HttpBridgeFactory(context_getter, kUserAgent)); // Used only when committing bookmarks, so it's okay to leave this // as NULL. - syncer::ExtensionsActivityMonitor* extensions_activity_monitor = NULL; + ExtensionsActivityMonitor* extensions_activity_monitor = NULL; LoggingChangeDelegate change_delegate; const char kRestoredKeyForBootstrapping[] = ""; NullEncryptor null_encryptor; LoggingUnrecoverableErrorHandler unrecoverable_error_handler; sync_manager->Init(database_dir.path(), - syncer::WeakHandle<syncer::JsEventHandler>( + WeakHandle<JsEventHandler>( js_event_handler.AsWeakPtr()), kSyncServerAndPath, kSyncServerPort, @@ -363,16 +360,16 @@ int main(int argc, char* argv[]) { extensions_activity_monitor, &change_delegate, credentials, - scoped_ptr<syncer::SyncNotifier>( + scoped_ptr<SyncNotifier>( sync_notifier_factory.CreateSyncNotifier()), kRestoredKeyForBootstrapping, - scoped_ptr<syncer::InternalComponentsFactory>( - new syncer::InternalComponentsFactoryImpl()), + scoped_ptr<InternalComponentsFactory>( + new InternalComponentsFactoryImpl()), &null_encryptor, &unrecoverable_error_handler, &LogUnrecoverableErrorContext); - // TODO(akalin): We have pass in model parameters multiple times. - // Organize handling of model types. + // TODO(akalin): Avoid passing in model parameters multiple times by + // organizing handling of model types. sync_manager->UpdateEnabledTypes(model_types); sync_manager->StartSyncingNormally(routing_info); @@ -381,3 +378,10 @@ int main(int argc, char* argv[]) { io_thread.Stop(); return 0; } + +} // namespace +} // namespace syncer + +int main(int argc, char* argv[]) { + return syncer::SyncClientMain(argc, argv); +} diff --git a/sync/tools/sync_listen_notifications.cc b/sync/tools/sync_listen_notifications.cc index 95b4251..25ebcbd 100644 --- a/sync/tools/sync_listen_notifications.cc +++ b/sync/tools/sync_listen_notifications.cc @@ -36,6 +36,7 @@ // This is a simple utility that initializes a sync notifier and // listens to any received notifications. +namespace syncer { namespace { const char kEmailSwitch[] = "email"; @@ -46,7 +47,7 @@ const char kAllowInsecureConnectionSwitch[] = "allow-insecure-connection"; const char kNotificationMethodSwitch[] = "notification-method"; // Class to print received notifications events. -class NotificationPrinter : public syncer::SyncNotifierObserver { +class NotificationPrinter : public SyncNotifierObserver { public: NotificationPrinter() {} virtual ~NotificationPrinter() {} @@ -56,20 +57,19 @@ class NotificationPrinter : public syncer::SyncNotifierObserver { } virtual void OnNotificationsDisabled( - syncer::NotificationsDisabledReason reason) OVERRIDE { + NotificationsDisabledReason reason) OVERRIDE { LOG(INFO) << "Notifications disabled with reason " - << syncer::NotificationsDisabledReasonToString(reason); + << NotificationsDisabledReasonToString(reason); } virtual void OnIncomingNotification( - const syncer::ModelTypePayloadMap& type_payloads, - syncer::IncomingNotificationSource source) OVERRIDE { - for (syncer::ModelTypePayloadMap::const_iterator it = + const ModelTypePayloadMap& type_payloads, + IncomingNotificationSource source) OVERRIDE { + for (ModelTypePayloadMap::const_iterator it = type_payloads.begin(); it != type_payloads.end(); ++it) { - LOG(INFO) << (source == syncer::REMOTE_NOTIFICATION ? - "Remote" : "Local") + LOG(INFO) << (source == REMOTE_NOTIFICATION ? "Remote" : "Local") << " Notification: type = " - << syncer::ModelTypeToString(it->first) + << ModelTypeToString(it->first) << ", payload = " << it->second; } } @@ -80,22 +80,20 @@ class NotificationPrinter : public syncer::SyncNotifierObserver { class NullInvalidationStateTracker : public base::SupportsWeakPtr<NullInvalidationStateTracker>, - public syncer::InvalidationStateTracker { + public InvalidationStateTracker { public: NullInvalidationStateTracker() {} virtual ~NullInvalidationStateTracker() {} - virtual syncer::InvalidationVersionMap - GetAllMaxVersions() const OVERRIDE { - return syncer::InvalidationVersionMap(); + virtual InvalidationVersionMap GetAllMaxVersions() const OVERRIDE { + return InvalidationVersionMap(); } virtual void SetMaxVersion( const invalidation::ObjectId& id, int64 max_invalidation_version) OVERRIDE { LOG(INFO) << "Setting max invalidation version for " - << syncer::ObjectIdToString(id) << " to " - << max_invalidation_version; + << ObjectIdToString(id) << " to " << max_invalidation_version; } virtual std::string GetInvalidationState() const OVERRIDE { @@ -178,9 +176,8 @@ notifier::NotifierOptions ParseNotifierOptions( return notifier_options; } -} // namespace - -int main(int argc, char* argv[]) { +int SyncListenNotificationsMain(int argc, char* argv[]) { + using namespace syncer; #if defined(OS_MACOSX) base::mac::ScopedNSAutoreleasePool pool; #endif @@ -230,10 +227,10 @@ int main(int argc, char* argv[]) { new MyTestURLRequestContextGetter(io_thread.message_loop_proxy())); const char kClientInfo[] = "sync_listen_notifications"; NullInvalidationStateTracker null_invalidation_state_tracker; - syncer::SyncNotifierFactory sync_notifier_factory( + SyncNotifierFactory sync_notifier_factory( notifier_options, kClientInfo, null_invalidation_state_tracker.AsWeakPtr()); - scoped_ptr<syncer::SyncNotifier> sync_notifier( + scoped_ptr<SyncNotifier> sync_notifier( sync_notifier_factory.CreateSyncNotifier()); NotificationPrinter notification_printer; sync_notifier->AddObserver(¬ification_printer); @@ -242,7 +239,7 @@ int main(int argc, char* argv[]) { sync_notifier->SetUniqueId(kUniqueId); sync_notifier->UpdateCredentials(email, token); // Listen for notifications for all known types. - sync_notifier->UpdateEnabledTypes(syncer::ModelTypeSet::All()); + sync_notifier->UpdateEnabledTypes(ModelTypeSet::All()); ui_loop.Run(); @@ -250,3 +247,10 @@ int main(int argc, char* argv[]) { io_thread.Stop(); return 0; } + +} // namespace +} // namespace syncer + +int main(int argc, char* argv[]) { + return syncer::SyncListenNotificationsMain(argc, argv); +} diff --git a/sync/util/cryptographer.cc b/sync/util/cryptographer.cc index 59e8a1a..2c0d794 100644 --- a/sync/util/cryptographer.cc +++ b/sync/util/cryptographer.cc @@ -309,12 +309,12 @@ Cryptographer::UpdateResult Cryptographer::Update( } // Static -syncer::ModelTypeSet Cryptographer::SensitiveTypes() { +ModelTypeSet Cryptographer::SensitiveTypes() { // Both of these have their own encryption schemes, but we include them // anyways. - syncer::ModelTypeSet types; - types.Put(syncer::PASSWORDS); - types.Put(syncer::NIGORI); + ModelTypeSet types; + types.Put(PASSWORDS); + types.Put(NIGORI); return types; } @@ -325,33 +325,33 @@ void Cryptographer::UpdateEncryptedTypesFromNigori( return; } - syncer::ModelTypeSet encrypted_types(SensitiveTypes()); + ModelTypeSet encrypted_types(SensitiveTypes()); if (nigori.encrypt_bookmarks()) - encrypted_types.Put(syncer::BOOKMARKS); + encrypted_types.Put(BOOKMARKS); if (nigori.encrypt_preferences()) - encrypted_types.Put(syncer::PREFERENCES); + encrypted_types.Put(PREFERENCES); if (nigori.encrypt_autofill_profile()) - encrypted_types.Put(syncer::AUTOFILL_PROFILE); + encrypted_types.Put(AUTOFILL_PROFILE); if (nigori.encrypt_autofill()) - encrypted_types.Put(syncer::AUTOFILL); + encrypted_types.Put(AUTOFILL); if (nigori.encrypt_themes()) - encrypted_types.Put(syncer::THEMES); + encrypted_types.Put(THEMES); if (nigori.encrypt_typed_urls()) - encrypted_types.Put(syncer::TYPED_URLS); + encrypted_types.Put(TYPED_URLS); if (nigori.encrypt_extension_settings()) - encrypted_types.Put(syncer::EXTENSION_SETTINGS); + encrypted_types.Put(EXTENSION_SETTINGS); if (nigori.encrypt_extensions()) - encrypted_types.Put(syncer::EXTENSIONS); + encrypted_types.Put(EXTENSIONS); if (nigori.encrypt_search_engines()) - encrypted_types.Put(syncer::SEARCH_ENGINES); + encrypted_types.Put(SEARCH_ENGINES); if (nigori.encrypt_sessions()) - encrypted_types.Put(syncer::SESSIONS); + encrypted_types.Put(SESSIONS); if (nigori.encrypt_app_settings()) - encrypted_types.Put(syncer::APP_SETTINGS); + encrypted_types.Put(APP_SETTINGS); if (nigori.encrypt_apps()) - encrypted_types.Put(syncer::APPS); + encrypted_types.Put(APPS); if (nigori.encrypt_app_notifications()) - encrypted_types.Put(syncer::APP_NOTIFICATIONS); + encrypted_types.Put(APP_NOTIFICATIONS); // Note: the initial version with encryption did not support the // encrypt_everything field. If anything more than the sensitive types were @@ -369,38 +369,38 @@ void Cryptographer::UpdateNigoriFromEncryptedTypes( sync_pb::NigoriSpecifics* nigori) const { nigori->set_encrypt_everything(encrypt_everything_); nigori->set_encrypt_bookmarks( - encrypted_types_.Has(syncer::BOOKMARKS)); + encrypted_types_.Has(BOOKMARKS)); nigori->set_encrypt_preferences( - encrypted_types_.Has(syncer::PREFERENCES)); + encrypted_types_.Has(PREFERENCES)); nigori->set_encrypt_autofill_profile( - encrypted_types_.Has(syncer::AUTOFILL_PROFILE)); - nigori->set_encrypt_autofill(encrypted_types_.Has(syncer::AUTOFILL)); - nigori->set_encrypt_themes(encrypted_types_.Has(syncer::THEMES)); + encrypted_types_.Has(AUTOFILL_PROFILE)); + nigori->set_encrypt_autofill(encrypted_types_.Has(AUTOFILL)); + nigori->set_encrypt_themes(encrypted_types_.Has(THEMES)); nigori->set_encrypt_typed_urls( - encrypted_types_.Has(syncer::TYPED_URLS)); + encrypted_types_.Has(TYPED_URLS)); nigori->set_encrypt_extension_settings( - encrypted_types_.Has(syncer::EXTENSION_SETTINGS)); + encrypted_types_.Has(EXTENSION_SETTINGS)); nigori->set_encrypt_extensions( - encrypted_types_.Has(syncer::EXTENSIONS)); + encrypted_types_.Has(EXTENSIONS)); nigori->set_encrypt_search_engines( - encrypted_types_.Has(syncer::SEARCH_ENGINES)); - nigori->set_encrypt_sessions(encrypted_types_.Has(syncer::SESSIONS)); + encrypted_types_.Has(SEARCH_ENGINES)); + nigori->set_encrypt_sessions(encrypted_types_.Has(SESSIONS)); nigori->set_encrypt_app_settings( - encrypted_types_.Has(syncer::APP_SETTINGS)); - nigori->set_encrypt_apps(encrypted_types_.Has(syncer::APPS)); + encrypted_types_.Has(APP_SETTINGS)); + nigori->set_encrypt_apps(encrypted_types_.Has(APPS)); nigori->set_encrypt_app_notifications( - encrypted_types_.Has(syncer::APP_NOTIFICATIONS)); + encrypted_types_.Has(APP_NOTIFICATIONS)); } void Cryptographer::set_encrypt_everything() { if (encrypt_everything_) { - DCHECK(encrypted_types_.Equals(syncer::ModelTypeSet::All())); + DCHECK(encrypted_types_.Equals(ModelTypeSet::All())); return; } encrypt_everything_ = true; // Change |encrypted_types_| directly to avoid sending more than one // notification. - encrypted_types_ = syncer::ModelTypeSet::All(); + encrypted_types_ = ModelTypeSet::All(); EmitEncryptedTypesChangedNotification(); } @@ -408,17 +408,15 @@ bool Cryptographer::encrypt_everything() const { return encrypt_everything_; } -syncer::ModelTypeSet Cryptographer::GetEncryptedTypes() const { +ModelTypeSet Cryptographer::GetEncryptedTypes() const { return encrypted_types_; } -void Cryptographer::MergeEncryptedTypesForTest( - syncer::ModelTypeSet encrypted_types) { +void Cryptographer::MergeEncryptedTypesForTest(ModelTypeSet encrypted_types) { MergeEncryptedTypes(encrypted_types); } -void Cryptographer::MergeEncryptedTypes( - syncer::ModelTypeSet encrypted_types) { +void Cryptographer::MergeEncryptedTypes(ModelTypeSet encrypted_types) { if (encrypted_types_.HasAll(encrypted_types)) { return; } diff --git a/sync/util/cryptographer.h b/sync/util/cryptographer.h index b6f99af..f02875a 100644 --- a/sync/util/cryptographer.h +++ b/sync/util/cryptographer.h @@ -64,7 +64,7 @@ class Cryptographer { // set of encrypted types is SensitiveTypes() and that the encrypt // everything flag is false. virtual void OnEncryptedTypesChanged( - syncer::ModelTypeSet encrypted_types, + ModelTypeSet encrypted_types, bool encrypt_everything) = 0; protected: @@ -180,7 +180,7 @@ class Cryptographer { UpdateResult Update(const sync_pb::NigoriSpecifics& nigori); // The set of types that are always encrypted. - static syncer::ModelTypeSet SensitiveTypes(); + static ModelTypeSet SensitiveTypes(); // Reset our set of encrypted types based on the contents of the nigori // specifics. @@ -197,10 +197,10 @@ class Cryptographer { bool encrypt_everything() const; // Return the set of encrypted types. - syncer::ModelTypeSet GetEncryptedTypes() const; + ModelTypeSet GetEncryptedTypes() const; // Forwards to MergeEncryptedTypes. - void MergeEncryptedTypesForTest(syncer::ModelTypeSet encrypted_types); + void MergeEncryptedTypesForTest(ModelTypeSet encrypted_types); private: FRIEND_TEST_ALL_PREFIXES(SyncCryptographerTest, PackUnpack); @@ -208,7 +208,7 @@ class Cryptographer { // Merges the given set of encrypted types with the existing set and emits a // notification if necessary. - void MergeEncryptedTypes(syncer::ModelTypeSet encrypted_types); + void MergeEncryptedTypes(ModelTypeSet encrypted_types); void EmitEncryptedTypesChangedNotification(); @@ -240,7 +240,7 @@ class Cryptographer { scoped_ptr<sync_pb::EncryptedData> pending_keys_; - syncer::ModelTypeSet encrypted_types_; + ModelTypeSet encrypted_types_; bool encrypt_everything_; DISALLOW_COPY_AND_ASSIGN(Cryptographer); diff --git a/sync/util/cryptographer_unittest.cc b/sync/util/cryptographer_unittest.cc index fe0798d..d729311 100644 --- a/sync/util/cryptographer_unittest.cc +++ b/sync/util/cryptographer_unittest.cc @@ -25,8 +25,7 @@ using ::testing::StrictMock; class MockObserver : public Cryptographer::Observer { public: - MOCK_METHOD2(OnEncryptedTypesChanged, - void(syncer::ModelTypeSet, bool)); + MOCK_METHOD2(OnEncryptedTypesChanged, void(ModelTypeSet, bool)); }; } // namespace @@ -244,15 +243,13 @@ TEST_F(SyncCryptographerTest, NigoriEncryptionTypes) { EXPECT_CALL(observer, OnEncryptedTypesChanged( - HasModelTypes(syncer::ModelTypeSet::All()), - false)); + HasModelTypes(ModelTypeSet::All()), false)); EXPECT_CALL(observer2, OnEncryptedTypesChanged( - HasModelTypes(syncer::ModelTypeSet::All()), - false)); + HasModelTypes(ModelTypeSet::All()), false)); // Set all encrypted types - encrypted_types = syncer::ModelTypeSet::All(); + encrypted_types = ModelTypeSet::All(); cryptographer_.MergeEncryptedTypesForTest(encrypted_types); cryptographer_.UpdateNigoriFromEncryptedTypes(&nigori); cryptographer2.UpdateEncryptedTypesFromNigori(nigori); @@ -268,7 +265,7 @@ TEST_F(SyncCryptographerTest, NigoriEncryptionTypes) { } TEST_F(SyncCryptographerTest, EncryptEverythingExplicit) { - ModelTypeSet real_types = syncer::ModelTypeSet::All(); + ModelTypeSet real_types = ModelTypeSet::All(); sync_pb::NigoriSpecifics specifics; specifics.set_encrypt_everything(true); @@ -277,13 +274,13 @@ TEST_F(SyncCryptographerTest, EncryptEverythingExplicit) { EXPECT_CALL(observer, OnEncryptedTypesChanged( - HasModelTypes(syncer::ModelTypeSet::All()), true)); + HasModelTypes(ModelTypeSet::All()), true)); EXPECT_FALSE(cryptographer_.encrypt_everything()); ModelTypeSet encrypted_types = cryptographer_.GetEncryptedTypes(); for (ModelTypeSet::Iterator iter = real_types.First(); iter.Good(); iter.Inc()) { - if (iter.Get() == syncer::PASSWORDS || iter.Get() == syncer::NIGORI) + if (iter.Get() == PASSWORDS || iter.Get() == NIGORI) EXPECT_TRUE(encrypted_types.Has(iter.Get())); else EXPECT_FALSE(encrypted_types.Has(iter.Get())); @@ -305,7 +302,7 @@ TEST_F(SyncCryptographerTest, EncryptEverythingExplicit) { } TEST_F(SyncCryptographerTest, EncryptEverythingImplicit) { - ModelTypeSet real_types = syncer::ModelTypeSet::All(); + ModelTypeSet real_types = ModelTypeSet::All(); sync_pb::NigoriSpecifics specifics; specifics.set_encrypt_bookmarks(true); // Non-passwords = encrypt everything @@ -314,13 +311,13 @@ TEST_F(SyncCryptographerTest, EncryptEverythingImplicit) { EXPECT_CALL(observer, OnEncryptedTypesChanged( - HasModelTypes(syncer::ModelTypeSet::All()), true)); + HasModelTypes(ModelTypeSet::All()), true)); EXPECT_FALSE(cryptographer_.encrypt_everything()); ModelTypeSet encrypted_types = cryptographer_.GetEncryptedTypes(); for (ModelTypeSet::Iterator iter = real_types.First(); iter.Good(); iter.Inc()) { - if (iter.Get() == syncer::PASSWORDS || iter.Get() == syncer::NIGORI) + if (iter.Get() == PASSWORDS || iter.Get() == NIGORI) EXPECT_TRUE(encrypted_types.Has(iter.Get())); else EXPECT_FALSE(encrypted_types.Has(iter.Get())); @@ -342,7 +339,7 @@ TEST_F(SyncCryptographerTest, EncryptEverythingImplicit) { } TEST_F(SyncCryptographerTest, UnknownSensitiveTypes) { - ModelTypeSet real_types = syncer::ModelTypeSet::All(); + ModelTypeSet real_types = ModelTypeSet::All(); sync_pb::NigoriSpecifics specifics; // Explicitly setting encrypt everything should override logic for implicit // encrypt everything. @@ -352,9 +349,8 @@ TEST_F(SyncCryptographerTest, UnknownSensitiveTypes) { StrictMock<MockObserver> observer; cryptographer_.AddObserver(&observer); - syncer::ModelTypeSet expected_encrypted_types = - Cryptographer::SensitiveTypes(); - expected_encrypted_types.Put(syncer::BOOKMARKS); + ModelTypeSet expected_encrypted_types = Cryptographer::SensitiveTypes(); + expected_encrypted_types.Put(BOOKMARKS); EXPECT_CALL(observer, OnEncryptedTypesChanged( @@ -364,7 +360,7 @@ TEST_F(SyncCryptographerTest, UnknownSensitiveTypes) { ModelTypeSet encrypted_types = cryptographer_.GetEncryptedTypes(); for (ModelTypeSet::Iterator iter = real_types.First(); iter.Good(); iter.Inc()) { - if (iter.Get() == syncer::PASSWORDS || iter.Get() == syncer::NIGORI) + if (iter.Get() == PASSWORDS || iter.Get() == NIGORI) EXPECT_TRUE(encrypted_types.Has(iter.Get())); else EXPECT_FALSE(encrypted_types.Has(iter.Get())); @@ -376,9 +372,9 @@ TEST_F(SyncCryptographerTest, UnknownSensitiveTypes) { encrypted_types = cryptographer_.GetEncryptedTypes(); for (ModelTypeSet::Iterator iter = real_types.First(); iter.Good(); iter.Inc()) { - if (iter.Get() == syncer::PASSWORDS || - iter.Get() == syncer::NIGORI || - iter.Get() == syncer::BOOKMARKS) + if (iter.Get() == PASSWORDS || + iter.Get() == NIGORI || + iter.Get() == BOOKMARKS) EXPECT_TRUE(encrypted_types.Has(iter.Get())); else EXPECT_FALSE(encrypted_types.Has(iter.Get())); diff --git a/sync/util/data_type_histogram.h b/sync/util/data_type_histogram.h index 00a81df..77eb57c 100644 --- a/sync/util/data_type_histogram.h +++ b/sync/util/data_type_histogram.h @@ -36,54 +36,54 @@ #define SYNC_DATA_TYPE_HISTOGRAM(datatype) \ do { \ switch (datatype) { \ - case syncer::BOOKMARKS: \ + case ::syncer::BOOKMARKS: \ PER_DATA_TYPE_MACRO("Bookmarks"); \ break; \ - case syncer::PREFERENCES: \ + case ::syncer::PREFERENCES: \ PER_DATA_TYPE_MACRO("Preferences"); \ break; \ - case syncer::PASSWORDS: \ + case ::syncer::PASSWORDS: \ PER_DATA_TYPE_MACRO("Passwords"); \ break; \ - case syncer::AUTOFILL: \ + case ::syncer::AUTOFILL: \ PER_DATA_TYPE_MACRO("Autofill"); \ break; \ - case syncer::AUTOFILL_PROFILE: \ + case ::syncer::AUTOFILL_PROFILE: \ PER_DATA_TYPE_MACRO("AutofillProfiles"); \ break; \ - case syncer::THEMES: \ + case ::syncer::THEMES: \ PER_DATA_TYPE_MACRO("Themes"); \ break; \ - case syncer::TYPED_URLS: \ + case ::syncer::TYPED_URLS: \ PER_DATA_TYPE_MACRO("TypedUrls"); \ break; \ - case syncer::EXTENSIONS: \ + case ::syncer::EXTENSIONS: \ PER_DATA_TYPE_MACRO("Extensions"); \ break; \ - case syncer::NIGORI: \ + case ::syncer::NIGORI: \ PER_DATA_TYPE_MACRO("Nigori"); \ break; \ - case syncer::SEARCH_ENGINES: \ + case ::syncer::SEARCH_ENGINES: \ PER_DATA_TYPE_MACRO("SearchEngines"); \ break; \ - case syncer::SESSIONS: \ + case ::syncer::SESSIONS: \ PER_DATA_TYPE_MACRO("Sessions"); \ break; \ - case syncer::APPS: \ + case ::syncer::APPS: \ PER_DATA_TYPE_MACRO("Apps"); \ break; \ - case syncer::APP_SETTINGS: \ + case ::syncer::APP_SETTINGS: \ PER_DATA_TYPE_MACRO("AppSettings"); \ break; \ - case syncer::EXTENSION_SETTINGS: \ + case ::syncer::EXTENSION_SETTINGS: \ PER_DATA_TYPE_MACRO("ExtensionSettings"); \ break; \ - case syncer::APP_NOTIFICATIONS: \ + case ::syncer::APP_NOTIFICATIONS: \ PER_DATA_TYPE_MACRO("AppNotifications"); \ break; \ default: \ NOTREACHED() << "Unknown datatype " \ - << syncer::ModelTypeToString(datatype); \ + << ::syncer::ModelTypeToString(datatype); \ } \ } while (0) diff --git a/sync/util/data_type_histogram_unittest.cc b/sync/util/data_type_histogram_unittest.cc index f43a19b..6ca1619 100644 --- a/sync/util/data_type_histogram_unittest.cc +++ b/sync/util/data_type_histogram_unittest.cc @@ -16,9 +16,8 @@ class DataTypeHistogramTest : public testing::Test { // Create a histogram of type HISTOGRAM_COUNTS for each model type. Nothing // should break. TEST(DataTypeHistogramTest, BasicCount) { - for (int i = syncer::FIRST_REAL_MODEL_TYPE; - i <= syncer::LAST_REAL_MODEL_TYPE; ++i) { - syncer::ModelType type = syncer::ModelTypeFromInt(i); + for (int i = FIRST_REAL_MODEL_TYPE; i <= LAST_REAL_MODEL_TYPE; ++i) { + ModelType type = ModelTypeFromInt(i); #define PER_DATA_TYPE_MACRO(type_str) \ HISTOGRAM_COUNTS("Prefix" type_str "Suffix", 1); SYNC_DATA_TYPE_HISTOGRAM(type); @@ -29,9 +28,8 @@ TEST(DataTypeHistogramTest, BasicCount) { // Create a histogram of type SYNC_FREQ_HISTOGRAM for each model type. Nothing // should break. TEST(DataTypeHistogramTest, BasicFreq) { - for (int i = syncer::FIRST_REAL_MODEL_TYPE; - i <= syncer::LAST_REAL_MODEL_TYPE; ++i) { - syncer::ModelType type = syncer::ModelTypeFromInt(i); + for (int i = FIRST_REAL_MODEL_TYPE; i <= LAST_REAL_MODEL_TYPE; ++i) { + ModelType type = ModelTypeFromInt(i); #define PER_DATA_TYPE_MACRO(type_str) \ SYNC_FREQ_HISTOGRAM("Prefix" type_str "Suffix", \ base::TimeDelta::FromSeconds(1)); @@ -48,9 +46,8 @@ TEST(DataTypeHistogramTest, BasicEnum) { TYPE_2, TYPE_COUNT, }; - for (int i = syncer::FIRST_REAL_MODEL_TYPE; - i <= syncer::LAST_REAL_MODEL_TYPE; ++i) { - syncer::ModelType type = syncer::ModelTypeFromInt(i); + for (int i = FIRST_REAL_MODEL_TYPE; i <= LAST_REAL_MODEL_TYPE; ++i) { + ModelType type = ModelTypeFromInt(i); #define PER_DATA_TYPE_MACRO(type_str) \ UMA_HISTOGRAM_ENUMERATION("Prefix" type_str "Suffix", \ (i % 2 ? TYPE_1 : TYPE_2), TYPE_COUNT); diff --git a/sync/util/logging.h b/sync/util/logging.h index e6da535..f23d9c1 100644 --- a/sync/util/logging.h +++ b/sync/util/logging.h @@ -29,6 +29,6 @@ bool VlogIsOnForLocation(const tracked_objects::Location& from_here, VLOG_LOC_STREAM(from_here, verbose_level), \ ::logging::DEBUG_MODE && \ (VLOG_IS_ON(verbose_level) || \ - ::syncer::VlogIsOnForLocation(from_here, verbose_level))) \ + ::syncer::VlogIsOnForLocation(from_here, verbose_level))) \ #endif // SYNC_UTIL_LOGGING_H_ |