| 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 "sync/protocol/proto_value_conversions.h" | 7 #include "sync/protocol/proto_value_conversions.h" |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "sync/protocol/app_notification_specifics.pb.h" | 14 #include "sync/protocol/app_notification_specifics.pb.h" |
| 15 #include "sync/protocol/app_setting_specifics.pb.h" | 15 #include "sync/protocol/app_setting_specifics.pb.h" |
| 16 #include "sync/protocol/app_specifics.pb.h" | 16 #include "sync/protocol/app_specifics.pb.h" |
| 17 #include "sync/protocol/autofill_specifics.pb.h" | 17 #include "sync/protocol/autofill_specifics.pb.h" |
| 18 #include "sync/protocol/bookmark_specifics.pb.h" | 18 #include "sync/protocol/bookmark_specifics.pb.h" |
| 19 #include "sync/protocol/dictionary_specifics.pb.h" |
| 19 #include "sync/protocol/encryption.pb.h" | 20 #include "sync/protocol/encryption.pb.h" |
| 20 #include "sync/protocol/experiments_specifics.pb.h" | 21 #include "sync/protocol/experiments_specifics.pb.h" |
| 21 #include "sync/protocol/extension_setting_specifics.pb.h" | 22 #include "sync/protocol/extension_setting_specifics.pb.h" |
| 22 #include "sync/protocol/extension_specifics.pb.h" | 23 #include "sync/protocol/extension_specifics.pb.h" |
| 23 #include "sync/protocol/history_delete_directive_specifics.pb.h" | 24 #include "sync/protocol/history_delete_directive_specifics.pb.h" |
| 24 #include "sync/protocol/nigori_specifics.pb.h" | 25 #include "sync/protocol/nigori_specifics.pb.h" |
| 25 #include "sync/protocol/password_specifics.pb.h" | 26 #include "sync/protocol/password_specifics.pb.h" |
| 26 #include "sync/protocol/preference_specifics.pb.h" | 27 #include "sync/protocol/preference_specifics.pb.h" |
| 27 #include "sync/protocol/proto_enum_conversions.h" | 28 #include "sync/protocol/proto_enum_conversions.h" |
| 28 #include "sync/protocol/search_engine_specifics.pb.h" | 29 #include "sync/protocol/search_engine_specifics.pb.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 const sync_pb::DeviceInfoSpecifics& proto) { | 304 const sync_pb::DeviceInfoSpecifics& proto) { |
| 304 DictionaryValue* value = new DictionaryValue(); | 305 DictionaryValue* value = new DictionaryValue(); |
| 305 SET_STR(cache_guid); | 306 SET_STR(cache_guid); |
| 306 SET_STR(client_name); | 307 SET_STR(client_name); |
| 307 SET_ENUM(device_type, GetDeviceTypeString); | 308 SET_ENUM(device_type, GetDeviceTypeString); |
| 308 SET_STR(sync_user_agent); | 309 SET_STR(sync_user_agent); |
| 309 SET_STR(chrome_version); | 310 SET_STR(chrome_version); |
| 310 return value; | 311 return value; |
| 311 } | 312 } |
| 312 | 313 |
| 314 base::DictionaryValue* DictionarySpecificsToValue( |
| 315 const sync_pb::DictionarySpecifics& proto) { |
| 316 DictionaryValue* value = new DictionaryValue(); |
| 317 SET_STR(word); |
| 318 return value; |
| 319 } |
| 320 |
| 313 DictionaryValue* ExperimentsSpecificsToValue( | 321 DictionaryValue* ExperimentsSpecificsToValue( |
| 314 const sync_pb::ExperimentsSpecifics& proto) { | 322 const sync_pb::ExperimentsSpecifics& proto) { |
| 315 DictionaryValue* value = new DictionaryValue(); | 323 DictionaryValue* value = new DictionaryValue(); |
| 316 SET(keystore_encryption, KeystoreEncryptionFlagsToValue); | 324 SET(keystore_encryption, KeystoreEncryptionFlagsToValue); |
| 317 return value; | 325 return value; |
| 318 } | 326 } |
| 319 | 327 |
| 320 DictionaryValue* ExtensionSettingSpecificsToValue( | 328 DictionaryValue* ExtensionSettingSpecificsToValue( |
| 321 const sync_pb::ExtensionSettingSpecifics& proto) { | 329 const sync_pb::ExtensionSettingSpecifics& proto) { |
| 322 DictionaryValue* value = new DictionaryValue(); | 330 DictionaryValue* value = new DictionaryValue(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 SET_BOOL(encrypt_autofill_profile); | 364 SET_BOOL(encrypt_autofill_profile); |
| 357 SET_BOOL(encrypt_autofill); | 365 SET_BOOL(encrypt_autofill); |
| 358 SET_BOOL(encrypt_themes); | 366 SET_BOOL(encrypt_themes); |
| 359 SET_BOOL(encrypt_typed_urls); | 367 SET_BOOL(encrypt_typed_urls); |
| 360 SET_BOOL(encrypt_extension_settings); | 368 SET_BOOL(encrypt_extension_settings); |
| 361 SET_BOOL(encrypt_extensions); | 369 SET_BOOL(encrypt_extensions); |
| 362 SET_BOOL(encrypt_sessions); | 370 SET_BOOL(encrypt_sessions); |
| 363 SET_BOOL(encrypt_app_settings); | 371 SET_BOOL(encrypt_app_settings); |
| 364 SET_BOOL(encrypt_apps); | 372 SET_BOOL(encrypt_apps); |
| 365 SET_BOOL(encrypt_search_engines); | 373 SET_BOOL(encrypt_search_engines); |
| 374 SET_BOOL(encrypt_dictionary); |
| 366 SET_BOOL(encrypt_everything); | 375 SET_BOOL(encrypt_everything); |
| 367 SET_BOOL(sync_tab_favicons); | 376 SET_BOOL(sync_tab_favicons); |
| 368 SET_ENUM(passphrase_type, PassphraseTypeString); | 377 SET_ENUM(passphrase_type, PassphraseTypeString); |
| 369 SET(keystore_decryptor_token, EncryptedDataToValue); | 378 SET(keystore_decryptor_token, EncryptedDataToValue); |
| 370 SET_INT64(keystore_migration_time); | 379 SET_INT64(keystore_migration_time); |
| 371 SET_INT64(custom_passphrase_time); | 380 SET_INT64(custom_passphrase_time); |
| 372 return value; | 381 return value; |
| 373 } | 382 } |
| 374 | 383 |
| 375 DictionaryValue* PasswordSpecificsToValue( | 384 DictionaryValue* PasswordSpecificsToValue( |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 DictionaryValue* EntitySpecificsToValue( | 461 DictionaryValue* EntitySpecificsToValue( |
| 453 const sync_pb::EntitySpecifics& specifics) { | 462 const sync_pb::EntitySpecifics& specifics) { |
| 454 DictionaryValue* value = new DictionaryValue(); | 463 DictionaryValue* value = new DictionaryValue(); |
| 455 SET_FIELD(app, AppSpecificsToValue); | 464 SET_FIELD(app, AppSpecificsToValue); |
| 456 SET_FIELD(app_notification, AppNotificationToValue); | 465 SET_FIELD(app_notification, AppNotificationToValue); |
| 457 SET_FIELD(app_setting, AppSettingSpecificsToValue); | 466 SET_FIELD(app_setting, AppSettingSpecificsToValue); |
| 458 SET_FIELD(autofill, AutofillSpecificsToValue); | 467 SET_FIELD(autofill, AutofillSpecificsToValue); |
| 459 SET_FIELD(autofill_profile, AutofillProfileSpecificsToValue); | 468 SET_FIELD(autofill_profile, AutofillProfileSpecificsToValue); |
| 460 SET_FIELD(bookmark, BookmarkSpecificsToValue); | 469 SET_FIELD(bookmark, BookmarkSpecificsToValue); |
| 461 SET_FIELD(device_info, DeviceInfoSpecificsToValue); | 470 SET_FIELD(device_info, DeviceInfoSpecificsToValue); |
| 471 SET_FIELD(dictionary, DictionarySpecificsToValue); |
| 462 SET_FIELD(experiments, ExperimentsSpecificsToValue); | 472 SET_FIELD(experiments, ExperimentsSpecificsToValue); |
| 463 SET_FIELD(extension, ExtensionSpecificsToValue); | 473 SET_FIELD(extension, ExtensionSpecificsToValue); |
| 464 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); | 474 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); |
| 465 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue); | 475 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue); |
| 466 SET_FIELD(nigori, NigoriSpecificsToValue); | 476 SET_FIELD(nigori, NigoriSpecificsToValue); |
| 467 SET_FIELD(password, PasswordSpecificsToValue); | 477 SET_FIELD(password, PasswordSpecificsToValue); |
| 468 SET_FIELD(preference, PreferenceSpecificsToValue); | 478 SET_FIELD(preference, PreferenceSpecificsToValue); |
| 469 SET_FIELD(search_engine, SearchEngineSpecificsToValue); | 479 SET_FIELD(search_engine, SearchEngineSpecificsToValue); |
| 470 SET_FIELD(session, SessionSpecificsToValue); | 480 SET_FIELD(session, SessionSpecificsToValue); |
| 471 SET_FIELD(synced_notification, SyncedNotificationSpecificsToValue); | 481 SET_FIELD(synced_notification, SyncedNotificationSpecificsToValue); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 #undef SET_BYTES | 728 #undef SET_BYTES |
| 719 #undef SET_INT32 | 729 #undef SET_INT32 |
| 720 #undef SET_INT64 | 730 #undef SET_INT64 |
| 721 #undef SET_INT64_REP | 731 #undef SET_INT64_REP |
| 722 #undef SET_STR | 732 #undef SET_STR |
| 723 #undef SET_STR_REP | 733 #undef SET_STR_REP |
| 724 | 734 |
| 725 #undef SET_FIELD | 735 #undef SET_FIELD |
| 726 | 736 |
| 727 } // namespace syncer | 737 } // namespace syncer |
| OLD | NEW |