| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Keep this file in sync with the .proto files in this directory. | 5 // Keep this file in sync with the .proto files in this directory. |
| 6 | 6 |
| 7 #include "components/sync/protocol/proto_value_conversions.h" | 7 #include "components/sync/protocol/proto_old_value_conversions.h" |
| 8 | 8 |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <algorithm> | 11 #include <algorithm> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/base64.h" | 14 #include "base/base64.h" |
| 15 #include "base/i18n/time_formatting.h" | 15 #include "base/i18n/time_formatting.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 44 #include "components/sync/protocol/proto_enum_conversions.h" | 44 #include "components/sync/protocol/proto_enum_conversions.h" |
| 45 #include "components/sync/protocol/reading_list_specifics.pb.h" | 45 #include "components/sync/protocol/reading_list_specifics.pb.h" |
| 46 #include "components/sync/protocol/search_engine_specifics.pb.h" | 46 #include "components/sync/protocol/search_engine_specifics.pb.h" |
| 47 #include "components/sync/protocol/session_specifics.pb.h" | 47 #include "components/sync/protocol/session_specifics.pb.h" |
| 48 #include "components/sync/protocol/sync.pb.h" | 48 #include "components/sync/protocol/sync.pb.h" |
| 49 #include "components/sync/protocol/theme_specifics.pb.h" | 49 #include "components/sync/protocol/theme_specifics.pb.h" |
| 50 #include "components/sync/protocol/typed_url_specifics.pb.h" | 50 #include "components/sync/protocol/typed_url_specifics.pb.h" |
| 51 #include "components/sync/protocol/unique_position.pb.h" | 51 #include "components/sync/protocol/unique_position.pb.h" |
| 52 | 52 |
| 53 namespace syncer { | 53 namespace syncer { |
| 54 namespace old { |
| 54 | 55 |
| 55 namespace { | 56 namespace { |
| 56 | 57 |
| 57 // Basic Type -> Value functions. | 58 // Basic Type -> Value functions. |
| 58 | 59 |
| 59 std::unique_ptr<base::StringValue> MakeInt64Value(int64_t x) { | 60 std::unique_ptr<base::StringValue> MakeInt64Value(int64_t x) { |
| 60 return base::MakeUnique<base::StringValue>(base::Int64ToString(x)); | 61 return base::MakeUnique<base::StringValue>(base::Int64ToString(x)); |
| 61 } | 62 } |
| 62 | 63 |
| 63 // TODO(akalin): Perhaps make JSONWriter support BinaryValue and use | 64 // TODO(akalin): Perhaps make JSONWriter support BinaryValue and use |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 SET_BOOL(disabled); | 154 SET_BOOL(disabled); |
| 154 SET_STR(oauth_client_id); | 155 SET_STR(oauth_client_id); |
| 155 return value; | 156 return value; |
| 156 } | 157 } |
| 157 | 158 |
| 158 std::unique_ptr<base::DictionaryValue> SessionHeaderToValue( | 159 std::unique_ptr<base::DictionaryValue> SessionHeaderToValue( |
| 159 const sync_pb::SessionHeader& proto) { | 160 const sync_pb::SessionHeader& proto) { |
| 160 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 161 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 161 SET_REP(window, SessionWindowToValue); | 162 SET_REP(window, SessionWindowToValue); |
| 162 SET_STR(client_name); | 163 SET_STR(client_name); |
| 163 SET_ENUM(device_type, GetDeviceTypeString); | 164 SET_ENUM(device_type, ProtoEnumToString); |
| 164 return value; | 165 return value; |
| 165 } | 166 } |
| 166 | 167 |
| 167 std::unique_ptr<base::DictionaryValue> SessionTabToValue( | 168 std::unique_ptr<base::DictionaryValue> SessionTabToValue( |
| 168 const sync_pb::SessionTab& proto) { | 169 const sync_pb::SessionTab& proto) { |
| 169 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 170 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 170 SET_INT32(tab_id); | 171 SET_INT32(tab_id); |
| 171 SET_INT32(window_id); | 172 SET_INT32(window_id); |
| 172 SET_INT32(tab_visual_index); | 173 SET_INT32(tab_visual_index); |
| 173 SET_INT32(current_navigation_index); | 174 SET_INT32(current_navigation_index); |
| 174 SET_BOOL(pinned); | 175 SET_BOOL(pinned); |
| 175 SET_STR(extension_app_id); | 176 SET_STR(extension_app_id); |
| 176 SET_REP(navigation, TabNavigationToValue); | 177 SET_REP(navigation, TabNavigationToValue); |
| 177 SET_BYTES(favicon); | 178 SET_BYTES(favicon); |
| 178 SET_ENUM(favicon_type, GetFaviconTypeString); | 179 SET_ENUM(favicon_type, ProtoEnumToString); |
| 179 SET_STR(favicon_source); | 180 SET_STR(favicon_source); |
| 180 SET_REP(variation_id, MakeInt64Value); | 181 SET_REP(variation_id, MakeInt64Value); |
| 181 return value; | 182 return value; |
| 182 } | 183 } |
| 183 | 184 |
| 184 std::unique_ptr<base::DictionaryValue> SessionWindowToValue( | 185 std::unique_ptr<base::DictionaryValue> SessionWindowToValue( |
| 185 const sync_pb::SessionWindow& proto) { | 186 const sync_pb::SessionWindow& proto) { |
| 186 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 187 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 187 SET_INT32(window_id); | 188 SET_INT32(window_id); |
| 188 SET_INT32(selected_tab_index); | 189 SET_INT32(selected_tab_index); |
| 189 SET_INT32_REP(tab); | 190 SET_INT32_REP(tab); |
| 190 SET_ENUM(browser_type, GetBrowserTypeString); | 191 SET_ENUM(browser_type, ProtoEnumToString); |
| 191 return value; | 192 return value; |
| 192 } | 193 } |
| 193 | 194 |
| 194 std::unique_ptr<base::DictionaryValue> TabNavigationToValue( | 195 std::unique_ptr<base::DictionaryValue> TabNavigationToValue( |
| 195 const sync_pb::TabNavigation& proto) { | 196 const sync_pb::TabNavigation& proto) { |
| 196 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 197 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 197 SET_STR(virtual_url); | 198 SET_STR(virtual_url); |
| 198 SET_STR(referrer); | 199 SET_STR(referrer); |
| 199 SET_STR(title); | 200 SET_STR(title); |
| 200 SET_ENUM(page_transition, GetPageTransitionString); | 201 SET_ENUM(page_transition, ProtoEnumToString); |
| 201 SET_ENUM(redirect_type, GetPageTransitionRedirectTypeString); | 202 SET_ENUM(redirect_type, ProtoEnumToString); |
| 202 SET_INT32(unique_id); | 203 SET_INT32(unique_id); |
| 203 SET_INT64(timestamp_msec); | 204 SET_INT64(timestamp_msec); |
| 204 SET_BOOL(navigation_forward_back); | 205 SET_BOOL(navigation_forward_back); |
| 205 SET_BOOL(navigation_from_address_bar); | 206 SET_BOOL(navigation_from_address_bar); |
| 206 SET_BOOL(navigation_home_page); | 207 SET_BOOL(navigation_home_page); |
| 207 SET_BOOL(navigation_chain_start); | 208 SET_BOOL(navigation_chain_start); |
| 208 SET_BOOL(navigation_chain_end); | 209 SET_BOOL(navigation_chain_end); |
| 209 SET_INT64(global_id); | 210 SET_INT64(global_id); |
| 210 SET_STR(search_terms); | 211 SET_STR(search_terms); |
| 211 SET_STR(favicon_url); | 212 SET_STR(favicon_url); |
| 212 SET_ENUM(blocked_state, GetBlockedStateString); | 213 SET_ENUM(blocked_state, ProtoEnumToString); |
| 213 SET_STR_REP(content_pack_categories); | 214 SET_STR_REP(content_pack_categories); |
| 214 SET_INT32(http_status_code); | 215 SET_INT32(http_status_code); |
| 215 SET_INT32(obsolete_referrer_policy); | 216 SET_INT32(obsolete_referrer_policy); |
| 216 SET_BOOL(is_restored); | 217 SET_BOOL(is_restored); |
| 217 SET_REP(navigation_redirect, NavigationRedirectToValue); | 218 SET_REP(navigation_redirect, NavigationRedirectToValue); |
| 218 SET_STR(last_navigation_redirect_url); | 219 SET_STR(last_navigation_redirect_url); |
| 219 SET_INT32(correct_referrer_policy); | 220 SET_INT32(correct_referrer_policy); |
| 220 SET_ENUM(password_state, GetPasswordStateString); | 221 SET_ENUM(password_state, ProtoEnumToString); |
| 221 return value; | 222 return value; |
| 222 } | 223 } |
| 223 | 224 |
| 224 std::unique_ptr<base::DictionaryValue> NavigationRedirectToValue( | 225 std::unique_ptr<base::DictionaryValue> NavigationRedirectToValue( |
| 225 const sync_pb::NavigationRedirect& proto) { | 226 const sync_pb::NavigationRedirect& proto) { |
| 226 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 227 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 227 SET_STR(url); | 228 SET_STR(url); |
| 228 return value; | 229 return value; |
| 229 } | 230 } |
| 230 | 231 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 265 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 265 SET_INT64(start_time_usec); | 266 SET_INT64(start_time_usec); |
| 266 SET_INT64(end_time_usec); | 267 SET_INT64(end_time_usec); |
| 267 return value; | 268 return value; |
| 268 } | 269 } |
| 269 | 270 |
| 270 std::unique_ptr<base::DictionaryValue> AppListSpecificsToValue( | 271 std::unique_ptr<base::DictionaryValue> AppListSpecificsToValue( |
| 271 const sync_pb::AppListSpecifics& proto) { | 272 const sync_pb::AppListSpecifics& proto) { |
| 272 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 273 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 273 SET_STR(item_id); | 274 SET_STR(item_id); |
| 274 SET_ENUM(item_type, GetAppListItemTypeString); | 275 SET_ENUM(item_type, ProtoEnumToString); |
| 275 SET_STR(item_name); | 276 SET_STR(item_name); |
| 276 SET_STR(parent_id); | 277 SET_STR(parent_id); |
| 277 SET_STR(item_ordinal); | 278 SET_STR(item_ordinal); |
| 278 SET_STR(item_pin_ordinal); | 279 SET_STR(item_pin_ordinal); |
| 279 | 280 |
| 280 return value; | 281 return value; |
| 281 } | 282 } |
| 282 | 283 |
| 283 std::unique_ptr<base::DictionaryValue> ArcPackageSpecificsToValue( | 284 std::unique_ptr<base::DictionaryValue> ArcPackageSpecificsToValue( |
| 284 const sync_pb::ArcPackageSpecifics& proto) { | 285 const sync_pb::ArcPackageSpecifics& proto) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 303 } | 304 } |
| 304 | 305 |
| 305 std::unique_ptr<base::DictionaryValue> ReadingListSpecificsToValue( | 306 std::unique_ptr<base::DictionaryValue> ReadingListSpecificsToValue( |
| 306 const sync_pb::ReadingListSpecifics& proto) { | 307 const sync_pb::ReadingListSpecifics& proto) { |
| 307 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 308 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 308 SET_STR(entry_id); | 309 SET_STR(entry_id); |
| 309 SET_STR(title); | 310 SET_STR(title); |
| 310 SET_STR(url); | 311 SET_STR(url); |
| 311 SET_INT64(creation_time_us); | 312 SET_INT64(creation_time_us); |
| 312 SET_INT64(update_time_us); | 313 SET_INT64(update_time_us); |
| 313 SET_ENUM(status, GetReadingListEntryStatusString); | 314 SET_ENUM(status, ProtoEnumToString); |
| 314 | 315 |
| 315 return value; | 316 return value; |
| 316 } | 317 } |
| 317 | 318 |
| 318 std::unique_ptr<base::DictionaryValue> AppNotificationToValue( | 319 std::unique_ptr<base::DictionaryValue> AppNotificationToValue( |
| 319 const sync_pb::AppNotification& proto) { | 320 const sync_pb::AppNotification& proto) { |
| 320 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 321 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 321 SET_STR(guid); | 322 SET_STR(guid); |
| 322 SET_STR(app_id); | 323 SET_STR(app_id); |
| 323 SET_INT64(creation_timestamp_ms); | 324 SET_INT64(creation_timestamp_ms); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 343 return value; | 344 return value; |
| 344 } | 345 } |
| 345 | 346 |
| 346 std::unique_ptr<base::DictionaryValue> AppSpecificsToValue( | 347 std::unique_ptr<base::DictionaryValue> AppSpecificsToValue( |
| 347 const sync_pb::AppSpecifics& proto) { | 348 const sync_pb::AppSpecifics& proto) { |
| 348 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 349 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 349 SET(extension, ExtensionSpecificsToValue); | 350 SET(extension, ExtensionSpecificsToValue); |
| 350 SET(notification_settings, AppSettingsToValue); | 351 SET(notification_settings, AppSettingsToValue); |
| 351 SET_STR(app_launch_ordinal); | 352 SET_STR(app_launch_ordinal); |
| 352 SET_STR(page_ordinal); | 353 SET_STR(page_ordinal); |
| 353 SET_ENUM(launch_type, GetLaunchTypeString); | 354 SET_ENUM(launch_type, ProtoEnumToString); |
| 354 SET_STR(bookmark_app_url); | 355 SET_STR(bookmark_app_url); |
| 355 SET_STR(bookmark_app_description); | 356 SET_STR(bookmark_app_description); |
| 356 SET_STR(bookmark_app_icon_color); | 357 SET_STR(bookmark_app_icon_color); |
| 357 SET_REP(linked_app_icons, LinkedAppIconInfoToValue); | 358 SET_REP(linked_app_icons, LinkedAppIconInfoToValue); |
| 358 | 359 |
| 359 return value; | 360 return value; |
| 360 } | 361 } |
| 361 | 362 |
| 362 std::unique_ptr<base::DictionaryValue> AutofillSpecificsToValue( | 363 std::unique_ptr<base::DictionaryValue> AutofillSpecificsToValue( |
| 363 const sync_pb::AutofillSpecifics& proto) { | 364 const sync_pb::AutofillSpecifics& proto) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 SET_STR(address_home_dependent_locality); | 397 SET_STR(address_home_dependent_locality); |
| 397 SET_STR(address_home_language_code); | 398 SET_STR(address_home_language_code); |
| 398 | 399 |
| 399 SET_STR_REP(phone_home_whole_number); | 400 SET_STR_REP(phone_home_whole_number); |
| 400 return value; | 401 return value; |
| 401 } | 402 } |
| 402 | 403 |
| 403 std::unique_ptr<base::DictionaryValue> WalletMetadataSpecificsToValue( | 404 std::unique_ptr<base::DictionaryValue> WalletMetadataSpecificsToValue( |
| 404 const sync_pb::WalletMetadataSpecifics& proto) { | 405 const sync_pb::WalletMetadataSpecifics& proto) { |
| 405 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 406 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 406 SET_ENUM(type, GetWalletMetadataTypeString); | 407 SET_ENUM(type, ProtoEnumToString); |
| 407 SET_STR(id); | 408 SET_STR(id); |
| 408 SET_INT64(use_count); | 409 SET_INT64(use_count); |
| 409 SET_INT64(use_date); | 410 SET_INT64(use_date); |
| 410 return value; | 411 return value; |
| 411 } | 412 } |
| 412 | 413 |
| 413 std::unique_ptr<base::DictionaryValue> AutofillWalletSpecificsToValue( | 414 std::unique_ptr<base::DictionaryValue> AutofillWalletSpecificsToValue( |
| 414 const sync_pb::AutofillWalletSpecifics& proto) { | 415 const sync_pb::AutofillWalletSpecifics& proto) { |
| 415 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 416 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 416 | 417 |
| 417 SET_ENUM(type, GetWalletInfoTypeString); | 418 SET_ENUM(type, ProtoEnumToString); |
| 418 if (proto.type() == sync_pb::AutofillWalletSpecifics::MASKED_CREDIT_CARD) { | 419 if (proto.type() == sync_pb::AutofillWalletSpecifics::MASKED_CREDIT_CARD) { |
| 419 value->Set("masked_card", | 420 value->Set("masked_card", |
| 420 WalletMaskedCreditCardToValue(proto.masked_card())); | 421 WalletMaskedCreditCardToValue(proto.masked_card())); |
| 421 } else if (proto.type() == sync_pb::AutofillWalletSpecifics::POSTAL_ADDRESS) { | 422 } else if (proto.type() == sync_pb::AutofillWalletSpecifics::POSTAL_ADDRESS) { |
| 422 value->Set("address", WalletPostalAddressToValue(proto.address())); | 423 value->Set("address", WalletPostalAddressToValue(proto.address())); |
| 423 } | 424 } |
| 424 return value; | 425 return value; |
| 425 } | 426 } |
| 426 | 427 |
| 427 std::unique_ptr<base::DictionaryValue> MetaInfoToValue( | 428 std::unique_ptr<base::DictionaryValue> MetaInfoToValue( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 442 SET_STR(icon_url); | 443 SET_STR(icon_url); |
| 443 SET_REP(meta_info, &MetaInfoToValue); | 444 SET_REP(meta_info, &MetaInfoToValue); |
| 444 return value; | 445 return value; |
| 445 } | 446 } |
| 446 | 447 |
| 447 std::unique_ptr<base::DictionaryValue> DeviceInfoSpecificsToValue( | 448 std::unique_ptr<base::DictionaryValue> DeviceInfoSpecificsToValue( |
| 448 const sync_pb::DeviceInfoSpecifics& proto) { | 449 const sync_pb::DeviceInfoSpecifics& proto) { |
| 449 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 450 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 450 SET_STR(cache_guid); | 451 SET_STR(cache_guid); |
| 451 SET_STR(client_name); | 452 SET_STR(client_name); |
| 452 SET_ENUM(device_type, GetDeviceTypeString); | 453 SET_ENUM(device_type, ProtoEnumToString); |
| 453 SET_STR(sync_user_agent); | 454 SET_STR(sync_user_agent); |
| 454 SET_STR(chrome_version); | 455 SET_STR(chrome_version); |
| 455 SET_STR(signin_scoped_device_id); | 456 SET_STR(signin_scoped_device_id); |
| 456 return value; | 457 return value; |
| 457 } | 458 } |
| 458 | 459 |
| 459 std::unique_ptr<base::DictionaryValue> DictionarySpecificsToValue( | 460 std::unique_ptr<base::DictionaryValue> DictionarySpecificsToValue( |
| 460 const sync_pb::DictionarySpecifics& proto) { | 461 const sync_pb::DictionarySpecifics& proto) { |
| 461 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 462 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 462 SET_STR(word); | 463 SET_STR(word); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 SET_BOOL(encrypt_apps); | 609 SET_BOOL(encrypt_apps); |
| 609 SET_BOOL(encrypt_search_engines); | 610 SET_BOOL(encrypt_search_engines); |
| 610 SET_BOOL(encrypt_dictionary); | 611 SET_BOOL(encrypt_dictionary); |
| 611 SET_BOOL(encrypt_articles); | 612 SET_BOOL(encrypt_articles); |
| 612 SET_BOOL(encrypt_app_list); | 613 SET_BOOL(encrypt_app_list); |
| 613 SET_BOOL(encrypt_arc_package); | 614 SET_BOOL(encrypt_arc_package); |
| 614 SET_BOOL(encrypt_reading_list); | 615 SET_BOOL(encrypt_reading_list); |
| 615 SET_BOOL(encrypt_everything); | 616 SET_BOOL(encrypt_everything); |
| 616 SET_BOOL(server_only_was_missing_keystore_migration_time); | 617 SET_BOOL(server_only_was_missing_keystore_migration_time); |
| 617 SET_BOOL(sync_tab_favicons); | 618 SET_BOOL(sync_tab_favicons); |
| 618 SET_ENUM(passphrase_type, PassphraseTypeString); | 619 SET_ENUM(passphrase_type, ProtoEnumToString); |
| 619 SET(keystore_decryptor_token, EncryptedDataToValue); | 620 SET(keystore_decryptor_token, EncryptedDataToValue); |
| 620 SET_INT64(keystore_migration_time); | 621 SET_INT64(keystore_migration_time); |
| 621 SET_INT64(custom_passphrase_time); | 622 SET_INT64(custom_passphrase_time); |
| 622 return value; | 623 return value; |
| 623 } | 624 } |
| 624 | 625 |
| 625 std::unique_ptr<base::DictionaryValue> ArticlePageToValue( | 626 std::unique_ptr<base::DictionaryValue> ArticlePageToValue( |
| 626 const sync_pb::ArticlePage& proto) { | 627 const sync_pb::ArticlePage& proto) { |
| 627 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 628 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 628 SET_STR(url); | 629 SET_STR(url); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 SET_BOOL(hidden); | 746 SET_BOOL(hidden); |
| 746 SET_INT64_REP(visits); | 747 SET_INT64_REP(visits); |
| 747 SET_INT32_REP(visit_transitions); | 748 SET_INT32_REP(visit_transitions); |
| 748 return value; | 749 return value; |
| 749 } | 750 } |
| 750 | 751 |
| 751 std::unique_ptr<base::DictionaryValue> WalletMaskedCreditCardToValue( | 752 std::unique_ptr<base::DictionaryValue> WalletMaskedCreditCardToValue( |
| 752 const sync_pb::WalletMaskedCreditCard& proto) { | 753 const sync_pb::WalletMaskedCreditCard& proto) { |
| 753 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 754 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 754 SET_STR(id); | 755 SET_STR(id); |
| 755 SET_ENUM(status, GetWalletCardStatusString); | 756 SET_ENUM(status, ProtoEnumToString); |
| 756 SET_STR(name_on_card); | 757 SET_STR(name_on_card); |
| 757 SET_ENUM(type, GetWalletCardTypeString); | 758 SET_ENUM(type, ProtoEnumToString); |
| 758 SET_STR(last_four); | 759 SET_STR(last_four); |
| 759 SET_INT32(exp_month); | 760 SET_INT32(exp_month); |
| 760 SET_INT32(exp_year); | 761 SET_INT32(exp_year); |
| 761 SET_STR(billing_address_id); | 762 SET_STR(billing_address_id); |
| 762 return value; | 763 return value; |
| 763 } | 764 } |
| 764 | 765 |
| 765 std::unique_ptr<base::DictionaryValue> WalletPostalAddressToValue( | 766 std::unique_ptr<base::DictionaryValue> WalletPostalAddressToValue( |
| 766 const sync_pb::WalletPostalAddress& proto) { | 767 const sync_pb::WalletPostalAddress& proto) { |
| 767 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 768 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 778 SET_STR(country_code); | 779 SET_STR(country_code); |
| 779 SET_STR(phone_number); | 780 SET_STR(phone_number); |
| 780 SET_STR(language_code); | 781 SET_STR(language_code); |
| 781 return value; | 782 return value; |
| 782 } | 783 } |
| 783 | 784 |
| 784 std::unique_ptr<base::DictionaryValue> WifiCredentialSpecificsToValue( | 785 std::unique_ptr<base::DictionaryValue> WifiCredentialSpecificsToValue( |
| 785 const sync_pb::WifiCredentialSpecifics& proto) { | 786 const sync_pb::WifiCredentialSpecifics& proto) { |
| 786 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 787 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 787 SET_BYTES(ssid); | 788 SET_BYTES(ssid); |
| 788 SET_ENUM(security_class, GetWifiCredentialSecurityClassString); | 789 SET_ENUM(security_class, ProtoEnumToString); |
| 789 SET_BYTES(passphrase); | 790 SET_BYTES(passphrase); |
| 790 return value; | 791 return value; |
| 791 } | 792 } |
| 792 | 793 |
| 793 std::unique_ptr<base::DictionaryValue> EntitySpecificsToValue( | 794 std::unique_ptr<base::DictionaryValue> EntitySpecificsToValue( |
| 794 const sync_pb::EntitySpecifics& specifics) { | 795 const sync_pb::EntitySpecifics& specifics) { |
| 795 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 796 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 796 SET_FIELD(app, AppSpecificsToValue); | 797 SET_FIELD(app, AppSpecificsToValue); |
| 797 SET_FIELD(app_list, AppListSpecificsToValue); | 798 SET_FIELD(app_list, AppListSpecificsToValue); |
| 798 SET_FIELD(app_notification, AppNotificationToValue); | 799 SET_FIELD(app_notification, AppNotificationToValue); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 934 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 934 SET_INT32(data_type_id); | 935 SET_INT32(data_type_id); |
| 935 SET_STR(context); | 936 SET_STR(context); |
| 936 SET_INT64(version); | 937 SET_INT64(version); |
| 937 return value; | 938 return value; |
| 938 } | 939 } |
| 939 | 940 |
| 940 std::unique_ptr<base::DictionaryValue> GetUpdatesCallerInfoToValue( | 941 std::unique_ptr<base::DictionaryValue> GetUpdatesCallerInfoToValue( |
| 941 const sync_pb::GetUpdatesCallerInfo& proto) { | 942 const sync_pb::GetUpdatesCallerInfo& proto) { |
| 942 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 943 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 943 SET_ENUM(source, GetUpdatesSourceString); | 944 SET_ENUM(source, ProtoEnumToString); |
| 944 SET_BOOL(notifications_enabled); | 945 SET_BOOL(notifications_enabled); |
| 945 return value; | 946 return value; |
| 946 } | 947 } |
| 947 | 948 |
| 948 std::unique_ptr<base::DictionaryValue> GetUpdatesMessageToValue( | 949 std::unique_ptr<base::DictionaryValue> GetUpdatesMessageToValue( |
| 949 const sync_pb::GetUpdatesMessage& proto) { | 950 const sync_pb::GetUpdatesMessage& proto) { |
| 950 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 951 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 951 SET(caller_info, GetUpdatesCallerInfoToValue); | 952 SET(caller_info, GetUpdatesCallerInfoToValue); |
| 952 SET_BOOL(fetch_folders); | 953 SET_BOOL(fetch_folders); |
| 953 SET_INT32(batch_size); | 954 SET_INT32(batch_size); |
| 954 SET_REP(from_progress_marker, DataTypeProgressMarkerToValue); | 955 SET_REP(from_progress_marker, DataTypeProgressMarkerToValue); |
| 955 SET_BOOL(streaming); | 956 SET_BOOL(streaming); |
| 956 SET_BOOL(need_encryption_key); | 957 SET_BOOL(need_encryption_key); |
| 957 SET_BOOL(create_mobile_bookmarks_folder); | 958 SET_BOOL(create_mobile_bookmarks_folder); |
| 958 SET_ENUM(get_updates_origin, GetUpdatesOriginString); | 959 SET_ENUM(get_updates_origin, ProtoEnumToString); |
| 959 SET_REP(client_contexts, DataTypeContextToValue); | 960 SET_REP(client_contexts, DataTypeContextToValue); |
| 960 return value; | 961 return value; |
| 961 } | 962 } |
| 962 | 963 |
| 963 std::unique_ptr<base::DictionaryValue> ClientStatusToValue( | 964 std::unique_ptr<base::DictionaryValue> ClientStatusToValue( |
| 964 const sync_pb::ClientStatus& proto) { | 965 const sync_pb::ClientStatus& proto) { |
| 965 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 966 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 966 SET_BOOL(hierarchy_conflict_detected); | 967 SET_BOOL(hierarchy_conflict_detected); |
| 967 return value; | 968 return value; |
| 968 } | 969 } |
| 969 | 970 |
| 970 std::unique_ptr<base::DictionaryValue> EntryResponseToValue( | 971 std::unique_ptr<base::DictionaryValue> EntryResponseToValue( |
| 971 const sync_pb::CommitResponse::EntryResponse& proto) { | 972 const sync_pb::CommitResponse::EntryResponse& proto) { |
| 972 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 973 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 973 SET_ENUM(response_type, GetResponseTypeString); | 974 SET_ENUM(response_type, ProtoEnumToString); |
| 974 SET_STR(id_string); | 975 SET_STR(id_string); |
| 975 SET_STR(parent_id_string); | 976 SET_STR(parent_id_string); |
| 976 SET_INT64(position_in_parent); | 977 SET_INT64(position_in_parent); |
| 977 SET_INT64(version); | 978 SET_INT64(version); |
| 978 SET_STR(name); | 979 SET_STR(name); |
| 979 SET_STR(error_message); | 980 SET_STR(error_message); |
| 980 SET_INT64(mtime); | 981 SET_INT64(mtime); |
| 981 return value; | 982 return value; |
| 982 } | 983 } |
| 983 | 984 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1008 SET_INT32(max_commit_batch_size); | 1009 SET_INT32(max_commit_batch_size); |
| 1009 SET_INT32(sessions_commit_delay_seconds); | 1010 SET_INT32(sessions_commit_delay_seconds); |
| 1010 SET_INT32(throttle_delay_seconds); | 1011 SET_INT32(throttle_delay_seconds); |
| 1011 SET_INT32(client_invalidation_hint_buffer_size); | 1012 SET_INT32(client_invalidation_hint_buffer_size); |
| 1012 return value; | 1013 return value; |
| 1013 } | 1014 } |
| 1014 | 1015 |
| 1015 std::unique_ptr<base::DictionaryValue> ErrorToValue( | 1016 std::unique_ptr<base::DictionaryValue> ErrorToValue( |
| 1016 const sync_pb::ClientToServerResponse::Error& proto) { | 1017 const sync_pb::ClientToServerResponse::Error& proto) { |
| 1017 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 1018 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 1018 SET_ENUM(error_type, GetErrorTypeString); | 1019 SET_ENUM(error_type, ProtoEnumToString); |
| 1019 SET_STR(error_description); | 1020 SET_STR(error_description); |
| 1020 SET_STR(url); | 1021 SET_STR(url); |
| 1021 SET_ENUM(action, GetActionString); | 1022 SET_ENUM(action, ProtoEnumToString); |
| 1022 return value; | 1023 return value; |
| 1023 } | 1024 } |
| 1024 | 1025 |
| 1025 } // namespace | 1026 } // namespace |
| 1026 | 1027 |
| 1027 std::unique_ptr<base::DictionaryValue> ClientToServerResponseToValue( | 1028 std::unique_ptr<base::DictionaryValue> ClientToServerResponseToValue( |
| 1028 const sync_pb::ClientToServerResponse& proto, | 1029 const sync_pb::ClientToServerResponse& proto, |
| 1029 bool include_specifics) { | 1030 bool include_specifics) { |
| 1030 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 1031 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 1031 SET(commit, CommitResponseToValue); | 1032 SET(commit, CommitResponseToValue); |
| 1032 if (proto.has_get_updates()) { | 1033 if (proto.has_get_updates()) { |
| 1033 value->Set("get_updates", GetUpdatesResponseToValue(proto.get_updates(), | 1034 value->Set("get_updates", GetUpdatesResponseToValue(proto.get_updates(), |
| 1034 include_specifics)); | 1035 include_specifics)); |
| 1035 } | 1036 } |
| 1036 | 1037 |
| 1037 SET(error, ErrorToValue); | 1038 SET(error, ErrorToValue); |
| 1038 SET_ENUM(error_code, GetErrorTypeString); | 1039 SET_ENUM(error_code, ProtoEnumToString); |
| 1039 SET_STR(error_message); | 1040 SET_STR(error_message); |
| 1040 SET_STR(store_birthday); | 1041 SET_STR(store_birthday); |
| 1041 SET(client_command, ClientCommandToValue); | 1042 SET(client_command, ClientCommandToValue); |
| 1042 SET_INT32_REP(migrated_data_type_id); | 1043 SET_INT32_REP(migrated_data_type_id); |
| 1043 return value; | 1044 return value; |
| 1044 } | 1045 } |
| 1045 | 1046 |
| 1046 std::unique_ptr<base::DictionaryValue> ClientToServerMessageToValue( | 1047 std::unique_ptr<base::DictionaryValue> ClientToServerMessageToValue( |
| 1047 const sync_pb::ClientToServerMessage& proto, | 1048 const sync_pb::ClientToServerMessage& proto, |
| 1048 bool include_specifics) { | 1049 bool include_specifics) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 SET_INT64(download_wait_time_us); | 1083 SET_INT64(download_wait_time_us); |
| 1083 SET_INT64(download_time_us); | 1084 SET_INT64(download_time_us); |
| 1084 SET_INT64(association_wait_time_for_high_priority_us); | 1085 SET_INT64(association_wait_time_for_high_priority_us); |
| 1085 SET_INT64(association_wait_time_for_same_priority_us); | 1086 SET_INT64(association_wait_time_for_same_priority_us); |
| 1086 return value; | 1087 return value; |
| 1087 } | 1088 } |
| 1088 | 1089 |
| 1089 std::unique_ptr<base::DictionaryValue> DebugEventInfoToValue( | 1090 std::unique_ptr<base::DictionaryValue> DebugEventInfoToValue( |
| 1090 const sync_pb::DebugEventInfo& proto) { | 1091 const sync_pb::DebugEventInfo& proto) { |
| 1091 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 1092 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 1092 SET_ENUM(singleton_event, SingletonDebugEventTypeString); | 1093 SET_ENUM(singleton_event, ProtoEnumToString); |
| 1093 SET(sync_cycle_completed_event_info, SyncCycleCompletedEventInfoToValue); | 1094 SET(sync_cycle_completed_event_info, SyncCycleCompletedEventInfoToValue); |
| 1094 SET_INT32(nudging_datatype); | 1095 SET_INT32(nudging_datatype); |
| 1095 SET_INT32_REP(datatypes_notified_from_server); | 1096 SET_INT32_REP(datatypes_notified_from_server); |
| 1096 SET(datatype_association_stats, DatatypeAssociationStatsToValue); | 1097 SET(datatype_association_stats, DatatypeAssociationStatsToValue); |
| 1097 return value; | 1098 return value; |
| 1098 } | 1099 } |
| 1099 | 1100 |
| 1100 std::unique_ptr<base::DictionaryValue> DebugInfoToValue( | 1101 std::unique_ptr<base::DictionaryValue> DebugInfoToValue( |
| 1101 const sync_pb::DebugInfo& proto) { | 1102 const sync_pb::DebugInfo& proto) { |
| 1102 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 1103 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 #undef SET_BOOL | 1159 #undef SET_BOOL |
| 1159 #undef SET_BYTES | 1160 #undef SET_BYTES |
| 1160 #undef SET_INT32 | 1161 #undef SET_INT32 |
| 1161 #undef SET_INT64 | 1162 #undef SET_INT64 |
| 1162 #undef SET_INT64_REP | 1163 #undef SET_INT64_REP |
| 1163 #undef SET_STR | 1164 #undef SET_STR |
| 1164 #undef SET_STR_REP | 1165 #undef SET_STR_REP |
| 1165 | 1166 |
| 1166 #undef SET_FIELD | 1167 #undef SET_FIELD |
| 1167 | 1168 |
| 1169 } // namespace old |
| 1168 } // namespace syncer | 1170 } // namespace syncer |
| OLD | NEW |