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 /sync/internal_api | |
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
Diffstat (limited to 'sync/internal_api')
58 files changed, 718 insertions, 786 deletions
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. |