Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4934)

Unified Diff: components/sync/protocol/proto_old_value_conversions.cc

Issue 2374223003: Sync MDP: reimplement value conversions ontop of visitors
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync/protocol/proto_old_value_conversions.cc
diff --git a/components/sync/protocol/proto_value_conversions.cc b/components/sync/protocol/proto_old_value_conversions.cc
similarity index 96%
copy from components/sync/protocol/proto_value_conversions.cc
copy to components/sync/protocol/proto_old_value_conversions.cc
index dce4b478508ae5c937ecd54681fdd4e848e0f55a..7f251acf90a7b0216d175842071379ed2fa25f24 100644
--- a/components/sync/protocol/proto_value_conversions.cc
+++ b/components/sync/protocol/proto_old_value_conversions.cc
@@ -4,7 +4,7 @@
// Keep this file in sync with the .proto files in this directory.
-#include "components/sync/protocol/proto_value_conversions.h"
+#include "components/sync/protocol/proto_old_value_conversions.h"
#include <stdint.h>
@@ -51,6 +51,7 @@
#include "components/sync/protocol/unique_position.pb.h"
namespace syncer {
+namespace old {
namespace {
@@ -160,7 +161,7 @@ std::unique_ptr<base::DictionaryValue> SessionHeaderToValue(
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
SET_REP(window, SessionWindowToValue);
SET_STR(client_name);
- SET_ENUM(device_type, GetDeviceTypeString);
+ SET_ENUM(device_type, ProtoEnumToString);
return value;
}
@@ -175,7 +176,7 @@ std::unique_ptr<base::DictionaryValue> SessionTabToValue(
SET_STR(extension_app_id);
SET_REP(navigation, TabNavigationToValue);
SET_BYTES(favicon);
- SET_ENUM(favicon_type, GetFaviconTypeString);
+ SET_ENUM(favicon_type, ProtoEnumToString);
SET_STR(favicon_source);
SET_REP(variation_id, MakeInt64Value);
return value;
@@ -187,7 +188,7 @@ std::unique_ptr<base::DictionaryValue> SessionWindowToValue(
SET_INT32(window_id);
SET_INT32(selected_tab_index);
SET_INT32_REP(tab);
- SET_ENUM(browser_type, GetBrowserTypeString);
+ SET_ENUM(browser_type, ProtoEnumToString);
return value;
}
@@ -197,8 +198,8 @@ std::unique_ptr<base::DictionaryValue> TabNavigationToValue(
SET_STR(virtual_url);
SET_STR(referrer);
SET_STR(title);
- SET_ENUM(page_transition, GetPageTransitionString);
- SET_ENUM(redirect_type, GetPageTransitionRedirectTypeString);
+ SET_ENUM(page_transition, ProtoEnumToString);
+ SET_ENUM(redirect_type, ProtoEnumToString);
SET_INT32(unique_id);
SET_INT64(timestamp_msec);
SET_BOOL(navigation_forward_back);
@@ -209,7 +210,7 @@ std::unique_ptr<base::DictionaryValue> TabNavigationToValue(
SET_INT64(global_id);
SET_STR(search_terms);
SET_STR(favicon_url);
- SET_ENUM(blocked_state, GetBlockedStateString);
+ SET_ENUM(blocked_state, ProtoEnumToString);
SET_STR_REP(content_pack_categories);
SET_INT32(http_status_code);
SET_INT32(obsolete_referrer_policy);
@@ -217,7 +218,7 @@ std::unique_ptr<base::DictionaryValue> TabNavigationToValue(
SET_REP(navigation_redirect, NavigationRedirectToValue);
SET_STR(last_navigation_redirect_url);
SET_INT32(correct_referrer_policy);
- SET_ENUM(password_state, GetPasswordStateString);
+ SET_ENUM(password_state, ProtoEnumToString);
return value;
}
@@ -271,7 +272,7 @@ std::unique_ptr<base::DictionaryValue> AppListSpecificsToValue(
const sync_pb::AppListSpecifics& proto) {
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
SET_STR(item_id);
- SET_ENUM(item_type, GetAppListItemTypeString);
+ SET_ENUM(item_type, ProtoEnumToString);
SET_STR(item_name);
SET_STR(parent_id);
SET_STR(item_ordinal);
@@ -310,7 +311,7 @@ std::unique_ptr<base::DictionaryValue> ReadingListSpecificsToValue(
SET_STR(url);
SET_INT64(creation_time_us);
SET_INT64(update_time_us);
- SET_ENUM(status, GetReadingListEntryStatusString);
+ SET_ENUM(status, ProtoEnumToString);
return value;
}
@@ -350,7 +351,7 @@ std::unique_ptr<base::DictionaryValue> AppSpecificsToValue(
SET(notification_settings, AppSettingsToValue);
SET_STR(app_launch_ordinal);
SET_STR(page_ordinal);
- SET_ENUM(launch_type, GetLaunchTypeString);
+ SET_ENUM(launch_type, ProtoEnumToString);
SET_STR(bookmark_app_url);
SET_STR(bookmark_app_description);
SET_STR(bookmark_app_icon_color);
@@ -403,7 +404,7 @@ std::unique_ptr<base::DictionaryValue> AutofillProfileSpecificsToValue(
std::unique_ptr<base::DictionaryValue> WalletMetadataSpecificsToValue(
const sync_pb::WalletMetadataSpecifics& proto) {
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
- SET_ENUM(type, GetWalletMetadataTypeString);
+ SET_ENUM(type, ProtoEnumToString);
SET_STR(id);
SET_INT64(use_count);
SET_INT64(use_date);
@@ -414,7 +415,7 @@ std::unique_ptr<base::DictionaryValue> AutofillWalletSpecificsToValue(
const sync_pb::AutofillWalletSpecifics& proto) {
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
- SET_ENUM(type, GetWalletInfoTypeString);
+ SET_ENUM(type, ProtoEnumToString);
if (proto.type() == sync_pb::AutofillWalletSpecifics::MASKED_CREDIT_CARD) {
value->Set("masked_card",
WalletMaskedCreditCardToValue(proto.masked_card()));
@@ -449,7 +450,7 @@ std::unique_ptr<base::DictionaryValue> DeviceInfoSpecificsToValue(
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
SET_STR(cache_guid);
SET_STR(client_name);
- SET_ENUM(device_type, GetDeviceTypeString);
+ SET_ENUM(device_type, ProtoEnumToString);
SET_STR(sync_user_agent);
SET_STR(chrome_version);
SET_STR(signin_scoped_device_id);
@@ -615,7 +616,7 @@ std::unique_ptr<base::DictionaryValue> NigoriSpecificsToValue(
SET_BOOL(encrypt_everything);
SET_BOOL(server_only_was_missing_keystore_migration_time);
SET_BOOL(sync_tab_favicons);
- SET_ENUM(passphrase_type, PassphraseTypeString);
+ SET_ENUM(passphrase_type, ProtoEnumToString);
SET(keystore_decryptor_token, EncryptedDataToValue);
SET_INT64(keystore_migration_time);
SET_INT64(custom_passphrase_time);
@@ -752,9 +753,9 @@ std::unique_ptr<base::DictionaryValue> WalletMaskedCreditCardToValue(
const sync_pb::WalletMaskedCreditCard& proto) {
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
SET_STR(id);
- SET_ENUM(status, GetWalletCardStatusString);
+ SET_ENUM(status, ProtoEnumToString);
SET_STR(name_on_card);
- SET_ENUM(type, GetWalletCardTypeString);
+ SET_ENUM(type, ProtoEnumToString);
SET_STR(last_four);
SET_INT32(exp_month);
SET_INT32(exp_year);
@@ -785,7 +786,7 @@ std::unique_ptr<base::DictionaryValue> WifiCredentialSpecificsToValue(
const sync_pb::WifiCredentialSpecifics& proto) {
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
SET_BYTES(ssid);
- SET_ENUM(security_class, GetWifiCredentialSecurityClassString);
+ SET_ENUM(security_class, ProtoEnumToString);
SET_BYTES(passphrase);
return value;
}
@@ -940,7 +941,7 @@ std::unique_ptr<base::DictionaryValue> DataTypeContextToValue(
std::unique_ptr<base::DictionaryValue> GetUpdatesCallerInfoToValue(
const sync_pb::GetUpdatesCallerInfo& proto) {
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
- SET_ENUM(source, GetUpdatesSourceString);
+ SET_ENUM(source, ProtoEnumToString);
SET_BOOL(notifications_enabled);
return value;
}
@@ -955,7 +956,7 @@ std::unique_ptr<base::DictionaryValue> GetUpdatesMessageToValue(
SET_BOOL(streaming);
SET_BOOL(need_encryption_key);
SET_BOOL(create_mobile_bookmarks_folder);
- SET_ENUM(get_updates_origin, GetUpdatesOriginString);
+ SET_ENUM(get_updates_origin, ProtoEnumToString);
SET_REP(client_contexts, DataTypeContextToValue);
return value;
}
@@ -970,7 +971,7 @@ std::unique_ptr<base::DictionaryValue> ClientStatusToValue(
std::unique_ptr<base::DictionaryValue> EntryResponseToValue(
const sync_pb::CommitResponse::EntryResponse& proto) {
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
- SET_ENUM(response_type, GetResponseTypeString);
+ SET_ENUM(response_type, ProtoEnumToString);
SET_STR(id_string);
SET_STR(parent_id_string);
SET_INT64(position_in_parent);
@@ -1015,10 +1016,10 @@ std::unique_ptr<base::DictionaryValue> ClientCommandToValue(
std::unique_ptr<base::DictionaryValue> ErrorToValue(
const sync_pb::ClientToServerResponse::Error& proto) {
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
- SET_ENUM(error_type, GetErrorTypeString);
+ SET_ENUM(error_type, ProtoEnumToString);
SET_STR(error_description);
SET_STR(url);
- SET_ENUM(action, GetActionString);
+ SET_ENUM(action, ProtoEnumToString);
return value;
}
@@ -1035,7 +1036,7 @@ std::unique_ptr<base::DictionaryValue> ClientToServerResponseToValue(
}
SET(error, ErrorToValue);
- SET_ENUM(error_code, GetErrorTypeString);
+ SET_ENUM(error_code, ProtoEnumToString);
SET_STR(error_message);
SET_STR(store_birthday);
SET(client_command, ClientCommandToValue);
@@ -1089,7 +1090,7 @@ std::unique_ptr<base::DictionaryValue> DatatypeAssociationStatsToValue(
std::unique_ptr<base::DictionaryValue> DebugEventInfoToValue(
const sync_pb::DebugEventInfo& proto) {
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
- SET_ENUM(singleton_event, SingletonDebugEventTypeString);
+ SET_ENUM(singleton_event, ProtoEnumToString);
SET(sync_cycle_completed_event_info, SyncCycleCompletedEventInfoToValue);
SET_INT32(nudging_datatype);
SET_INT32_REP(datatypes_notified_from_server);
@@ -1165,4 +1166,5 @@ std::unique_ptr<base::DictionaryValue> EntityMetadataToValue(
#undef SET_FIELD
+} // namespace old
} // namespace syncer
« no previous file with comments | « components/sync/protocol/proto_old_value_conversions.h ('k') | components/sync/protocol/proto_unittest_serialized_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698