diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-03 23:41:32 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-03 23:41:32 +0000 |
commit | a4a1476522880f416690e9357eedaa40b5ac8a99 (patch) | |
tree | bc2a8cc0a4942e16094f9a07859508583b03e169 /sync/internal_api | |
parent | dade34b60910f213ae8f8fdd13709ec17581ef9e (diff) | |
download | chromium_src-a4a1476522880f416690e9357eedaa40b5ac8a99.zip chromium_src-a4a1476522880f416690e9357eedaa40b5ac8a99.tar.gz chromium_src-a4a1476522880f416690e9357eedaa40b5ac8a99.tar.bz2 |
[Sync] Move ModelType and related classes to 'syncer' namespace
Previously they were in 'syncer::syncable'.
Also remove aliases to those classes from 'syncable'.
BUG=128060
TEST=
TBR=pkasting@chromium.org,jhawkins@chromium.org,
Review URL: https://chromiumcodereview.appspot.com/10696087
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145399 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api')
37 files changed, 439 insertions, 538 deletions
diff --git a/sync/internal_api/base_node.cc b/sync/internal_api/base_node.cc index 911bc6a..fc0dfb2 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( - syncable::ModelType model_type, const std::string& client_tag) { + syncer::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; - syncable::AddDefaultFieldValue(model_type, &serialized_type); + syncer::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() == syncable::BOOKMARKS && + if (GetModelType() == syncer::BOOKMARKS && !specifics.bookmark().has_title() && !GetTitle().empty()) { // Last check ensures this isn't a new node. // We need to fill in the title. @@ -122,7 +122,7 @@ bool BaseNode::DecryptIfNecessary() { DecryptToString(encrypted); if (plaintext_data.length() == 0) { LOG(ERROR) << "Failed to decrypt encrypted node of type " << - syncable::ModelTypeToString(GetModelType()) << "."; + syncer::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 " - << syncable::ModelTypeToString(GetModelType()) + << syncer::ModelTypeToString(GetModelType()) << " with content: " << plaintext_data; return true; } @@ -144,15 +144,15 @@ 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(syncable::GetModelTypeFromSpecifics(unencrypted_data_), - syncable::UNSPECIFIED); + DCHECK_NE(syncer::GetModelTypeFromSpecifics(unencrypted_data_), + syncer::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() == syncable::BOOKMARKS) { + if (GetModelType() == syncer::BOOKMARKS) { const sync_pb::BookmarkSpecifics& bookmark_specifics = specifics.bookmark(); if (bookmark_specifics.has_title() || @@ -163,13 +163,13 @@ const sync_pb::EntitySpecifics& BaseNode::GetUnencryptedSpecifics( // |unencrypted_data_| to be non-empty. return specifics; } else { - DCHECK_EQ(syncable::GetModelTypeFromSpecifics(unencrypted_data_), - syncable::BOOKMARKS); + DCHECK_EQ(syncer::GetModelTypeFromSpecifics(unencrypted_data_), + syncer::BOOKMARKS); return unencrypted_data_; } } else { - DCHECK_EQ(syncable::GetModelTypeFromSpecifics(unencrypted_data_), - syncable::UNSPECIFIED); + DCHECK_EQ(syncer::GetModelTypeFromSpecifics(unencrypted_data_), + syncer::UNSPECIFIED); return specifics; } } @@ -195,7 +195,7 @@ bool BaseNode::GetIsFolder() const { std::string BaseNode::GetTitle() const { std::string result; // TODO(zea): refactor bookmarks to not need this functionality. - if (syncable::BOOKMARKS == GetModelType() && + if (syncer::BOOKMARKS == GetModelType() && GetEntry()->Get(syncable::SPECIFICS).has_encrypted()) { // Special case for legacy bookmarks dealing with encryption. ServerNameToSyncAPIName(GetBookmarkSpecifics().title(), &result); @@ -286,52 +286,52 @@ int64 BaseNode::GetExternalId() const { } const sync_pb::AppSpecifics& BaseNode::GetAppSpecifics() const { - DCHECK_EQ(syncable::APPS, GetModelType()); + DCHECK_EQ(syncer::APPS, GetModelType()); return GetEntitySpecifics().app(); } const sync_pb::AutofillSpecifics& BaseNode::GetAutofillSpecifics() const { - DCHECK_EQ(syncable::AUTOFILL, GetModelType()); + DCHECK_EQ(syncer::AUTOFILL, GetModelType()); return GetEntitySpecifics().autofill(); } const AutofillProfileSpecifics& BaseNode::GetAutofillProfileSpecifics() const { - DCHECK_EQ(GetModelType(), syncable::AUTOFILL_PROFILE); + DCHECK_EQ(GetModelType(), syncer::AUTOFILL_PROFILE); return GetEntitySpecifics().autofill_profile(); } const sync_pb::BookmarkSpecifics& BaseNode::GetBookmarkSpecifics() const { - DCHECK_EQ(syncable::BOOKMARKS, GetModelType()); + DCHECK_EQ(syncer::BOOKMARKS, GetModelType()); return GetEntitySpecifics().bookmark(); } const sync_pb::NigoriSpecifics& BaseNode::GetNigoriSpecifics() const { - DCHECK_EQ(syncable::NIGORI, GetModelType()); + DCHECK_EQ(syncer::NIGORI, GetModelType()); return GetEntitySpecifics().nigori(); } const sync_pb::PasswordSpecificsData& BaseNode::GetPasswordSpecifics() const { - DCHECK_EQ(syncable::PASSWORDS, GetModelType()); + DCHECK_EQ(syncer::PASSWORDS, GetModelType()); return *password_data_; } const sync_pb::ThemeSpecifics& BaseNode::GetThemeSpecifics() const { - DCHECK_EQ(syncable::THEMES, GetModelType()); + DCHECK_EQ(syncer::THEMES, GetModelType()); return GetEntitySpecifics().theme(); } const sync_pb::TypedUrlSpecifics& BaseNode::GetTypedUrlSpecifics() const { - DCHECK_EQ(syncable::TYPED_URLS, GetModelType()); + DCHECK_EQ(syncer::TYPED_URLS, GetModelType()); return GetEntitySpecifics().typed_url(); } const sync_pb::ExtensionSpecifics& BaseNode::GetExtensionSpecifics() const { - DCHECK_EQ(syncable::EXTENSIONS, GetModelType()); + DCHECK_EQ(syncer::EXTENSIONS, GetModelType()); return GetEntitySpecifics().extension(); } const sync_pb::SessionSpecifics& BaseNode::GetSessionSpecifics() const { - DCHECK_EQ(syncable::SESSIONS, GetModelType()); + DCHECK_EQ(syncer::SESSIONS, GetModelType()); return GetEntitySpecifics().session(); } @@ -339,15 +339,15 @@ const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const { return GetUnencryptedSpecifics(GetEntry()); } -syncable::ModelType BaseNode::GetModelType() const { +syncer::ModelType BaseNode::GetModelType() const { return GetEntry()->GetModelType(); } void BaseNode::SetUnencryptedSpecifics( const sync_pb::EntitySpecifics& specifics) { - syncable::ModelType type = syncable::GetModelTypeFromSpecifics(specifics); - DCHECK_NE(syncable::UNSPECIFIED, type); - if (GetModelType() != syncable::UNSPECIFIED) { + syncer::ModelType type = syncer::GetModelTypeFromSpecifics(specifics); + DCHECK_NE(syncer::UNSPECIFIED, type); + if (GetModelType() != syncer::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 5b81136..94a78c1 100644 --- a/sync/internal_api/base_transaction.cc +++ b/sync/internal_api/base_transaction.cc @@ -24,8 +24,7 @@ syncer::Cryptographer* BaseTransaction::GetCryptographer() const { return directory_->GetCryptographer(this->GetWrappedTrans()); } -syncable::ModelTypeSet GetEncryptedTypes( - const syncer::BaseTransaction* trans) { +syncer::ModelTypeSet GetEncryptedTypes(const syncer::BaseTransaction* trans) { return trans->GetCryptographer()->GetEncryptedTypes(); } diff --git a/sync/internal_api/change_reorder_buffer.cc b/sync/internal_api/change_reorder_buffer.cc index 916ce3a0..1d7da38 100644 --- a/sync/internal_api/change_reorder_buffer.cc +++ b/sync/internal_api/change_reorder_buffer.cc @@ -154,8 +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 (syncable::ShouldMaintainPosition( - node.GetEntry()->GetModelType())) { + if (syncer::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 99f5411..259ad76 100644 --- a/sync/internal_api/debug_info_event_listener.cc +++ b/sync/internal_api/debug_info_event_listener.cc @@ -79,7 +79,7 @@ void DebugInfoEventListener::OnUpdatedToken(const std::string& token) { } void DebugInfoEventListener::OnEncryptedTypesChanged( - syncable::ModelTypeSet encrypted_types, + syncer::ModelTypeSet encrypted_types, bool encrypt_everything) { CreateAndAddEvent(sync_pb::DebugEventInfo::ENCRYPTED_TYPES_CHANGED); } @@ -101,23 +101,22 @@ void DebugInfoEventListener::SetCryptographerReady(bool ready) { cryptographer_ready_ = ready; } -void DebugInfoEventListener::OnNudgeFromDatatype( - syncable::ModelType datatype) { +void DebugInfoEventListener::OnNudgeFromDatatype(syncer::ModelType datatype) { sync_pb::DebugEventInfo event_info; event_info.set_nudging_datatype( - syncable::GetSpecificsFieldNumberFromModelType(datatype)); + syncer::GetSpecificsFieldNumberFromModelType(datatype)); AddEventToQueue(event_info); } void DebugInfoEventListener::OnIncomingNotification( - const syncable::ModelTypePayloadMap& type_payloads) { + const syncer::ModelTypePayloadMap& type_payloads) { sync_pb::DebugEventInfo event_info; - syncable::ModelTypeSet types = ModelTypePayloadMapToEnumSet(type_payloads); + syncer::ModelTypeSet types = ModelTypePayloadMapToEnumSet(type_payloads); - for (syncable::ModelTypeSet::Iterator it = types.First(); + for (syncer::ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) { event_info.add_datatypes_notified_from_server( - syncable::GetSpecificsFieldNumberFromModelType(it.Get())); + syncer::GetSpecificsFieldNumberFromModelType(it.Get())); } AddEventToQueue(event_info); diff --git a/sync/internal_api/debug_info_event_listener.h b/sync/internal_api/debug_info_event_listener.h index 8fe9847..403c182 100644 --- a/sync/internal_api/debug_info_event_listener.h +++ b/sync/internal_api/debug_info_event_listener.h @@ -46,16 +46,16 @@ class DebugInfoEventListener : public syncer::SyncManager::Observer, virtual void OnStopSyncingPermanently() OVERRIDE; virtual void OnUpdatedToken(const std::string& token) OVERRIDE; virtual void OnEncryptedTypesChanged( - syncable::ModelTypeSet encrypted_types, + syncer::ModelTypeSet encrypted_types, bool encrypt_everything) OVERRIDE; virtual void OnEncryptionComplete() OVERRIDE; virtual void OnActionableError( const syncer::SyncProtocolError& sync_error) OVERRIDE; // Sync manager events. - void OnNudgeFromDatatype(syncable::ModelType datatype); + void OnNudgeFromDatatype(syncer::ModelType datatype); void OnIncomingNotification( - const syncable::ModelTypePayloadMap& type_payloads); + const syncer::ModelTypePayloadMap& type_payloads); // DebugInfoGetter Implementation. virtual void GetAndClearDebugInfo(sync_pb::DebugInfo* debug_info) OVERRIDE; diff --git a/sync/internal_api/js_mutation_event_observer.cc b/sync/internal_api/js_mutation_event_observer.cc index 02f5837..d977fa5 100644 --- a/sync/internal_api/js_mutation_event_observer.cc +++ b/sync/internal_api/js_mutation_event_observer.cc @@ -44,14 +44,14 @@ const size_t kChangeLimit = 100; } // namespace void JsMutationEventObserver::OnChangesApplied( - syncable::ModelType model_type, + syncer::ModelType model_type, int64 write_transaction_id, const syncer::ImmutableChangeRecordList& changes) { if (!event_handler_.IsInitialized()) { return; } DictionaryValue details; - details.SetString("modelType", syncable::ModelTypeToString(model_type)); + details.SetString("modelType", syncer::ModelTypeToString(model_type)); details.SetString("writeTransactionId", base::Int64ToString(write_transaction_id)); base::Value* changes_value = NULL; @@ -74,18 +74,18 @@ void JsMutationEventObserver::OnChangesApplied( } void JsMutationEventObserver::OnChangesComplete( - syncable::ModelType model_type) { + syncer::ModelType model_type) { if (!event_handler_.IsInitialized()) { return; } DictionaryValue details; - details.SetString("modelType", syncable::ModelTypeToString(model_type)); + details.SetString("modelType", syncer::ModelTypeToString(model_type)); HandleJsEvent(FROM_HERE, "onChangesComplete", JsEventDetails(&details)); } void JsMutationEventObserver::OnTransactionWrite( const syncable::ImmutableWriteTransactionInfo& write_transaction_info, - syncable::ModelTypeSet models_with_changes) { + syncer::ModelTypeSet models_with_changes) { DCHECK(CalledOnValidThread()); if (!event_handler_.IsInitialized()) { return; @@ -94,7 +94,7 @@ void JsMutationEventObserver::OnTransactionWrite( details.Set("writeTransactionInfo", write_transaction_info.Get().ToValue(kChangeLimit)); details.Set("modelsWithChanges", - syncable::ModelTypeSetToValue(models_with_changes)); + syncer::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 18f6e32..858c05f 100644 --- a/sync/internal_api/js_mutation_event_observer.h +++ b/sync/internal_api/js_mutation_event_observer.h @@ -44,15 +44,15 @@ class JsMutationEventObserver // syncer::SyncManager::ChangeObserver implementation. virtual void OnChangesApplied( - syncable::ModelType model_type, + syncer::ModelType model_type, int64 write_transaction_id, const syncer::ImmutableChangeRecordList& changes) OVERRIDE; - virtual void OnChangesComplete(syncable::ModelType model_type) OVERRIDE; + virtual void OnChangesComplete(syncer::ModelType model_type) OVERRIDE; // syncable::TransactionObserver implementation. virtual void OnTransactionWrite( const syncable::ImmutableWriteTransactionInfo& write_transaction_info, - syncable::ModelTypeSet models_with_changes) OVERRIDE; + syncer::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 d13218a..a7eb824 100644 --- a/sync/internal_api/js_mutation_event_observer_unittest.cc +++ b/sync/internal_api/js_mutation_event_observer_unittest.cc @@ -46,9 +46,8 @@ TEST_F(JsMutationEventObserverTest, OnChangesApplied) { // We don't test with passwords as that requires additional setup. // Build a list of example ChangeRecords. - syncer::ChangeRecord changes[syncable::MODEL_TYPE_COUNT]; - for (int i = syncable::AUTOFILL_PROFILE; - i < syncable::MODEL_TYPE_COUNT; ++i) { + syncer::ChangeRecord changes[syncer::MODEL_TYPE_COUNT]; + for (int i = syncer::AUTOFILL_PROFILE; i < syncer::MODEL_TYPE_COUNT; ++i) { changes[i].id = i; switch (i % 3) { case 0: @@ -71,16 +70,15 @@ TEST_F(JsMutationEventObserverTest, OnChangesApplied) { // starting from changes[i]. // Set expectations for each data type. - for (int i = syncable::AUTOFILL_PROFILE; - i < syncable::MODEL_TYPE_COUNT; ++i) { + for (int i = syncer::AUTOFILL_PROFILE; i < syncer::MODEL_TYPE_COUNT; ++i) { const std::string& model_type_str = - syncable::ModelTypeToString(syncable::ModelTypeFromInt(i)); + syncer::ModelTypeToString(syncer::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 < syncable::MODEL_TYPE_COUNT; ++j) { + for (int j = i; j < syncer::MODEL_TYPE_COUNT; ++j) { expected_changes->Append(changes[j].ToValue()); } EXPECT_CALL(mock_js_event_handler_, @@ -89,12 +87,11 @@ TEST_F(JsMutationEventObserverTest, OnChangesApplied) { } // Fire OnChangesApplied() for each data type. - for (int i = syncable::AUTOFILL_PROFILE; - i < syncable::MODEL_TYPE_COUNT; ++i) { + for (int i = syncer::AUTOFILL_PROFILE; i < syncer::MODEL_TYPE_COUNT; ++i) { syncer::ChangeRecordList local_changes(changes + i, changes + arraysize(changes)); js_mutation_event_observer_.OnChangesApplied( - syncable::ModelTypeFromInt(i), + syncer::ModelTypeFromInt(i), 0, syncer::ImmutableChangeRecordList(&local_changes)); } @@ -104,21 +101,21 @@ TEST_F(JsMutationEventObserverTest, OnChangesApplied) { TEST_F(JsMutationEventObserverTest, OnChangesComplete) { InSequence dummy; - for (int i = syncable::FIRST_REAL_MODEL_TYPE; - i < syncable::MODEL_TYPE_COUNT; ++i) { + for (int i = syncer::FIRST_REAL_MODEL_TYPE; + i < syncer::MODEL_TYPE_COUNT; ++i) { DictionaryValue expected_details; expected_details.SetString( "modelType", - syncable::ModelTypeToString(syncable::ModelTypeFromInt(i))); + syncer::ModelTypeToString(syncer::ModelTypeFromInt(i))); EXPECT_CALL(mock_js_event_handler_, HandleJsEvent("onChangesComplete", HasDetailsAsDictionary(expected_details))); } - for (int i = syncable::FIRST_REAL_MODEL_TYPE; - i < syncable::MODEL_TYPE_COUNT; ++i) { + for (int i = syncer::FIRST_REAL_MODEL_TYPE; + i < syncer::MODEL_TYPE_COUNT; ++i) { js_mutation_event_observer_.OnChangesComplete( - syncable::ModelTypeFromInt(i)); + syncer::ModelTypeFromInt(i)); } PumpLoop(); } diff --git a/sync/internal_api/js_sync_manager_observer.cc b/sync/internal_api/js_sync_manager_observer.cc index 8a9889b..4bad2e0 100644 --- a/sync/internal_api/js_sync_manager_observer.cc +++ b/sync/internal_api/js_sync_manager_observer.cc @@ -92,14 +92,14 @@ void JsSyncManagerObserver::OnBootstrapTokenUpdated( } void JsSyncManagerObserver::OnEncryptedTypesChanged( - syncable::ModelTypeSet encrypted_types, + syncer::ModelTypeSet encrypted_types, bool encrypt_everything) { if (!event_handler_.IsInitialized()) { return; } DictionaryValue details; details.Set("encryptedTypes", - syncable::ModelTypeSetToValue(encrypted_types)); + syncer::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 918eab5..04eec48 100644 --- a/sync/internal_api/js_sync_manager_observer.h +++ b/sync/internal_api/js_sync_manager_observer.h @@ -44,7 +44,7 @@ class JsSyncManagerObserver : public syncer::SyncManager::Observer { virtual void OnBootstrapTokenUpdated( const std::string& bootstrap_token) OVERRIDE; virtual void OnEncryptedTypesChanged( - syncable::ModelTypeSet encrypted_types, + syncer::ModelTypeSet encrypted_types, bool encrypt_everything) OVERRIDE; virtual void OnEncryptionComplete() OVERRIDE; virtual void OnInitializationComplete( diff --git a/sync/internal_api/js_sync_manager_observer_unittest.cc b/sync/internal_api/js_sync_manager_observer_unittest.cc index f0b9e85..8861311 100644 --- a/sync/internal_api/js_sync_manager_observer_unittest.cc +++ b/sync/internal_api/js_sync_manager_observer_unittest.cc @@ -64,10 +64,10 @@ TEST_F(JsSyncManagerObserverTest, NoArgNotifiations) { } TEST_F(JsSyncManagerObserverTest, OnSyncCycleCompleted) { - syncable::ModelTypePayloadMap download_progress_markers; + syncer::ModelTypePayloadMap download_progress_markers; sessions::SyncSessionSnapshot snapshot(sessions::ModelNeutralState(), false, - syncable::ModelTypeSet(), + syncer::ModelTypeSet(), download_progress_markers, false, true, @@ -186,14 +186,14 @@ TEST_F(JsSyncManagerObserverTest, OnEncryptedTypesChanged) { const bool encrypt_everything = false; expected_details.Set("encryptedTypes", encrypted_type_values); expected_details.SetBoolean("encryptEverything", encrypt_everything); - syncable::ModelTypeSet encrypted_types; + syncer::ModelTypeSet encrypted_types; - for (int i = syncable::FIRST_REAL_MODEL_TYPE; - i < syncable::MODEL_TYPE_COUNT; ++i) { - syncable::ModelType type = syncable::ModelTypeFromInt(i); + for (int i = syncer::FIRST_REAL_MODEL_TYPE; + i < syncer::MODEL_TYPE_COUNT; ++i) { + syncer::ModelType type = syncer::ModelTypeFromInt(i); encrypted_types.Put(type); encrypted_type_values->Append(Value::CreateStringValue( - syncable::ModelTypeToString(type))); + syncer::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 77c2344..c8b1948 100644 --- a/sync/internal_api/public/base/model_type.h +++ b/sync/internal_api/public/base/model_type.h @@ -30,8 +30,6 @@ class SyncEntity; namespace syncer { -namespace syncable { - enum ModelType { // Object type unknown. Objects may transition through // the unknown state during their initial creation, before @@ -103,7 +101,7 @@ inline ModelType ModelTypeFromInt(int i) { return static_cast<ModelType>(i); } -void AddDefaultFieldValue(syncable::ModelType datatype, +void AddDefaultFieldValue(ModelType datatype, sync_pb::EntitySpecifics* specifics); // Extract the model type of a SyncEntity protocol buffer. ModelType is a @@ -172,56 +170,6 @@ bool NotificationTypeToRealModelType(const std::string& notification_type, // Returns true if |model_type| is a real datatype bool IsRealDataType(ModelType model_type); -} // namespace syncable - } // namespace syncer -// TODO(akalin): Move the names below to the 'syncer' namespace once -// we move this file to public/base. -namespace syncable { - -using syncer::syncable::ModelType; -using syncer::syncable::ModelTypeSet; -using syncer::syncable::FullModelTypeSet; -using syncer::syncable::UNSPECIFIED; -using syncer::syncable::TOP_LEVEL_FOLDER; -using syncer::syncable::BOOKMARKS; -using syncer::syncable::FIRST_REAL_MODEL_TYPE; -using syncer::syncable::PREFERENCES; -using syncer::syncable::PASSWORDS; -using syncer::syncable::AUTOFILL_PROFILE; -using syncer::syncable::AUTOFILL; -using syncer::syncable::THEMES; -using syncer::syncable::TYPED_URLS; -using syncer::syncable::EXTENSIONS; -using syncer::syncable::NIGORI; -using syncer::syncable::SEARCH_ENGINES; -using syncer::syncable::SESSIONS; -using syncer::syncable::APPS; -using syncer::syncable::APP_SETTINGS; -using syncer::syncable::EXTENSION_SETTINGS; -using syncer::syncable::APP_NOTIFICATIONS; -using syncer::syncable::LAST_REAL_MODEL_TYPE; -using syncer::syncable::MODEL_TYPE_COUNT; -using syncer::syncable::ModelTypeFromInt; -using syncer::syncable::AddDefaultFieldValue; -using syncer::syncable::GetModelType; -using syncer::syncable::GetModelTypeFromSpecifics; -using syncer::syncable::ShouldMaintainPosition; -using syncer::syncable::GetModelTypeFromSpecificsFieldNumber; -using syncer::syncable::GetSpecificsFieldNumberFromModelType; -using syncer::syncable::ModelTypeToString; -using syncer::syncable::ModelTypeToValue; -using syncer::syncable::ModelTypeFromValue; -using syncer::syncable::ModelTypeFromString; -using syncer::syncable::ModelTypeSetToString; -using syncer::syncable::ModelTypeSetToValue; -using syncer::syncable::ModelTypeSetFromValue; -using syncer::syncable::ModelTypeToRootTag; -using syncer::syncable::RealModelTypeToNotificationType; -using syncer::syncable::NotificationTypeToRealModelType; -using syncer::syncable::IsRealDataType; - -} // namespace syncable - #endif // SYNC_INTERNAL_API_PUBLIC_BASE_MODEL_TYPE_H_ 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 8fb458c..04222ee 100644 --- a/sync/internal_api/public/base/model_type_payload_map.cc +++ b/sync/internal_api/public/base/model_type_payload_map.cc @@ -12,13 +12,12 @@ #include "base/values.h" namespace syncer { -namespace syncable { ModelTypePayloadMap ModelTypePayloadMapFromEnumSet( - syncable::ModelTypeSet types, + syncer::ModelTypeSet types, const std::string& payload) { ModelTypePayloadMap types_with_payloads; - for (syncable::ModelTypeSet::Iterator it = types.First(); + for (syncer::ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) { types_with_payloads[it.Get()] = payload; } @@ -53,7 +52,7 @@ DictionaryValue* ModelTypePayloadMapToValue( std::string base64_marker; bool encoded = base::Base64Encode(it->second, &base64_marker); DCHECK(encoded); - value->SetString(syncable::ModelTypeToString(it->first), base64_marker); + value->SetString(syncer::ModelTypeToString(it->first), base64_marker); } return value; } @@ -74,6 +73,4 @@ void CoalescePayloads(ModelTypePayloadMap* original, } } -} // namespace syncable } // namespace syncer - diff --git a/sync/internal_api/public/base/model_type_payload_map.h b/sync/internal_api/public/base/model_type_payload_map.h index b95e152..da708f7 100644 --- a/sync/internal_api/public/base/model_type_payload_map.h +++ b/sync/internal_api/public/base/model_type_payload_map.h @@ -18,7 +18,6 @@ class DictionaryValue; } namespace syncer { -namespace syncable { // A container that contains a set of datatypes with possible string // payloads. @@ -46,20 +45,6 @@ base::DictionaryValue* ModelTypePayloadMapToValue( void CoalescePayloads(ModelTypePayloadMap* original, const ModelTypePayloadMap& update); -} // namespace syncable } // namespace syncer -// TODO(akalin): Move the names below to the 'syncer' namespace once -// we move this file to public/base. -namespace syncable { - -using ::syncer::syncable::ModelTypePayloadMap; -using ::syncer::syncable::ModelTypePayloadMapFromEnumSet; -using ::syncer::syncable::ModelTypePayloadMapToEnumSet; -using ::syncer::syncable::ModelTypePayloadMapToString; -using ::syncer::syncable::ModelTypePayloadMapToValue; -using ::syncer::syncable::CoalescePayloads; - -} // namespace syncable - #endif // SYNC_INTERNAL_PUBLIC_API_BASE_MODEL_TYPE_PAYLOAD_MAP_H_ 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 485048d..1a20867 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 @@ -13,7 +13,6 @@ #include "testing/gtest/include/gtest/gtest.h" namespace syncer { -namespace syncable { namespace { using base::ExpectDictStringValue; @@ -44,32 +43,31 @@ TEST_F(ModelTypePayloadMapTest, TypePayloadMapToValue) { } TEST_F(ModelTypePayloadMapTest, CoalescePayloads) { - syncable::ModelTypePayloadMap original; + syncer::ModelTypePayloadMap original; std::string empty_payload; std::string payload1 = "payload1"; std::string payload2 = "payload2"; std::string payload3 = "payload3"; - original[syncable::BOOKMARKS] = empty_payload; - original[syncable::PASSWORDS] = payload1; - original[syncable::AUTOFILL] = payload2; - original[syncable::THEMES] = payload3; + original[syncer::BOOKMARKS] = empty_payload; + original[syncer::PASSWORDS] = payload1; + original[syncer::AUTOFILL] = payload2; + original[syncer::THEMES] = payload3; - syncable::ModelTypePayloadMap update; - update[syncable::BOOKMARKS] = empty_payload; // Same. - update[syncable::PASSWORDS] = empty_payload; // Overwrite with empty. - update[syncable::AUTOFILL] = payload1; // Overwrite with non-empty. - update[syncable::SESSIONS] = payload2; // New. + 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. // Themes untouched. CoalescePayloads(&original, update); ASSERT_EQ(5U, original.size()); - EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]); - EXPECT_EQ(payload1, original[syncable::PASSWORDS]); - EXPECT_EQ(payload1, original[syncable::AUTOFILL]); - EXPECT_EQ(payload2, original[syncable::SESSIONS]); - EXPECT_EQ(payload3, original[syncable::THEMES]); + 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]); } } // namespace -} // namespace syncable } // namespace syncer diff --git a/sync/internal_api/public/base/model_type_test_util.cc b/sync/internal_api/public/base/model_type_test_util.cc index 5c07e8c..8c1164b 100644 --- a/sync/internal_api/public/base/model_type_test_util.cc +++ b/sync/internal_api/public/base/model_type_test_util.cc @@ -5,7 +5,6 @@ #include "sync/internal_api/public/base/model_type_test_util.h" namespace syncer { -namespace syncable { void PrintTo(ModelTypeSet model_types, ::std::ostream* os) { *os << ModelTypeSetToString(model_types); @@ -50,5 +49,4 @@ class HasModelTypesMatcher return ::testing::MakeMatcher(new HasModelTypesMatcher(expected_types)); } -} // namespace syncable } // namespace syncer diff --git a/sync/internal_api/public/base/model_type_test_util.h b/sync/internal_api/public/base/model_type_test_util.h index 4f5b804..0bac4b7 100644 --- a/sync/internal_api/public/base/model_type_test_util.h +++ b/sync/internal_api/public/base/model_type_test_util.h @@ -12,7 +12,6 @@ #include "testing/gmock/include/gmock/gmock.h" namespace syncer { -namespace syncable { // Defined for googletest. Forwards to ModelTypeSetToString(). void PrintTo(ModelTypeSet model_types, ::std::ostream* os); @@ -22,7 +21,6 @@ void PrintTo(ModelTypeSet model_types, ::std::ostream* os); // EXPECT_CALL(mock, ProcessModelTypes(HasModelTypes(expected_types))); ::testing::Matcher<ModelTypeSet> HasModelTypes(ModelTypeSet expected_types); -} // namespace syncable } // namespace syncer #endif // SYNC_INTERNAL_PUBLIC_API_BASE_MODEL_TYPE_TEST_UTIL_H_ diff --git a/sync/internal_api/public/base_node.h b/sync/internal_api/public/base_node.h index 7112d73..7212927 100644 --- a/sync/internal_api/public/base_node.h +++ b/sync/internal_api/public/base_node.h @@ -79,7 +79,7 @@ class BaseNode { // by doing a client tag lookup. Returns false on failure. A deleted node // will return FALSE. virtual InitByLookupResult InitByClientTagLookup( - syncable::ModelType model_type, + syncer::ModelType model_type, const std::string& tag) = 0; // Each object is identified by a 64-bit id (internally, the syncable @@ -107,7 +107,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. - syncable::ModelType GetModelType() const; + syncer::ModelType GetModelType() const; // Getter specific to the BOOKMARK datatype. Returns protobuf // data. Can only be called if GetModelType() == BOOKMARK. @@ -203,7 +203,7 @@ 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(syncable::ModelType model_type, + static std::string GenerateSyncableHash(syncer::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 09d8a58..7781692 100644 --- a/sync/internal_api/public/base_transaction.h +++ b/sync/internal_api/public/base_transaction.h @@ -46,8 +46,7 @@ class BaseTransaction { DISALLOW_COPY_AND_ASSIGN(BaseTransaction); }; -syncable::ModelTypeSet GetEncryptedTypes( - const syncer::BaseTransaction* trans); +syncer::ModelTypeSet GetEncryptedTypes(const syncer::BaseTransaction* trans); } // namespace syncer diff --git a/sync/internal_api/public/engine/model_safe_worker.cc b/sync/internal_api/public/engine/model_safe_worker.cc index f3722d4..7623cd3 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(syncable::ModelTypeToString(it->first), + dict->SetString(syncer::ModelTypeToString(it->first), ModelSafeGroupToString(it->second)); } return dict; @@ -29,10 +29,10 @@ std::string ModelSafeRoutingInfoToString( return json; } -syncable::ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( +syncer::ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( const ModelSafeRoutingInfo& routes, const std::string& payload) { - syncable::ModelTypePayloadMap types_with_payloads; + syncer::ModelTypePayloadMap types_with_payloads; for (ModelSafeRoutingInfo::const_iterator i = routes.begin(); i != routes.end(); ++i) { types_with_payloads[i->first] = payload; @@ -40,9 +40,9 @@ syncable::ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( return types_with_payloads; } -syncable::ModelTypeSet GetRoutingInfoTypes( +syncer::ModelTypeSet GetRoutingInfoTypes( const ModelSafeRoutingInfo& routing_info) { - syncable::ModelTypeSet types; + syncer::ModelTypeSet types; for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); it != routing_info.end(); ++it) { types.Put(it->first); @@ -50,11 +50,11 @@ syncable::ModelTypeSet GetRoutingInfoTypes( return types; } -ModelSafeGroup GetGroupForModelType(const syncable::ModelType type, +ModelSafeGroup GetGroupForModelType(const syncer::ModelType type, const ModelSafeRoutingInfo& routes) { ModelSafeRoutingInfo::const_iterator it = routes.find(type); if (it == routes.end()) { - if (type != syncable::UNSPECIFIED && type != syncable::TOP_LEVEL_FOLDER) + if (type != syncer::UNSPECIFIED && type != syncer::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 ce14c1d..5c9c7ae 100644 --- a/sync/internal_api/public/engine/model_safe_worker.h +++ b/sync/internal_api/public/engine/model_safe_worker.h @@ -64,10 +64,10 @@ class ModelSafeWorker : public base::RefCountedThreadSafe<ModelSafeWorker> { friend class base::RefCountedThreadSafe<ModelSafeWorker>; }; -// A map that details which ModelSafeGroup each syncable::ModelType +// A map that details which ModelSafeGroup each syncer::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<syncable::ModelType, ModelSafeGroup> +typedef std::map<syncer::ModelType, ModelSafeGroup> ModelSafeRoutingInfo; // Caller takes ownership of return value. @@ -79,14 +79,14 @@ std::string ModelSafeRoutingInfoToString( // Make a ModelTypePayloadMap for all the enabled types in a // ModelSafeRoutingInfo using a default payload. -syncable::ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( +syncer::ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( const ModelSafeRoutingInfo& routes, const std::string& payload); -syncable::ModelTypeSet GetRoutingInfoTypes( +syncer::ModelTypeSet GetRoutingInfoTypes( const ModelSafeRoutingInfo& routing_info); -ModelSafeGroup GetGroupForModelType(const syncable::ModelType type, +ModelSafeGroup GetGroupForModelType(const syncer::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 a25e0b1..b1036b5 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[syncable::BOOKMARKS] = GROUP_PASSIVE; - routing_info[syncable::NIGORI] = GROUP_UI; - routing_info[syncable::PREFERENCES] = GROUP_DB; + routing_info[syncer::BOOKMARKS] = GROUP_PASSIVE; + routing_info[syncer::NIGORI] = GROUP_UI; + routing_info[syncer::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[syncable::BOOKMARKS] = GROUP_PASSIVE; - routing_info[syncable::NIGORI] = GROUP_UI; - routing_info[syncable::PREFERENCES] = GROUP_DB; + routing_info[syncer::BOOKMARKS] = GROUP_PASSIVE; + routing_info[syncer::NIGORI] = GROUP_UI; + routing_info[syncer::PREFERENCES] = GROUP_DB; EXPECT_EQ( "{\"Bookmarks\":\"GROUP_PASSIVE\",\"Encryption keys\":\"GROUP_UI\"," "\"Preferences\":\"GROUP_DB\"}", @@ -41,23 +41,23 @@ TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToString) { TEST_F(ModelSafeWorkerTest, GetRoutingInfoTypes) { ModelSafeRoutingInfo routing_info; - routing_info[syncable::BOOKMARKS] = GROUP_PASSIVE; - routing_info[syncable::NIGORI] = GROUP_UI; - routing_info[syncable::PREFERENCES] = GROUP_DB; - const syncable::ModelTypeSet expected_types( - syncable::BOOKMARKS, - syncable::NIGORI, - syncable::PREFERENCES); + 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); EXPECT_TRUE(GetRoutingInfoTypes(routing_info).Equals(expected_types)); } TEST_F(ModelSafeWorkerTest, ModelSafeRoutingInfoToPayloadMap) { std::string payload = "test"; ModelSafeRoutingInfo routing_info; - routing_info[syncable::BOOKMARKS] = GROUP_PASSIVE; - routing_info[syncable::NIGORI] = GROUP_UI; - routing_info[syncable::PREFERENCES] = GROUP_DB; - syncable::ModelTypePayloadMap types_with_payloads = + routing_info[syncer::BOOKMARKS] = GROUP_PASSIVE; + routing_info[syncer::NIGORI] = GROUP_UI; + routing_info[syncer::PREFERENCES] = GROUP_DB; + syncer::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 c9cff52..5e330ac 100644 --- a/sync/internal_api/public/engine/sync_status.h +++ b/sync/internal_api/public/engine/sync_status.h @@ -80,12 +80,12 @@ struct SyncStatus { int useful_sync_cycles; // Encryption related. - syncable::ModelTypeSet encrypted_types; + syncer::ModelTypeSet encrypted_types; bool cryptographer_ready; bool crypto_has_pending_keys; // Per-datatype throttled status. - syncable::ModelTypeSet throttled_types; + syncer::ModelTypeSet throttled_types; // The unique identifer for this client. std::string unique_id; diff --git a/sync/internal_api/public/read_node.h b/sync/internal_api/public/read_node.h index c3947a7..f253fc3 100644 --- a/sync/internal_api/public/read_node.h +++ b/sync/internal_api/public/read_node.h @@ -30,7 +30,7 @@ class ReadNode : public BaseNode { // BaseNode implementation. virtual InitByLookupResult InitByIdLookup(int64 id) OVERRIDE; virtual InitByLookupResult InitByClientTagLookup( - syncable::ModelType model_type, + syncer::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 fa127b0..d9d53ab 100644 --- a/sync/internal_api/public/sessions/model_neutral_state.h +++ b/sync/internal_api/public/sessions/model_neutral_state.h @@ -24,7 +24,7 @@ struct ModelNeutralState { // We GetUpdates for some combination of types at once. // requested_update_types stores the set of types which were requested. - syncable::ModelTypeSet updates_request_types; + syncer::ModelTypeSet updates_request_types; sync_pb::ClientToServerResponse updates_response; @@ -40,7 +40,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. - syncable::ModelTypeSet types_needing_local_migration; + syncer::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 4427236..4d966dee 100644 --- a/sync/internal_api/public/sessions/sync_session_snapshot.cc +++ b/sync/internal_api/public/sessions/sync_session_snapshot.cc @@ -27,8 +27,8 @@ SyncSessionSnapshot::SyncSessionSnapshot() SyncSessionSnapshot::SyncSessionSnapshot( const ModelNeutralState& model_neutral_state, bool is_share_usable, - syncable::ModelTypeSet initial_sync_ended, - const syncable::ModelTypePayloadMap& download_progress_markers, + syncer::ModelTypeSet initial_sync_ended, + const syncer::ModelTypePayloadMap& download_progress_markers, bool more_to_sync, bool is_silenced, int num_encryption_conflicts, @@ -80,9 +80,9 @@ DictionaryValue* SyncSessionSnapshot::ToValue() const { static_cast<int>(model_neutral_state_.num_server_changes_remaining)); value->SetBoolean("isShareUsable", is_share_usable_); value->Set("initialSyncEnded", - syncable::ModelTypeSetToValue(initial_sync_ended_)); + syncer::ModelTypeSetToValue(initial_sync_ended_)); value->Set("downloadProgressMarkers", - syncable::ModelTypePayloadMapToValue(download_progress_markers_)); + syncer::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. @@ -117,11 +117,11 @@ bool SyncSessionSnapshot::is_share_usable() const { return is_share_usable_; } -syncable::ModelTypeSet SyncSessionSnapshot::initial_sync_ended() const { +syncer::ModelTypeSet SyncSessionSnapshot::initial_sync_ended() const { return initial_sync_ended_; } -syncable::ModelTypePayloadMap +syncer::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 2363878..7c88753 100644 --- a/sync/internal_api/public/sessions/sync_session_snapshot.h +++ b/sync/internal_api/public/sessions/sync_session_snapshot.h @@ -33,8 +33,8 @@ class SyncSessionSnapshot { SyncSessionSnapshot( const ModelNeutralState& model_neutral_state, bool is_share_usable, - syncable::ModelTypeSet initial_sync_ended, - const syncable::ModelTypePayloadMap& download_progress_markers, + syncer::ModelTypeSet initial_sync_ended, + const syncer::ModelTypePayloadMap& download_progress_markers, bool more_to_sync, bool is_silenced, int num_encryption_conflicts, @@ -58,8 +58,8 @@ class SyncSessionSnapshot { } int64 num_server_changes_remaining() const; bool is_share_usable() const; - syncable::ModelTypeSet initial_sync_ended() const; - syncable::ModelTypePayloadMap download_progress_markers() const; + syncer::ModelTypeSet initial_sync_ended() const; + syncer::ModelTypePayloadMap download_progress_markers() const; bool has_more_to_sync() const; bool is_silenced() const; int num_encryption_conflicts() const; @@ -75,8 +75,8 @@ class SyncSessionSnapshot { private: ModelNeutralState model_neutral_state_; bool is_share_usable_; - syncable::ModelTypeSet initial_sync_ended_; - syncable::ModelTypePayloadMap download_progress_markers_; + syncer::ModelTypeSet initial_sync_ended_; + syncer::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 e4536ee..e133f08 100644 --- a/sync/internal_api/public/sessions/sync_source_info.cc +++ b/sync/internal_api/public/sessions/sync_source_info.cc @@ -13,13 +13,12 @@ namespace sessions { SyncSourceInfo::SyncSourceInfo() : updates_source(sync_pb::GetUpdatesCallerInfo::UNKNOWN) {} -SyncSourceInfo::SyncSourceInfo( - const syncable::ModelTypePayloadMap& t) +SyncSourceInfo::SyncSourceInfo(const syncer::ModelTypePayloadMap& t) : updates_source(sync_pb::GetUpdatesCallerInfo::UNKNOWN), types(t) {} SyncSourceInfo::SyncSourceInfo( const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& u, - const syncable::ModelTypePayloadMap& t) + const syncer::ModelTypePayloadMap& t) : updates_source(u), types(t) {} SyncSourceInfo::~SyncSourceInfo() {} @@ -28,7 +27,7 @@ DictionaryValue* SyncSourceInfo::ToValue() const { DictionaryValue* value = new DictionaryValue(); value->SetString("updatesSource", GetUpdatesSourceString(updates_source)); - value->Set("types", syncable::ModelTypePayloadMapToValue(types)); + value->Set("types", syncer::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 6505411..812afb7 100644 --- a/sync/internal_api/public/sessions/sync_source_info.h +++ b/sync/internal_api/public/sessions/sync_source_info.h @@ -23,17 +23,17 @@ namespace sessions { // specific payloads which should be sent to the server. struct SyncSourceInfo { SyncSourceInfo(); - explicit SyncSourceInfo(const syncable::ModelTypePayloadMap& t); + explicit SyncSourceInfo(const syncer::ModelTypePayloadMap& t); SyncSourceInfo( const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& u, - const syncable::ModelTypePayloadMap& t); + const syncer::ModelTypePayloadMap& t); ~SyncSourceInfo(); // Caller takes ownership of the returned dictionary. base::DictionaryValue* ToValue() const; sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source; - syncable::ModelTypePayloadMap types; + syncer::ModelTypePayloadMap types; }; } // namespace sessions diff --git a/sync/internal_api/public/sync_manager.h b/sync/internal_api/public/sync_manager.h index 8c196a1..75e55aa 100644 --- a/sync/internal_api/public/sync_manager.h +++ b/sync/internal_api/public/sync_manager.h @@ -122,7 +122,7 @@ class SyncManager { // operations, a delete may temporarily orphan a node that is // updated later in the list. virtual void OnChangesApplied( - syncable::ModelType model_type, + syncer::ModelType model_type, const BaseTransaction* trans, const ImmutableChangeRecordList& changes) = 0; @@ -137,7 +137,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(syncable::ModelType model_type) = 0; + virtual void OnChangesComplete(syncer::ModelType model_type) = 0; protected: virtual ~ChangeDelegate(); @@ -165,11 +165,11 @@ class SyncManager { // be able to apply changes without being under a transaction. // But that's a ways off... virtual void OnChangesApplied( - syncable::ModelType model_type, + syncer::ModelType model_type, int64 write_transaction_id, const ImmutableChangeRecordList& changes) = 0; - virtual void OnChangesComplete(syncable::ModelType model_type) = 0; + virtual void OnChangesComplete(syncer::ModelType model_type) = 0; protected: virtual ~ChangeObserver(); @@ -324,7 +324,7 @@ class SyncManager { // // Called from within a transaction. virtual void OnEncryptedTypesChanged( - syncable::ModelTypeSet encrypted_types, + syncer::ModelTypeSet encrypted_types, bool encrypt_everything) = 0; // Called after we finish encrypting the current set of encrypted @@ -399,13 +399,13 @@ class SyncManager { void ThrowUnrecoverableError(); // Returns the set of types for which we have stored some sync data. - syncable::ModelTypeSet InitialSyncEndedTypes(); + syncer::ModelTypeSet InitialSyncEndedTypes(); // Update tokens that we're using in Sync. Email must stay the same. void UpdateCredentials(const SyncCredentials& credentials); // Called when the user disables or enables a sync type. - void UpdateEnabledTypes(const syncable::ModelTypeSet& enabled_types); + void UpdateEnabledTypes(const syncer::ModelTypeSet& enabled_types); // Put the syncer in normal mode ready to perform nudges and polls. void StartSyncingNormally( @@ -437,7 +437,7 @@ class SyncManager { // Switches the mode of operation to CONFIGURATION_MODE and // schedules a config task to fetch updates for |types|. void RequestConfig(const syncer::ModelSafeRoutingInfo& routing_info, - const syncable::ModelTypeSet& types, + const syncer::ModelTypeSet& types, syncer::ConfigureReason reason); void RequestCleanupDisabledTypes( @@ -511,7 +511,7 @@ class SyncManager { // Gets the set of encrypted types from the cryptographer // Note: opens a transaction. May be called from any thread. - syncable::ModelTypeSet GetEncryptedDataTypesForTest() const; + syncer::ModelTypeSet GetEncryptedDataTypesForTest() const; // Reads the nigori node to determine if any experimental features should // be enabled. @@ -529,7 +529,7 @@ class SyncManager { void SimulateDisableNotificationsForTest(int reason); void TriggerOnIncomingNotificationForTest( - syncable::ModelTypeSet model_types); + syncer::ModelTypeSet model_types); static const int kDefaultNudgeDelayMilliseconds; static const int kPreferencesNudgeDelayMilliseconds; @@ -541,7 +541,7 @@ class SyncManager { FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, NudgeDelayTest); // For unit tests. - base::TimeDelta GetNudgeDelayTimeDelta(const syncable::ModelType& model_type); + base::TimeDelta GetNudgeDelayTimeDelta(const syncer::ModelType& model_type); base::ThreadChecker thread_checker_; @@ -551,10 +551,10 @@ class SyncManager { DISALLOW_COPY_AND_ASSIGN(SyncManager); }; -bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, UserShare* share); +bool InitialSyncEndedForTypes(syncer::ModelTypeSet types, UserShare* share); -syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( - syncable::ModelTypeSet types, +syncer::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( + syncer::ModelTypeSet types, syncer::UserShare* share); const char* ConnectionStatusToString(ConnectionStatus status); diff --git a/sync/internal_api/public/test/test_entry_factory.h b/sync/internal_api/public/test/test_entry_factory.h index bcf5316..931b8e7 100644 --- a/sync/internal_api/public/test/test_entry_factory.h +++ b/sync/internal_api/public/test/test_entry_factory.h @@ -42,18 +42,18 @@ class TestEntryFactory { const syncable::Id& parent_id, const std::string& name, bool is_folder, - syncable::ModelType model_type, + syncer::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, - syncable::ModelType model_type); + syncer::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, syncable::ModelType + int64 CreateSyncedItem(const std::string& name, syncer::ModelType model_type, bool is_folder); int64 GetNextRevision(); diff --git a/sync/internal_api/public/write_node.h b/sync/internal_api/public/write_node.h index 29182de..2965741 100644 --- a/sync/internal_api/public/write_node.h +++ b/sync/internal_api/public/write_node.h @@ -65,7 +65,7 @@ class WriteNode : public BaseNode { // BaseNode implementation. virtual InitByLookupResult InitByIdLookup(int64 id) OVERRIDE; virtual InitByLookupResult InitByClientTagLookup( - syncable::ModelType model_type, + syncer::ModelType model_type, const std::string& tag) OVERRIDE; // Create a new node with the specified parent and predecessor. |model_type| @@ -74,7 +74,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(syncable::ModelType model_type, + bool InitByCreation(syncer::ModelType model_type, const BaseNode& parent, const BaseNode* predecessor); @@ -85,7 +85,7 @@ class WriteNode : public BaseNode { // actually undelete it // Client unique tagged nodes must NOT be folders. InitUniqueByCreationResult InitUniqueByCreation( - syncable::ModelType model_type, + syncer::ModelType model_type, const BaseNode& parent, const std::string& client_tag); @@ -178,7 +178,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(syncable::ModelType model_type); + void PutModelType(syncer::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 6f7fc35..9f31781 100644 --- a/sync/internal_api/read_node.cc +++ b/sync/internal_api/read_node.cc @@ -44,15 +44,15 @@ BaseNode::InitByLookupResult ReadNode::InitByIdLookup(int64 id) { return INIT_FAILED_ENTRY_NOT_GOOD; if (entry_->Get(syncable::IS_DEL)) return INIT_FAILED_ENTRY_IS_DEL; - syncable::ModelType model_type = GetModelType(); - LOG_IF(WARNING, model_type == syncable::UNSPECIFIED || - model_type == syncable::TOP_LEVEL_FOLDER) + syncer::ModelType model_type = GetModelType(); + LOG_IF(WARNING, model_type == syncer::UNSPECIFIED || + model_type == syncer::TOP_LEVEL_FOLDER) << "SyncAPI InitByIdLookup referencing unusual object."; return DecryptIfNecessary() ? INIT_OK : INIT_FAILED_DECRYPT_IF_NECESSARY; } BaseNode::InitByLookupResult ReadNode::InitByClientTagLookup( - syncable::ModelType model_type, + syncer::ModelType model_type, const std::string& tag) { DCHECK(!entry_) << "Init called twice"; if (tag.empty()) @@ -88,9 +88,9 @@ BaseNode::InitByLookupResult ReadNode::InitByTagLookup( return INIT_FAILED_ENTRY_NOT_GOOD; if (entry_->Get(syncable::IS_DEL)) return INIT_FAILED_ENTRY_IS_DEL; - syncable::ModelType model_type = GetModelType(); - LOG_IF(WARNING, model_type == syncable::UNSPECIFIED || - model_type == syncable::TOP_LEVEL_FOLDER) + syncer::ModelType model_type = GetModelType(); + LOG_IF(WARNING, model_type == syncer::UNSPECIFIED || + model_type == syncer::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.cc b/sync/internal_api/sync_manager.cc index 2d0645d..c8a293e 100644 --- a/sync/internal_api/sync_manager.cc +++ b/sync/internal_api/sync_manager.cc @@ -98,8 +98,6 @@ namespace syncer { using sessions::SyncSessionContext; using syncable::ImmutableWriteTransactionInfo; -using syncable::ModelType; -using syncable::ModelTypeSet; using syncable::SPECIFICS; const int SyncManager::kDefaultNudgeDelayMilliseconds = 200; @@ -135,10 +133,10 @@ class SyncManager::SyncInternal created_on_loop_(MessageLoop::current()), nigori_overwrite_count_(0) { // Pre-fill |notification_info_map_|. - for (int i = syncable::FIRST_REAL_MODEL_TYPE; - i < syncable::MODEL_TYPE_COUNT; ++i) { + for (int i = syncer::FIRST_REAL_MODEL_TYPE; + i < syncer::MODEL_TYPE_COUNT; ++i) { notification_info_map_.insert( - std::make_pair(syncable::ModelTypeFromInt(i), NotificationInfo())); + std::make_pair(syncer::ModelTypeFromInt(i), NotificationInfo())); } // Bind message handlers. @@ -297,7 +295,7 @@ class SyncManager::SyncInternal // Cryptographer::Observer implementation. virtual void OnEncryptedTypesChanged( - syncable::ModelTypeSet encrypted_types, + syncer::ModelTypeSet encrypted_types, bool encrypt_everything) OVERRIDE; // SyncNotifierObserver implementation. @@ -305,7 +303,7 @@ class SyncManager::SyncInternal virtual void OnNotificationsDisabled( syncer::NotificationsDisabledReason reason) OVERRIDE; virtual void OnIncomingNotification( - const syncable::ModelTypePayloadMap& type_payloads, + const syncer::ModelTypePayloadMap& type_payloads, syncer::IncomingNotificationSource source) OVERRIDE; void AddObserver(SyncManager::Observer* observer); @@ -349,7 +347,7 @@ class SyncManager::SyncInternal // ExtraPasswordChangeRecordData field of |buffer|. Otherwise sets // |buffer|'s specifics field to contain the unencrypted data. void SetExtraChangeRecordData(int64 id, - syncable::ModelType type, + syncer::ModelType type, ChangeReorderBuffer* buffer, Cryptographer* cryptographer, const syncable::EntryKernel& original, @@ -359,7 +357,7 @@ class SyncManager::SyncInternal // Called only by our NetworkChangeNotifier. virtual void OnIPAddressChanged() OVERRIDE; - syncable::ModelTypeSet InitialSyncEndedTypes() { + syncer::ModelTypeSet InitialSyncEndedTypes() { DCHECK(initialized_); return directory()->initial_sync_ended_types(); } @@ -396,7 +394,7 @@ class SyncManager::SyncInternal } }; - typedef std::map<syncable::ModelType, NotificationInfo> NotificationInfoMap; + typedef std::map<syncer::ModelType, NotificationInfo> NotificationInfoMap; typedef JsArgList (SyncManager::SyncInternal::*UnboundJsMessageHandler)(const JsArgList&); typedef base::Callback<JsArgList(const JsArgList&)> JsMessageHandler; @@ -421,7 +419,7 @@ class SyncManager::SyncInternal // 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( - syncable::GetModelTypeFromSpecifics(b.ref(SPECIFICS)))) + syncer::GetModelTypeFromSpecifics(b.ref(SPECIFICS)))) return false; if (a.ref(syncable::NEXT_ID) != b.ref(syncable::NEXT_ID)) return true; @@ -440,12 +438,12 @@ class SyncManager::SyncInternal 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(syncable::GetModelTypeFromSpecifics(a_specifics), - syncable::GetModelTypeFromSpecifics(b_specifics)); - syncable::ModelType model_type = - syncable::GetModelTypeFromSpecifics(b_specifics); + DCHECK_EQ(syncer::GetModelTypeFromSpecifics(a_specifics), + syncer::GetModelTypeFromSpecifics(b_specifics)); + syncer::ModelType model_type = + syncer::GetModelTypeFromSpecifics(b_specifics); // Suppress updates to items that aren't tracked by any browser model. - if (model_type < syncable::FIRST_REAL_MODEL_TYPE || + if (model_type < syncer::FIRST_REAL_MODEL_TYPE || !a.ref(syncable::UNIQUE_SERVER_TAG).empty()) { return false; } @@ -467,7 +465,7 @@ class SyncManager::SyncInternal } bool ChangeBuffersAreEmpty() { - for (int i = 0; i < syncable::MODEL_TYPE_COUNT; ++i) { + for (int i = 0; i < syncer::MODEL_TYPE_COUNT; ++i) { if (!change_buffers_[i].IsEmpty()) return false; } @@ -479,7 +477,7 @@ class SyncManager::SyncInternal // Called for every notification. This updates the notification statistics // to be displayed in about:sync. void UpdateNotificationInfo( - const syncable::ModelTypePayloadMap& type_payloads); + const syncer::ModelTypePayloadMap& type_payloads); // Checks for server reachabilty and requests a nudge. void OnIPAddressChangedImpl(); @@ -560,7 +558,7 @@ class SyncManager::SyncInternal // 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_[syncable::MODEL_TYPE_COUNT]; + ChangeReorderBuffer change_buffers_[syncer::MODEL_TYPE_COUNT]; SyncManager::ChangeDelegate* change_delegate_; @@ -633,10 +631,10 @@ class NudgeStrategy { static NudgeDelayStrategy GetNudgeDelayStrategy(const ModelType& type) { switch (type) { - case syncable::AUTOFILL: + case syncer::AUTOFILL: return ACCOMPANY_ONLY; - case syncable::PREFERENCES: - case syncable::SESSIONS: + case syncer::PREFERENCES: + case syncer::SESSIONS: return CUSTOM; default: return IMMEDIATE; @@ -660,11 +658,11 @@ class NudgeStrategy { break; case CUSTOM: switch (model_type) { - case syncable::PREFERENCES: + case syncer::PREFERENCES: delay = TimeDelta::FromMilliseconds( SyncManager::kPreferencesNudgeDelayMilliseconds); break; - case syncable::SESSIONS: + case syncer::SESSIONS: delay = core->scheduler()->sessions_commit_delay(); break; default: @@ -747,7 +745,7 @@ void SyncManager::ThrowUnrecoverableError() { FROM_HERE, "Simulating unrecoverable error for testing purposes."); } -syncable::ModelTypeSet SyncManager::InitialSyncEndedTypes() { +syncer::ModelTypeSet SyncManager::InitialSyncEndedTypes() { return data_->InitialSyncEndedTypes(); } @@ -1013,7 +1011,7 @@ void SyncManager::SyncInternal::UpdateCryptographerAndNigoriCallback( const std::string& chrome_version, const base::Closure& done_callback, const std::string& session_name) { - if (!directory()->initial_sync_ended_for_type(syncable::NIGORI)) { + if (!directory()->initial_sync_ended_for_type(syncer::NIGORI)) { done_callback.Run(); // Should only happen during first time sync. return; } @@ -1553,15 +1551,14 @@ void SyncManager::SyncInternal::ReEncryptEverything(WriteTransaction* trans) { Cryptographer* cryptographer = trans->GetCryptographer(); if (!cryptographer || !cryptographer->is_ready()) return; - syncable::ModelTypeSet encrypted_types = GetEncryptedTypes(trans); - for (syncable::ModelTypeSet::Iterator iter = encrypted_types.First(); + syncer::ModelTypeSet encrypted_types = GetEncryptedTypes(trans); + for (syncer::ModelTypeSet::Iterator iter = encrypted_types.First(); iter.Good(); iter.Inc()) { - if (iter.Get() == syncable::PASSWORDS || - iter.Get() == syncable::NIGORI) + if (iter.Get() == syncer::PASSWORDS || iter.Get() == syncer::NIGORI) continue; // These types handle encryption differently. ReadNode type_root(trans); - std::string tag = syncable::ModelTypeToRootTag(iter.Get()); + std::string tag = syncer::ModelTypeToRootTag(iter.Get()); if (type_root.InitByTagLookup(tag) != syncer::BaseNode::INIT_OK) continue; // Don't try to reencrypt if the type's data is unavailable. @@ -1595,8 +1592,7 @@ void SyncManager::SyncInternal::ReEncryptEverything(WriteTransaction* trans) { // 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 = - syncable::ModelTypeToRootTag(syncable::PASSWORDS); + std::string passwords_tag = syncer::ModelTypeToRootTag(syncer::PASSWORDS); if (passwords_root.InitByTagLookup(passwords_tag) == syncer::BaseNode::INIT_OK) { int64 child_id = passwords_root.GetFirstChildId(); @@ -1774,9 +1770,9 @@ ModelTypeSet ReadTransaction read_trans(GetUserShare(), trans); ModelTypeSet models_with_changes; - for (int i = syncable::FIRST_REAL_MODEL_TYPE; - i < syncable::MODEL_TYPE_COUNT; ++i) { - const syncable::ModelType type = syncable::ModelTypeFromInt(i); + for (int i = syncer::FIRST_REAL_MODEL_TYPE; + i < syncer::MODEL_TYPE_COUNT; ++i) { + const syncer::ModelType type = syncer::ModelTypeFromInt(i); if (change_buffers_[type].IsEmpty()) continue; @@ -1810,7 +1806,7 @@ void SyncManager::SyncInternal::HandleCalculateChangesChangeEventFromSyncApi( "CALCULATE_CHANGES called with unapplied old changes."; // The mutated model type, or UNSPECIFIED if nothing was mutated. - syncable::ModelTypeSet mutated_model_types; + syncer::ModelTypeSet mutated_model_types; const syncable::ImmutableEntryKernelMutationMap& mutations = write_transaction_info.Get().mutations; @@ -1820,16 +1816,16 @@ void SyncManager::SyncInternal::HandleCalculateChangesChangeEventFromSyncApi( continue; } - syncable::ModelType model_type = - syncable::GetModelTypeFromSpecifics( + syncer::ModelType model_type = + syncer::GetModelTypeFromSpecifics( it->second.mutated.ref(SPECIFICS)); - if (model_type < syncable::FIRST_REAL_MODEL_TYPE) { + if (model_type < syncer::FIRST_REAL_MODEL_TYPE) { NOTREACHED() << "Permanent or underspecified item changed via syncapi."; continue; } // Found real mutation. - if (model_type != syncable::UNSPECIFIED) { + if (model_type != syncer::UNSPECIFIED) { mutated_model_types.Put(model_type); } } @@ -1848,14 +1844,14 @@ void SyncManager::SyncInternal::HandleCalculateChangesChangeEventFromSyncApi( } void SyncManager::SyncInternal::SetExtraChangeRecordData(int64 id, - syncable::ModelType type, ChangeReorderBuffer* buffer, + syncer::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 == syncable::PASSWORDS) { + if (type == syncer::PASSWORDS) { // Passwords must use their own legacy ExtraPasswordChangeRecordData. scoped_ptr<sync_pb::PasswordSpecificsData> data( DecryptPasswordSpecifics(original_specifics, cryptographer)); @@ -1894,10 +1890,10 @@ void SyncManager::SyncInternal::HandleCalculateChangesChangeEventFromSyncer( bool exists_now = !it->second.mutated.ref(syncable::IS_DEL); // Omit items that aren't associated with a model. - syncable::ModelType type = - syncable::GetModelTypeFromSpecifics( + syncer::ModelType type = + syncer::GetModelTypeFromSpecifics( it->second.mutated.ref(SPECIFICS)); - if (type < syncable::FIRST_REAL_MODEL_TYPE) + if (type < syncer::FIRST_REAL_MODEL_TYPE) continue; int64 handle = it->first; @@ -1979,7 +1975,7 @@ void SyncManager::SyncInternal::OnSyncEngineEvent( OnPassphraseRequired(syncer::REASON_DECRYPTION, pending_keys)); } else if (!cryptographer->is_ready() && - event.snapshot.initial_sync_ended().Has(syncable::NIGORI)) { + event.snapshot.initial_sync_ended().Has(syncer::NIGORI)) { DVLOG(1) << "OnPassphraseRequired sent because cryptographer is not " << "ready"; FOR_EACH_OBSERVER(SyncManager::Observer, observers_, @@ -2022,7 +2018,7 @@ void SyncManager::SyncInternal::OnSyncEngineEvent( if (is_notifiable_commit) { if (sync_notifier_.get()) { const ModelTypeSet changed_types = - syncable::ModelTypePayloadMapToEnumSet( + syncer::ModelTypePayloadMapToEnumSet( event.snapshot.source().types); sync_notifier_->SendNotification(changed_types); } else { @@ -2100,7 +2096,7 @@ DictionaryValue* SyncManager::SyncInternal::NotificationInfoToValue( for (NotificationInfoMap::const_iterator it = notification_info.begin(); it != notification_info.end(); ++it) { const std::string& model_type_str = - syncable::ModelTypeToString(it->first); + syncer::ModelTypeToString(it->first); value->Set(model_type_str, it->second.ToValue()); } @@ -2233,7 +2229,7 @@ JsArgList SyncManager::SyncInternal::GetChildNodeIds( } void SyncManager::SyncInternal::OnEncryptedTypesChanged( - syncable::ModelTypeSet encrypted_types, + syncer::ModelTypeSet encrypted_types, bool encrypt_everything) { // NOTE: We're in a transaction. FOR_EACH_OBSERVER( @@ -2242,8 +2238,8 @@ void SyncManager::SyncInternal::OnEncryptedTypesChanged( } void SyncManager::SyncInternal::UpdateNotificationInfo( - const syncable::ModelTypePayloadMap& type_payloads) { - for (syncable::ModelTypePayloadMap::const_iterator it = type_payloads.begin(); + const syncer::ModelTypePayloadMap& type_payloads) { + for (syncer::ModelTypePayloadMap::const_iterator it = type_payloads.begin(); it != type_payloads.end(); ++it) { NotificationInfo* info = ¬ification_info_map_[it->first]; info->total_count++; @@ -2290,7 +2286,7 @@ void SyncManager::SyncInternal::OnNotificationsDisabled( } void SyncManager::SyncInternal::OnIncomingNotification( - const syncable::ModelTypePayloadMap& type_payloads, + const syncer::ModelTypePayloadMap& type_payloads, syncer::IncomingNotificationSource source) { DCHECK(thread_checker_.CalledOnValidThread()); if (source == syncer::LOCAL_NOTIFICATION) { @@ -2318,11 +2314,11 @@ void SyncManager::SyncInternal::OnIncomingNotification( DictionaryValue details; ListValue* changed_types = new ListValue(); details.Set("changedTypes", changed_types); - for (syncable::ModelTypePayloadMap::const_iterator + for (syncer::ModelTypePayloadMap::const_iterator it = type_payloads.begin(); it != type_payloads.end(); ++it) { const std::string& model_type_str = - syncable::ModelTypeToString(it->first); + syncer::ModelTypeToString(it->first); changed_types->Append(Value::CreateStringValue(model_type_str)); } details.SetString("source", (source == syncer::LOCAL_NOTIFICATION) ? @@ -2374,7 +2370,7 @@ TimeDelta SyncManager::GetNudgeDelayTimeDelta( return data_->GetNudgeDelayTimeDelta(model_type); } -syncable::ModelTypeSet SyncManager::GetEncryptedDataTypesForTest() const { +syncer::ModelTypeSet SyncManager::GetEncryptedDataTypesForTest() const { ReadTransaction trans(FROM_HERE, GetUserShare()); return GetEncryptedTypes(&trans); } @@ -2414,8 +2410,8 @@ void SyncManager::SimulateDisableNotificationsForTest(int reason) { void SyncManager::TriggerOnIncomingNotificationForTest( ModelTypeSet model_types) { DCHECK(thread_checker_.CalledOnValidThread()); - syncable::ModelTypePayloadMap model_types_with_payloads = - syncable::ModelTypePayloadMapFromEnumSet(model_types, + syncer::ModelTypePayloadMap model_types_with_payloads = + syncer::ModelTypePayloadMapFromEnumSet(model_types, std::string()); data_->OnIncomingNotification(model_types_with_payloads, @@ -2453,9 +2449,9 @@ const char* PassphraseRequiredReasonToString( } // Helper function to determine if initial sync had ended for types. -bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, +bool InitialSyncEndedForTypes(syncer::ModelTypeSet types, syncer::UserShare* share) { - for (syncable::ModelTypeSet::Iterator i = types.First(); + for (syncer::ModelTypeSet::Iterator i = types.First(); i.Good(); i.Inc()) { if (!share->directory->initial_sync_ended_for_type(i.Get())) return false; @@ -2463,11 +2459,11 @@ bool InitialSyncEndedForTypes(syncable::ModelTypeSet types, return true; } -syncable::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( - syncable::ModelTypeSet types, +syncer::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( + syncer::ModelTypeSet types, syncer::UserShare* share) { - syncable::ModelTypeSet result; - for (syncable::ModelTypeSet::Iterator i = types.First(); + syncer::ModelTypeSet result; + for (syncer::ModelTypeSet::Iterator i = types.First(); i.Good(); i.Inc()) { sync_pb::DataTypeProgressMarker marker; share->directory->GetDownloadProgress(i.Get(), &marker); diff --git a/sync/internal_api/syncapi_unittest.cc b/sync/internal_api/syncapi_unittest.cc index 43ae0d5..6fff8c5 100644 --- a/sync/internal_api/syncapi_unittest.cc +++ b/sync/internal_api/syncapi_unittest.cc @@ -81,8 +81,6 @@ using sessions::SyncSessionSnapshot; using syncable::IS_DEL; using syncable::IS_UNSYNCED; using syncable::kEncryptedString; -using syncable::ModelTypeSet; -using syncable::ModelType; using syncable::NON_UNIQUE_NAME; using syncable::SPECIFICS; @@ -162,11 +160,11 @@ int64 MakeFolderWithParent(UserShare* share, int64 MakeServerNodeForType(UserShare* share, ModelType model_type) { sync_pb::EntitySpecifics specifics; - syncable::AddDefaultFieldValue(model_type, &specifics); + syncer::AddDefaultFieldValue(model_type, &specifics); syncable::WriteTransaction trans( FROM_HERE, syncable::UNITTEST, share->directory.get()); // Attempt to lookup by nigori tag. - std::string type_tag = syncable::ModelTypeToRootTag(model_type); + std::string type_tag = syncer::ModelTypeToRootTag(model_type); syncable::Id node_id = syncable::Id::CreateFromServerId(type_tag); syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, node_id); @@ -193,7 +191,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, - syncable::ModelTypeToRootTag(model_type)); + syncer::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); @@ -259,13 +257,13 @@ TEST_F(SyncApiTest, BasicTagWrite) { } ignore_result(MakeNode(test_user_share_.user_share(), - syncable::BOOKMARKS, "testtag")); + syncer::BOOKMARKS, "testtag")); { ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::BOOKMARKS, "testtag")); + node.InitByClientTagLookup(syncer::BOOKMARKS, "testtag")); ReadNode root_node(&trans); root_node.InitByRootLookup(); @@ -276,18 +274,18 @@ TEST_F(SyncApiTest, BasicTagWrite) { TEST_F(SyncApiTest, GenerateSyncableHash) { EXPECT_EQ("OyaXV5mEzrPS4wbogmtKvRfekAI=", - BaseNode::GenerateSyncableHash(syncable::BOOKMARKS, "tag1")); + BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, "tag1")); EXPECT_EQ("iNFQtRFQb+IZcn1kKUJEZDDkLs4=", - BaseNode::GenerateSyncableHash(syncable::PREFERENCES, "tag1")); + BaseNode::GenerateSyncableHash(syncer::PREFERENCES, "tag1")); EXPECT_EQ("gO1cPZQXaM73sHOvSA+tKCKFs58=", - BaseNode::GenerateSyncableHash(syncable::AUTOFILL, "tag1")); + BaseNode::GenerateSyncableHash(syncer::AUTOFILL, "tag1")); EXPECT_EQ("A0eYIHXM1/jVwKDDp12Up20IkKY=", - BaseNode::GenerateSyncableHash(syncable::BOOKMARKS, "tag2")); + BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, "tag2")); EXPECT_EQ("XYxkF7bhS4eItStFgiOIAU23swI=", - BaseNode::GenerateSyncableHash(syncable::PREFERENCES, "tag2")); + BaseNode::GenerateSyncableHash(syncer::PREFERENCES, "tag2")); EXPECT_EQ("GFiWzo5NGhjLlN+OyCfhy28DJTQ=", - BaseNode::GenerateSyncableHash(syncable::AUTOFILL, "tag2")); + BaseNode::GenerateSyncableHash(syncer::AUTOFILL, "tag2")); } TEST_F(SyncApiTest, ModelTypesSiloed) { @@ -299,28 +297,28 @@ TEST_F(SyncApiTest, ModelTypesSiloed) { } ignore_result(MakeNode(test_user_share_.user_share(), - syncable::BOOKMARKS, "collideme")); + syncer::BOOKMARKS, "collideme")); ignore_result(MakeNode(test_user_share_.user_share(), - syncable::PREFERENCES, "collideme")); + syncer::PREFERENCES, "collideme")); ignore_result(MakeNode(test_user_share_.user_share(), - syncable::AUTOFILL, "collideme")); + syncer::AUTOFILL, "collideme")); { ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); ReadNode bookmarknode(&trans); EXPECT_EQ(BaseNode::INIT_OK, - bookmarknode.InitByClientTagLookup(syncable::BOOKMARKS, + bookmarknode.InitByClientTagLookup(syncer::BOOKMARKS, "collideme")); ReadNode prefnode(&trans); EXPECT_EQ(BaseNode::INIT_OK, - prefnode.InitByClientTagLookup(syncable::PREFERENCES, + prefnode.InitByClientTagLookup(syncer::PREFERENCES, "collideme")); ReadNode autofillnode(&trans); EXPECT_EQ(BaseNode::INIT_OK, - autofillnode.InitByClientTagLookup(syncable::AUTOFILL, + autofillnode.InitByClientTagLookup(syncer::AUTOFILL, "collideme")); EXPECT_NE(bookmarknode.GetId(), prefnode.GetId()); @@ -334,14 +332,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(syncable::BOOKMARKS, + node.InitByClientTagLookup(syncer::BOOKMARKS, "testtag")); } { WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_FAILED_ENTRY_NOT_GOOD, - node.InitByClientTagLookup(syncable::BOOKMARKS, + node.InitByClientTagLookup(syncer::BOOKMARKS, "testtag")); } } @@ -360,13 +358,13 @@ TEST_F(SyncApiTest, TestDeleteBehavior) { // we'll use this spare folder later WriteNode folder_node(&trans); - EXPECT_TRUE(folder_node.InitByCreation(syncable::BOOKMARKS, + EXPECT_TRUE(folder_node.InitByCreation(syncer::BOOKMARKS, root_node, NULL)); folder_id = folder_node.GetId(); WriteNode wnode(&trans); syncer::WriteNode::InitUniqueByCreationResult result = - wnode.InitUniqueByCreation(syncable::BOOKMARKS, root_node, "testtag"); + wnode.InitUniqueByCreation(syncer::BOOKMARKS, root_node, "testtag"); EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); wnode.SetIsFolder(false); wnode.SetTitle(UTF8ToWide(test_title)); @@ -379,7 +377,7 @@ TEST_F(SyncApiTest, TestDeleteBehavior) { WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); WriteNode wnode(&trans); EXPECT_EQ(BaseNode::INIT_OK, - wnode.InitByClientTagLookup(syncable::BOOKMARKS, + wnode.InitByClientTagLookup(syncer::BOOKMARKS, "testtag")); EXPECT_FALSE(wnode.GetIsFolder()); EXPECT_EQ(wnode.GetTitle(), test_title); @@ -393,7 +391,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(syncable::BOOKMARKS, + node.InitByClientTagLookup(syncer::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. @@ -408,7 +406,7 @@ TEST_F(SyncApiTest, TestDeleteBehavior) { WriteNode wnode(&trans); // This will undelete the tag. syncer::WriteNode::InitUniqueByCreationResult result = - wnode.InitUniqueByCreation(syncable::BOOKMARKS, folder_node, "testtag"); + wnode.InitUniqueByCreation(syncer::BOOKMARKS, folder_node, "testtag"); EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); EXPECT_EQ(wnode.GetIsFolder(), false); EXPECT_EQ(wnode.GetParentId(), folder_node.GetId()); @@ -422,10 +420,10 @@ TEST_F(SyncApiTest, TestDeleteBehavior) { ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::BOOKMARKS, + node.InitByClientTagLookup(syncer::BOOKMARKS, "testtag")); EXPECT_EQ(node.GetTitle(), test_title); - EXPECT_EQ(node.GetModelType(), syncable::BOOKMARKS); + EXPECT_EQ(node.GetModelType(), syncer::BOOKMARKS); } } @@ -442,7 +440,7 @@ TEST_F(SyncApiTest, WriteAndReadPassword) { WriteNode password_node(&trans); syncer::WriteNode::InitUniqueByCreationResult result = - password_node.InitUniqueByCreation(syncable::PASSWORDS, + password_node.InitUniqueByCreation(syncer::PASSWORDS, root_node, "foo"); EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); sync_pb::PasswordSpecificsData data; @@ -456,7 +454,7 @@ TEST_F(SyncApiTest, WriteAndReadPassword) { ReadNode password_node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - password_node.InitByClientTagLookup(syncable::PASSWORDS, + password_node.InitByClientTagLookup(syncer::PASSWORDS, "foo")); const sync_pb::PasswordSpecificsData& data = password_node.GetPasswordSpecifics(); @@ -478,14 +476,14 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) { WriteNode bookmark_node(&trans); syncer::WriteNode::InitUniqueByCreationResult result = - bookmark_node.InitUniqueByCreation(syncable::BOOKMARKS, + bookmark_node.InitUniqueByCreation(syncer::BOOKMARKS, root_node, "foo"); EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); bookmark_node.SetTitle(UTF8ToWide("foo")); WriteNode pref_node(&trans); result = - pref_node.InitUniqueByCreation(syncable::PREFERENCES, root_node, "bar"); + pref_node.InitUniqueByCreation(syncer::PREFERENCES, root_node, "bar"); EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); pref_node.SetTitle(UTF8ToWide("bar")); } @@ -496,7 +494,7 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) { ReadNode bookmark_node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - bookmark_node.InitByClientTagLookup(syncable::BOOKMARKS, + bookmark_node.InitByClientTagLookup(syncer::BOOKMARKS, "foo")); EXPECT_EQ("foo", bookmark_node.GetTitle()); EXPECT_EQ(kEncryptedString, @@ -504,7 +502,7 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) { ReadNode pref_node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - pref_node.InitByClientTagLookup(syncable::PREFERENCES, + pref_node.InitByClientTagLookup(syncer::PREFERENCES, "bar")); EXPECT_EQ(kEncryptedString, pref_node.GetTitle()); } @@ -512,7 +510,7 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) { TEST_F(SyncApiTest, BaseNodeSetSpecifics) { int64 child_id = MakeNode(test_user_share_.user_share(), - syncable::BOOKMARKS, "testtag"); + syncer::BOOKMARKS, "testtag"); WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(child_id)); @@ -529,7 +527,7 @@ TEST_F(SyncApiTest, BaseNodeSetSpecifics) { TEST_F(SyncApiTest, BaseNodeSetSpecificsPreservesUnknownFields) { int64 child_id = MakeNode(test_user_share_.user_share(), - syncable::BOOKMARKS, "testtag"); + syncer::BOOKMARKS, "testtag"); WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(child_id)); @@ -561,13 +559,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 >= syncable::FIRST_REAL_MODEL_TYPE) { - ModelType model_type = - syncable::ModelTypeFromString(type_str); + if (expected_model_type >= syncer::FIRST_REAL_MODEL_TYPE) { + ModelType model_type = syncer::ModelTypeFromString(type_str); EXPECT_EQ(expected_model_type, model_type); - } else if (expected_model_type == syncable::TOP_LEVEL_FOLDER) { + } else if (expected_model_type == syncer::TOP_LEVEL_FOLDER) { EXPECT_EQ("Top-level folder", type_str); - } else if (expected_model_type == syncable::UNSPECIFIED) { + } else if (expected_model_type == syncer::UNSPECIFIED) { EXPECT_EQ("Unspecified", type_str); } else { ADD_FAILURE(); @@ -625,7 +622,7 @@ TEST_F(SyncApiTest, EmptyTags) { WriteNode node(&trans); std::string empty_tag; syncer::WriteNode::InitUniqueByCreationResult result = - node.InitUniqueByCreation(syncable::TYPED_URLS, root_node, empty_tag); + node.InitUniqueByCreation(syncer::TYPED_URLS, root_node, empty_tag); EXPECT_NE(syncer::WriteNode::INIT_SUCCESS, result); EXPECT_EQ(BaseNode::INIT_FAILED_PRECONDITION, node.InitByTagLookup(empty_tag)); @@ -700,8 +697,8 @@ class SyncNotifierMock : public syncer::SyncNotifier { MOCK_METHOD2(UpdateCredentials, void(const std::string&, const std::string&)); MOCK_METHOD1(UpdateEnabledTypes, - void(syncable::ModelTypeSet)); - MOCK_METHOD1(SendNotification, void(syncable::ModelTypeSet)); + void(syncer::ModelTypeSet)); + MOCK_METHOD1(SendNotification, void(syncer::ModelTypeSet)); }; } // namespace @@ -798,29 +795,29 @@ class SyncManagerTest : public testing::Test, } void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { - (*out)[syncable::NIGORI] = syncer::GROUP_PASSIVE; - (*out)[syncable::BOOKMARKS] = syncer::GROUP_PASSIVE; - (*out)[syncable::THEMES] = syncer::GROUP_PASSIVE; - (*out)[syncable::SESSIONS] = syncer::GROUP_PASSIVE; - (*out)[syncable::PASSWORDS] = syncer::GROUP_PASSIVE; - (*out)[syncable::PREFERENCES] = syncer::GROUP_PASSIVE; + (*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; } virtual void OnChangesApplied( - syncable::ModelType model_type, + syncer::ModelType model_type, const BaseTransaction* trans, const ImmutableChangeRecordList& changes) OVERRIDE {} - virtual void OnChangesComplete(syncable::ModelType model_type) OVERRIDE {} + virtual void OnChangesComplete(syncer::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(syncable::NIGORI, true); + share->directory->set_initial_sync_ended_for_type(syncer::NIGORI, true); // We need to create the nigori node as if it were an applied server update. - int64 nigori_id = GetIdForDataType(syncable::NIGORI); + int64 nigori_id = GetIdForDataType(syncer::NIGORI); if (nigori_id == kInvalidId) return false; @@ -866,11 +863,10 @@ class SyncManagerTest : public testing::Test, sync_notifier_observer_ = NULL; } - void SyncNotifierUpdateEnabledTypes(syncable::ModelTypeSet types) { + void SyncNotifierUpdateEnabledTypes(syncer::ModelTypeSet types) { ModelSafeRoutingInfo routes; GetModelSafeRoutingInfo(&routes); - const syncable::ModelTypeSet expected_types = - GetRoutingInfoTypes(routes); + const syncer::ModelTypeSet expected_types = GetRoutingInfoTypes(routes); EXPECT_TRUE(types.Equals(expected_types)); ++update_enabled_types_call_count_; } @@ -895,7 +891,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(syncable::ModelType type, + bool ResetUnsyncedEntry(syncer::ModelType type, const std::string& client_tag) { UserShare* share = sync_manager_.GetUserShare(); syncable::WriteTransaction trans( @@ -935,8 +931,7 @@ TEST_F(SyncManagerTest, UpdateEnabledTypes) { ModelSafeRoutingInfo routes; GetModelSafeRoutingInfo(&routes); - const syncable::ModelTypeSet enabled_types = - GetRoutingInfoTypes(routes); + const syncer::ModelTypeSet enabled_types = GetRoutingInfoTypes(routes); sync_manager_.UpdateEnabledTypes(enabled_types); EXPECT_EQ(1, update_enabled_types_call_count_); @@ -1018,8 +1013,7 @@ class SyncManagerGetNodesByIdTest : public SyncManagerTest { } int64 child_id = - MakeNode(sync_manager_.GetUserShare(), - syncable::BOOKMARKS, "testtag"); + MakeNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, "testtag"); StrictMock<MockJsReplyHandler> reply_handler; @@ -1269,9 +1263,9 @@ TEST_F(SyncManagerTest, OnNotificationStateChange) { TEST_F(SyncManagerTest, OnIncomingNotification) { StrictMock<MockJsEventHandler> event_handler; - const syncable::ModelTypeSet empty_model_types; - const syncable::ModelTypeSet model_types( - syncable::BOOKMARKS, syncable::THEMES); + const syncer::ModelTypeSet empty_model_types; + const syncer::ModelTypeSet model_types( + syncer::BOOKMARKS, syncer::THEMES); // Build expected_args to have a single argument with the string // equivalents of model_types. @@ -1280,11 +1274,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 (syncable::ModelTypeSet::Iterator it = model_types.First(); + for (syncer::ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { model_type_list->Append( - Value::CreateStringValue( - syncable::ModelTypeToString(it.Get()))); + Value::CreateStringValue(syncer::ModelTypeToString(it.Get()))); } } @@ -1313,15 +1306,15 @@ TEST_F(SyncManagerTest, RefreshEncryptionReady) { sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing)); PumpLoop(); - const syncable::ModelTypeSet encrypted_types = + const syncer::ModelTypeSet encrypted_types = sync_manager_.GetEncryptedDataTypesForTest(); - EXPECT_TRUE(encrypted_types.Has(syncable::PASSWORDS)); + EXPECT_TRUE(encrypted_types.Has(syncer::PASSWORDS)); EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByIdLookup(GetIdForDataType(syncable::NIGORI))); + node.InitByIdLookup(GetIdForDataType(syncer::NIGORI))); sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics(); EXPECT_TRUE(nigori.has_encrypted()); Cryptographer* cryptographer = trans.GetCryptographer(); @@ -1338,9 +1331,9 @@ TEST_F(SyncManagerTest, RefreshEncryptionNotReady) { sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing)); PumpLoop(); - const syncable::ModelTypeSet encrypted_types = + const syncer::ModelTypeSet encrypted_types = sync_manager_.GetEncryptedDataTypesForTest(); - EXPECT_TRUE(encrypted_types.Has(syncable::PASSWORDS)); // Hardcoded. + EXPECT_TRUE(encrypted_types.Has(syncer::PASSWORDS)); // Hardcoded. EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest()); } @@ -1353,15 +1346,15 @@ TEST_F(SyncManagerTest, RefreshEncryptionEmptyNigori) { sync_manager_.RefreshNigori(kTestChromeVersion, base::Bind(&DoNothing)); PumpLoop(); - const syncable::ModelTypeSet encrypted_types = + const syncer::ModelTypeSet encrypted_types = sync_manager_.GetEncryptedDataTypesForTest(); - EXPECT_TRUE(encrypted_types.Has(syncable::PASSWORDS)); // Hardcoded. + EXPECT_TRUE(encrypted_types.Has(syncer::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(syncable::NIGORI))); + node.InitByIdLookup(GetIdForDataType(syncer::NIGORI))); sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics(); EXPECT_TRUE(nigori.has_encrypted()); Cryptographer* cryptographer = trans.GetCryptographer(); @@ -1374,7 +1367,7 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithNoData) { EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelTypeSet::All()), true)); + HasModelTypes(syncer::ModelTypeSet::All()), true)); EXPECT_CALL(observer_, OnEncryptionComplete()); sync_manager_.EnableEncryptEverything(); EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest()); @@ -1386,26 +1379,26 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) { // Create some unencrypted unsynced data. int64 folder = MakeFolderWithParent(sync_manager_.GetUserShare(), - syncable::BOOKMARKS, - GetIdForDataType(syncable::BOOKMARKS), + syncer::BOOKMARKS, + GetIdForDataType(syncer::BOOKMARKS), NULL); // First batch_size nodes are children of folder. size_t i; for (i = 0; i < batch_size; ++i) { - MakeNodeWithParent(sync_manager_.GetUserShare(), syncable::BOOKMARKS, + MakeNodeWithParent(sync_manager_.GetUserShare(), syncer::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(), syncable::SESSIONS, + MakeNodeWithParent(sync_manager_.GetUserShare(), syncer::SESSIONS, base::StringPrintf("%"PRIuS"", i), - GetIdForDataType(syncable::SESSIONS)); + GetIdForDataType(syncer::SESSIONS)); } // Last batch_size nodes are a third type that will not need encryption. for (; i < 3*batch_size; ++i) { - MakeNodeWithParent(sync_manager_.GetUserShare(), syncable::THEMES, + MakeNodeWithParent(sync_manager_.GetUserShare(), syncer::THEMES, base::StringPrintf("%"PRIuS"", i), - GetIdForDataType(syncable::THEMES)); + GetIdForDataType(syncer::THEMES)); } { @@ -1415,44 +1408,44 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) { EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncable::BOOKMARKS, + syncer::BOOKMARKS, false /* not encrypted */)); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncable::SESSIONS, + syncer::SESSIONS, false /* not encrypted */)); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncable::THEMES, + syncer::THEMES, false /* not encrypted */)); } EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelTypeSet::All()), true)); + HasModelTypes(syncer::ModelTypeSet::All()), true)); EXPECT_CALL(observer_, OnEncryptionComplete()); sync_manager_.EnableEncryptEverything(); EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); EXPECT_TRUE(GetEncryptedTypes(&trans).Equals( - syncable::ModelTypeSet::All())); + syncer::ModelTypeSet::All())); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncable::BOOKMARKS, + syncer::BOOKMARKS, true /* is encrypted */)); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncable::SESSIONS, + syncer::SESSIONS, true /* is encrypted */)); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncable::THEMES, + syncer::THEMES, true /* is encrypted */)); } @@ -1465,22 +1458,21 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) { EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); - EXPECT_TRUE(GetEncryptedTypes(&trans).Equals( - syncable::ModelTypeSet::All())); + EXPECT_TRUE(GetEncryptedTypes(&trans).Equals(syncer::ModelTypeSet::All())); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncable::BOOKMARKS, + syncer::BOOKMARKS, true /* is encrypted */)); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncable::SESSIONS, + syncer::SESSIONS, true /* is encrypted */)); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncable::THEMES, + syncer::THEMES, true /* is encrypted */)); } // Calling EncryptDataTypes with an empty encrypted types should not trigger @@ -1562,7 +1554,7 @@ TEST_F(SyncManagerTest, SetPassphraseWithPassword) { WriteNode password_node(&trans); syncer::WriteNode::InitUniqueByCreationResult result = - password_node.InitUniqueByCreation(syncable::PASSWORDS, + password_node.InitUniqueByCreation(syncer::PASSWORDS, root_node, "foo"); EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); sync_pb::PasswordSpecificsData data; @@ -1585,7 +1577,7 @@ TEST_F(SyncManagerTest, SetPassphraseWithPassword) { ReadNode password_node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - password_node.InitByClientTagLookup(syncable::PASSWORDS, + password_node.InitByClientTagLookup(syncer::PASSWORDS, "foo")); const sync_pb::PasswordSpecificsData& data = password_node.GetPasswordSpecifics(); @@ -1796,7 +1788,7 @@ TEST_F(SyncManagerTest, SetPassphraseWithEmptyPasswordNode) { WriteNode password_node(&trans); syncer::WriteNode::InitUniqueByCreationResult result = - password_node.InitUniqueByCreation(syncable::PASSWORDS, root_node, tag); + password_node.InitUniqueByCreation(syncer::PASSWORDS, root_node, tag); EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result); node_id = password_node.GetId(); } @@ -1809,7 +1801,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(syncable::PASSWORDS, + password_node.InitByClientTagLookup(syncer::PASSWORDS, tag)); } { @@ -1821,15 +1813,15 @@ TEST_F(SyncManagerTest, SetPassphraseWithEmptyPasswordNode) { } TEST_F(SyncManagerTest, NudgeDelayTest) { - EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncable::BOOKMARKS), + EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncer::BOOKMARKS), base::TimeDelta::FromMilliseconds( SyncManager::kDefaultNudgeDelayMilliseconds)); - EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncable::AUTOFILL), + EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncer::AUTOFILL), base::TimeDelta::FromSeconds( syncer::kDefaultShortPollIntervalSeconds)); - EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncable::PREFERENCES), + EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncer::PREFERENCES), base::TimeDelta::FromMilliseconds( SyncManager::kPreferencesNudgeDelayMilliseconds)); } @@ -1847,10 +1839,10 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { // Create a bookmark using the legacy format. int64 node_id1 = MakeNode(sync_manager_.GetUserShare(), - syncable::BOOKMARKS, + syncer::BOOKMARKS, "testtag"); int64 node_id2 = MakeNode(sync_manager_.GetUserShare(), - syncable::BOOKMARKS, + syncer::BOOKMARKS, "testtag2"); { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); @@ -1881,14 +1873,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(syncable::BOOKMARKS, node.GetModelType()); + EXPECT_EQ(syncer::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(syncable::BOOKMARKS, node2.GetModelType()); + EXPECT_EQ(syncer::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()); @@ -1901,37 +1893,36 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncable::BOOKMARKS, + syncer::BOOKMARKS, false /* not encrypted */)); } EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelTypeSet::All()), true)); + HasModelTypes(syncer::ModelTypeSet::All()), true)); EXPECT_CALL(observer_, OnEncryptionComplete()); sync_manager_.EnableEncryptEverything(); EXPECT_TRUE(sync_manager_.EncryptEverythingEnabledForTest()); { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); - EXPECT_TRUE(GetEncryptedTypes(&trans).Equals( - syncable::ModelTypeSet::All())); + EXPECT_TRUE(GetEncryptedTypes(&trans).Equals(syncer::ModelTypeSet::All())); EXPECT_TRUE(syncable::VerifyDataTypeEncryptionForTest( trans.GetWrappedTrans(), trans.GetCryptographer(), - syncable::BOOKMARKS, + syncer::BOOKMARKS, true /* is encrypted */)); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(node_id1)); - EXPECT_EQ(syncable::BOOKMARKS, node.GetModelType()); + EXPECT_EQ(syncer::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(syncable::BOOKMARKS, node2.GetModelType()); + EXPECT_EQ(syncer::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()); @@ -1951,7 +1942,7 @@ TEST_F(SyncManagerTest, CreateLocalBookmark) { ReadNode root_node(&trans); root_node.InitByRootLookup(); WriteNode node(&trans); - ASSERT_TRUE(node.InitByCreation(syncable::BOOKMARKS, root_node, NULL)); + ASSERT_TRUE(node.InitByCreation(syncer::BOOKMARKS, root_node, NULL)); node.SetIsFolder(false); node.SetTitle(UTF8ToWide(title)); node.SetURL(url); @@ -1977,26 +1968,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(), syncable::BOOKMARKS, client_tag, - BaseNode::GenerateSyncableHash(syncable::BOOKMARKS, + MakeServerNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, client_tag, + BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncable::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::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(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); node.SetEntitySpecifics(entity_specifics); } - EXPECT_FALSE(ResetUnsyncedEntry(syncable::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); // Encrypt the datatatype, should set is_unsynced. EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelTypeSet::All()), true)); + HasModelTypes(syncer::ModelTypeSet::All()), true)); EXPECT_CALL(observer_, OnEncryptionComplete()); EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, FULL_ENCRYPTION)); @@ -2006,7 +1997,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); EXPECT_TRUE(specifics.has_encrypted()); @@ -2016,7 +2007,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey( specifics.encrypted())); } - EXPECT_TRUE(ResetUnsyncedEntry(syncable::BOOKMARKS, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); // Set a new passphrase. Should set is_unsynced. testing::Mock::VerifyAndClearExpectations(&observer_); @@ -2028,7 +2019,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); EXPECT_TRUE(specifics.has_encrypted()); @@ -2038,7 +2029,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey( specifics.encrypted())); } - EXPECT_TRUE(ResetUnsyncedEntry(syncable::BOOKMARKS, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); // Force a re-encrypt everything. Should not set is_unsynced. testing::Mock::VerifyAndClearExpectations(&observer_); @@ -2051,7 +2042,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); EXPECT_TRUE(specifics.has_encrypted()); @@ -2060,14 +2051,14 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey( specifics.encrypted())); } - EXPECT_FALSE(ResetUnsyncedEntry(syncable::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::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(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); node.SetEntitySpecifics(entity_specifics); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); @@ -2078,7 +2069,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { EXPECT_TRUE(cryptographer->CanDecryptUsingDefaultKey( specifics.encrypted())); } - EXPECT_FALSE(ResetUnsyncedEntry(syncable::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); // Manually change to different data. Should set is_unsynced. { @@ -2087,7 +2078,7 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); node.SetEntitySpecifics(entity_specifics); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); @@ -2116,12 +2107,12 @@ TEST_F(SyncManagerTest, UpdatePasswordSetEntitySpecificsNoChange) { entity_specifics.mutable_password()-> mutable_encrypted()); } - MakeServerNode(sync_manager_.GetUserShare(), syncable::PASSWORDS, client_tag, - BaseNode::GenerateSyncableHash(syncable::PASSWORDS, + MakeServerNode(sync_manager_.GetUserShare(), syncer::PASSWORDS, client_tag, + BaseNode::GenerateSyncableHash(syncer::PASSWORDS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncable::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); // Manually change to the same data via SetEntitySpecifics. Should not set // is_unsynced. @@ -2129,10 +2120,10 @@ TEST_F(SyncManagerTest, UpdatePasswordSetEntitySpecificsNoChange) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::PASSWORDS, client_tag)); + node.InitByClientTagLookup(syncer::PASSWORDS, client_tag)); node.SetEntitySpecifics(entity_specifics); } - EXPECT_FALSE(ResetUnsyncedEntry(syncable::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); } // Passwords have their own handling for encryption. Verify it does not result @@ -2151,12 +2142,12 @@ TEST_F(SyncManagerTest, UpdatePasswordSetPasswordSpecifics) { entity_specifics.mutable_password()-> mutable_encrypted()); } - MakeServerNode(sync_manager_.GetUserShare(), syncable::PASSWORDS, client_tag, - BaseNode::GenerateSyncableHash(syncable::PASSWORDS, + MakeServerNode(sync_manager_.GetUserShare(), syncer::PASSWORDS, client_tag, + BaseNode::GenerateSyncableHash(syncer::PASSWORDS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncable::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); // Manually change to the same data via SetPasswordSpecifics. Should not set // is_unsynced. @@ -2164,17 +2155,17 @@ TEST_F(SyncManagerTest, UpdatePasswordSetPasswordSpecifics) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::PASSWORDS, client_tag)); + node.InitByClientTagLookup(syncer::PASSWORDS, client_tag)); node.SetPasswordSpecifics(node.GetPasswordSpecifics()); } - EXPECT_FALSE(ResetUnsyncedEntry(syncable::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::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(syncable::PASSWORDS, client_tag)); + node.InitByClientTagLookup(syncer::PASSWORDS, client_tag)); Cryptographer* cryptographer = trans.GetCryptographer(); sync_pb::PasswordSpecificsData data; data.set_password_value("secret2"); @@ -2202,12 +2193,12 @@ TEST_F(SyncManagerTest, UpdatePasswordNewPassphrase) { data, entity_specifics.mutable_password()->mutable_encrypted()); } - MakeServerNode(sync_manager_.GetUserShare(), syncable::PASSWORDS, client_tag, - BaseNode::GenerateSyncableHash(syncable::PASSWORDS, + MakeServerNode(sync_manager_.GetUserShare(), syncer::PASSWORDS, client_tag, + BaseNode::GenerateSyncableHash(syncer::PASSWORDS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncable::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); // Set a new passphrase. Should set is_unsynced. testing::Mock::VerifyAndClearExpectations(&observer_); @@ -2215,7 +2206,7 @@ TEST_F(SyncManagerTest, UpdatePasswordNewPassphrase) { EXPECT_CALL(observer_, OnPassphraseAccepted()); EXPECT_CALL(observer_, OnEncryptionComplete()); sync_manager_.SetEncryptionPassphrase("new_passphrase", true); - EXPECT_TRUE(ResetUnsyncedEntry(syncable::PASSWORDS, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); } // Passwords have their own handling for encryption. Verify it does not result @@ -2233,19 +2224,19 @@ TEST_F(SyncManagerTest, UpdatePasswordReencryptEverything) { data, entity_specifics.mutable_password()->mutable_encrypted()); } - MakeServerNode(sync_manager_.GetUserShare(), syncable::PASSWORDS, client_tag, - BaseNode::GenerateSyncableHash(syncable::PASSWORDS, + MakeServerNode(sync_manager_.GetUserShare(), syncer::PASSWORDS, client_tag, + BaseNode::GenerateSyncableHash(syncer::PASSWORDS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncable::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::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(syncable::PASSWORDS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::PASSWORDS, client_tag)); } // Verify SetTitle(..) doesn't unnecessarily set IS_UNSYNCED for bookmarks @@ -2255,32 +2246,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(), syncable::BOOKMARKS, client_tag, - BaseNode::GenerateSyncableHash(syncable::BOOKMARKS, + MakeServerNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, client_tag, + BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncable::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::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(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); node.SetTitle(UTF8ToWide(client_tag)); } - EXPECT_FALSE(ResetUnsyncedEntry(syncable::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::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(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); node.SetTitle(UTF8ToWide("title2")); } - EXPECT_TRUE(ResetUnsyncedEntry(syncable::BOOKMARKS, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); } // Verify SetTitle(..) doesn't unnecessarily set IS_UNSYNCED for encrypted @@ -2291,22 +2282,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(), syncable::BOOKMARKS, client_tag, - BaseNode::GenerateSyncableHash(syncable::BOOKMARKS, + MakeServerNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, client_tag, + BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncable::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); // Encrypt the datatatype, should set is_unsynced. EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelTypeSet::All()), true)); + HasModelTypes(syncer::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(syncable::BOOKMARKS, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); // Manually change to the same title. Should not set is_unsynced. // NON_UNIQUE_NAME should be kEncryptedString. @@ -2314,14 +2305,14 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::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(syncable::BOOKMARKS, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); // Manually change to new title. Should set is_unsynced. NON_UNIQUE_NAME // should still be kEncryptedString. @@ -2329,14 +2320,14 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::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(syncable::BOOKMARKS, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(syncer::BOOKMARKS, client_tag)); } // Verify SetTitle(..) doesn't unnecessarily set IS_UNSYNCED for non-bookmarks @@ -2347,33 +2338,33 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitle) { entity_specifics.mutable_preference()->set_name("name"); entity_specifics.mutable_preference()->set_value("value"); MakeServerNode(sync_manager_.GetUserShare(), - syncable::PREFERENCES, + syncer::PREFERENCES, client_tag, - BaseNode::GenerateSyncableHash(syncable::PREFERENCES, + BaseNode::GenerateSyncableHash(syncer::PREFERENCES, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncable::PREFERENCES, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::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(syncable::PREFERENCES, client_tag)); + node.InitByClientTagLookup(syncer::PREFERENCES, client_tag)); node.SetTitle(UTF8ToWide(client_tag)); } - EXPECT_FALSE(ResetUnsyncedEntry(syncable::PREFERENCES, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::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(syncable::PREFERENCES, client_tag)); + node.InitByClientTagLookup(syncer::PREFERENCES, client_tag)); node.SetTitle(UTF8ToWide("title2")); } - EXPECT_TRUE(ResetUnsyncedEntry(syncable::PREFERENCES, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag)); } // Verify SetTitle(..) doesn't unnecessarily set IS_UNSYNCED for encrypted @@ -2385,23 +2376,23 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) { entity_specifics.mutable_preference()->set_name("name"); entity_specifics.mutable_preference()->set_value("value"); MakeServerNode(sync_manager_.GetUserShare(), - syncable::PREFERENCES, + syncer::PREFERENCES, client_tag, - BaseNode::GenerateSyncableHash(syncable::PREFERENCES, + BaseNode::GenerateSyncableHash(syncer::PREFERENCES, client_tag), entity_specifics); // New node shouldn't start off unsynced. - EXPECT_FALSE(ResetUnsyncedEntry(syncable::PREFERENCES, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag)); // Encrypt the datatatype, should set is_unsynced. EXPECT_CALL(observer_, OnEncryptedTypesChanged( - HasModelTypes(syncable::ModelTypeSet::All()), true)); + HasModelTypes(syncer::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(syncable::PREFERENCES, client_tag)); + EXPECT_TRUE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag)); // Manually change to the same title. Should not set is_unsynced. // NON_UNIQUE_NAME should be kEncryptedString. @@ -2409,14 +2400,14 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::PREFERENCES, client_tag)); + node.InitByClientTagLookup(syncer::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(syncable::PREFERENCES, client_tag)); + EXPECT_FALSE(ResetUnsyncedEntry(syncer::PREFERENCES, client_tag)); // Manually change to new title. Should not set is_unsynced because the // NON_UNIQUE_NAME should still be kEncryptedString. @@ -2424,7 +2415,7 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::PREFERENCES, client_tag)); + node.InitByClientTagLookup(syncer::PREFERENCES, client_tag)); node.SetTitle(UTF8ToWide("title2")); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); @@ -2453,10 +2444,10 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) { sync_pb::EncryptedData encrypted; crypto->Encrypt(bm_specifics, &encrypted); entity_specifics.mutable_encrypted()->CopyFrom(encrypted); - syncable::AddDefaultFieldValue(syncable::BOOKMARKS, &entity_specifics); + syncer::AddDefaultFieldValue(syncer::BOOKMARKS, &entity_specifics); } - MakeServerNode(sync_manager_.GetUserShare(), syncable::BOOKMARKS, client_tag, - BaseNode::GenerateSyncableHash(syncable::BOOKMARKS, + MakeServerNode(sync_manager_.GetUserShare(), syncer::BOOKMARKS, client_tag, + BaseNode::GenerateSyncableHash(syncer::BOOKMARKS, client_tag), entity_specifics); @@ -2465,7 +2456,7 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); EXPECT_EQ(title, node.GetTitle()); EXPECT_EQ(GURL(url), node.GetURL()); } @@ -2475,7 +2466,7 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) { WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); node.SetURL(GURL(url2)); } @@ -2484,7 +2475,7 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, - node.InitByClientTagLookup(syncable::BOOKMARKS, client_tag)); + node.InitByClientTagLookup(syncer::BOOKMARKS, client_tag)); EXPECT_EQ(title, node.GetTitle()); EXPECT_EQ(GURL(url2), node.GetURL()); const syncable::Entry* node_entry = node.GetEntry(); diff --git a/sync/internal_api/test/test_entry_factory.cc b/sync/internal_api/test/test_entry_factory.cc index bccb432..5527c1f 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, - syncable::ModelType model_type, + syncer::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; - syncable::AddDefaultFieldValue(model_type, &default_specifics); + syncer::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, - syncable::ModelType model_type) { + syncer::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, syncable::ModelType + const std::string& name, syncer::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; - syncable::AddDefaultFieldValue(model_type, &default_specifics); + syncer::AddDefaultFieldValue(model_type, &default_specifics); MutableEntry entry(&trans, syncable::CREATE, parent_id, name); if (!entry.good()) { diff --git a/sync/internal_api/write_node.cc b/sync/internal_api/write_node.cc index 9e6e403..7eb4ff7 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(), syncable::UNSPECIFIED); - syncable::ModelType type = GetModelType(); + DCHECK_NE(GetModelType(), syncer::UNSPECIFIED); + syncer::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 != syncable::BOOKMARKS && needs_encryption) { + if (type != syncer::BOOKMARKS && needs_encryption) { new_legal_title = kEncryptedString; } else { SyncAPINameToServerName(WideToUTF8(title), &new_legal_title); } std::string current_legal_title; - if (syncable::BOOKMARKS == type && + if (syncer::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() == syncable::BOOKMARKS) { + if (GetModelType() == syncer::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 " - << syncable::ModelTypeToString(type) + << syncer::ModelTypeToString(type) << " and marking for syncing."; MarkForSyncing(); } @@ -149,7 +149,7 @@ void WriteNode::SetNigoriSpecifics( void WriteNode::SetPasswordSpecifics( const sync_pb::PasswordSpecificsData& data) { - DCHECK_EQ(syncable::PASSWORDS, GetModelType()); + DCHECK_EQ(syncer::PASSWORDS, GetModelType()); Cryptographer* cryptographer = GetTransaction()->GetCryptographer(); @@ -159,12 +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 (syncable::GetModelTypeFromSpecifics(old_specifics) == - syncable::PASSWORDS) { + if (syncer::GetModelTypeFromSpecifics(old_specifics) == syncer::PASSWORDS) { entity_specifics.CopyFrom(old_specifics); } else { - syncable::AddDefaultFieldValue(syncable::PASSWORDS, - &entity_specifics); + syncer::AddDefaultFieldValue(syncer::PASSWORDS, &entity_specifics); } sync_pb::PasswordSpecifics* password_specifics = entity_specifics.mutable_password(); @@ -194,15 +192,15 @@ void WriteNode::SetSessionSpecifics( void WriteNode::SetEntitySpecifics( const sync_pb::EntitySpecifics& new_value) { - syncable::ModelType new_specifics_type = - syncable::GetModelTypeFromSpecifics(new_value); - DCHECK_NE(new_specifics_type, syncable::UNSPECIFIED); + syncer::ModelType new_specifics_type = + syncer::GetModelTypeFromSpecifics(new_value); + DCHECK_NE(new_specifics_type, syncer::UNSPECIFIED); DVLOG(1) << "Writing entity specifics of type " - << syncable::ModelTypeToString(new_specifics_type); + << syncer::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() != syncable::UNSPECIFIED) { + if (GetModelType() != syncer::UNSPECIFIED) { DCHECK_EQ(new_specifics_type, GetModelType()); } syncer::Cryptographer* cryptographer = @@ -281,7 +279,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( - syncable::ModelType model_type, + syncer::ModelType model_type, const std::string& tag) { DCHECK(!entry_) << "Init called twice"; if (tag.empty()) @@ -309,25 +307,25 @@ BaseNode::InitByLookupResult WriteNode::InitByTagLookup( return INIT_FAILED_ENTRY_NOT_GOOD; if (entry_->Get(syncable::IS_DEL)) return INIT_FAILED_ENTRY_IS_DEL; - syncable::ModelType model_type = GetModelType(); - DCHECK_EQ(syncable::NIGORI, model_type); + syncer::ModelType model_type = GetModelType(); + DCHECK_EQ(syncer::NIGORI, model_type); return INIT_OK; } -void WriteNode::PutModelType(syncable::ModelType model_type) { +void WriteNode::PutModelType(syncer::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() == syncable::UNSPECIFIED); // Immutable once set. + GetModelType() == syncer::UNSPECIFIED); // Immutable once set. sync_pb::EntitySpecifics specifics; - syncable::AddDefaultFieldValue(model_type, &specifics); + syncer::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(syncable::ModelType model_type, +bool WriteNode::InitByCreation(syncer::ModelType model_type, const BaseNode& parent, const BaseNode* predecessor) { DCHECK(!entry_) << "Init called twice"; @@ -365,7 +363,7 @@ bool WriteNode::InitByCreation(syncable::ModelType model_type, // TODO(chron): Code datatype into hash tag. // TODO(chron): Is model type ever lost? WriteNode::InitUniqueByCreationResult WriteNode::InitUniqueByCreation( - syncable::ModelType model_type, + syncer::ModelType model_type, const BaseNode& parent, const std::string& tag) { // This DCHECK will only fail if init is called twice. |