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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 const sync_pb::DeviceInfoSpecifics& proto) { | 300 const sync_pb::DeviceInfoSpecifics& proto) { |
300 DictionaryValue* value = new DictionaryValue(); | 301 DictionaryValue* value = new DictionaryValue(); |
301 SET_STR(cache_guid); | 302 SET_STR(cache_guid); |
302 SET_STR(client_name); | 303 SET_STR(client_name); |
303 SET_ENUM(device_type, GetDeviceTypeString); | 304 SET_ENUM(device_type, GetDeviceTypeString); |
304 SET_STR(sync_user_agent); | 305 SET_STR(sync_user_agent); |
305 SET_STR(chrome_version); | 306 SET_STR(chrome_version); |
306 return value; | 307 return value; |
307 } | 308 } |
308 | 309 |
| 310 base::DictionaryValue* DictionarySpecificsToValue( |
| 311 const sync_pb::DictionarySpecifics& proto) { |
| 312 DictionaryValue* value = new DictionaryValue(); |
| 313 SET_STR(word); |
| 314 return value; |
| 315 } |
| 316 |
309 DictionaryValue* ExperimentsSpecificsToValue( | 317 DictionaryValue* ExperimentsSpecificsToValue( |
310 const sync_pb::ExperimentsSpecifics& proto) { | 318 const sync_pb::ExperimentsSpecifics& proto) { |
311 DictionaryValue* value = new DictionaryValue(); | 319 DictionaryValue* value = new DictionaryValue(); |
312 SET(keystore_encryption, KeystoreEncryptionFlagsToValue); | 320 SET(keystore_encryption, KeystoreEncryptionFlagsToValue); |
313 return value; | 321 return value; |
314 } | 322 } |
315 | 323 |
316 DictionaryValue* ExtensionSettingSpecificsToValue( | 324 DictionaryValue* ExtensionSettingSpecificsToValue( |
317 const sync_pb::ExtensionSettingSpecifics& proto) { | 325 const sync_pb::ExtensionSettingSpecifics& proto) { |
318 DictionaryValue* value = new DictionaryValue(); | 326 DictionaryValue* value = new DictionaryValue(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 SET_BOOL(encrypt_autofill_profile); | 360 SET_BOOL(encrypt_autofill_profile); |
353 SET_BOOL(encrypt_autofill); | 361 SET_BOOL(encrypt_autofill); |
354 SET_BOOL(encrypt_themes); | 362 SET_BOOL(encrypt_themes); |
355 SET_BOOL(encrypt_typed_urls); | 363 SET_BOOL(encrypt_typed_urls); |
356 SET_BOOL(encrypt_extension_settings); | 364 SET_BOOL(encrypt_extension_settings); |
357 SET_BOOL(encrypt_extensions); | 365 SET_BOOL(encrypt_extensions); |
358 SET_BOOL(encrypt_sessions); | 366 SET_BOOL(encrypt_sessions); |
359 SET_BOOL(encrypt_app_settings); | 367 SET_BOOL(encrypt_app_settings); |
360 SET_BOOL(encrypt_apps); | 368 SET_BOOL(encrypt_apps); |
361 SET_BOOL(encrypt_search_engines); | 369 SET_BOOL(encrypt_search_engines); |
| 370 SET_BOOL(encrypt_dictionary); |
362 SET_BOOL(encrypt_everything); | 371 SET_BOOL(encrypt_everything); |
363 SET_BOOL(sync_tab_favicons); | 372 SET_BOOL(sync_tab_favicons); |
364 SET_ENUM(passphrase_type, PassphraseTypeString); | 373 SET_ENUM(passphrase_type, PassphraseTypeString); |
365 SET(keystore_decryptor_token, EncryptedDataToValue); | 374 SET(keystore_decryptor_token, EncryptedDataToValue); |
366 SET_INT64(keystore_migration_time); | 375 SET_INT64(keystore_migration_time); |
367 SET_INT64(custom_passphrase_time); | 376 SET_INT64(custom_passphrase_time); |
368 return value; | 377 return value; |
369 } | 378 } |
370 | 379 |
371 DictionaryValue* PasswordSpecificsToValue( | 380 DictionaryValue* PasswordSpecificsToValue( |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 DictionaryValue* EntitySpecificsToValue( | 449 DictionaryValue* EntitySpecificsToValue( |
441 const sync_pb::EntitySpecifics& specifics) { | 450 const sync_pb::EntitySpecifics& specifics) { |
442 DictionaryValue* value = new DictionaryValue(); | 451 DictionaryValue* value = new DictionaryValue(); |
443 SET_FIELD(app, AppSpecificsToValue); | 452 SET_FIELD(app, AppSpecificsToValue); |
444 SET_FIELD(app_notification, AppNotificationToValue); | 453 SET_FIELD(app_notification, AppNotificationToValue); |
445 SET_FIELD(app_setting, AppSettingSpecificsToValue); | 454 SET_FIELD(app_setting, AppSettingSpecificsToValue); |
446 SET_FIELD(autofill, AutofillSpecificsToValue); | 455 SET_FIELD(autofill, AutofillSpecificsToValue); |
447 SET_FIELD(autofill_profile, AutofillProfileSpecificsToValue); | 456 SET_FIELD(autofill_profile, AutofillProfileSpecificsToValue); |
448 SET_FIELD(bookmark, BookmarkSpecificsToValue); | 457 SET_FIELD(bookmark, BookmarkSpecificsToValue); |
449 SET_FIELD(device_info, DeviceInfoSpecificsToValue); | 458 SET_FIELD(device_info, DeviceInfoSpecificsToValue); |
| 459 SET_FIELD(dictionary, DictionarySpecificsToValue); |
450 SET_FIELD(experiments, ExperimentsSpecificsToValue); | 460 SET_FIELD(experiments, ExperimentsSpecificsToValue); |
451 SET_FIELD(extension, ExtensionSpecificsToValue); | 461 SET_FIELD(extension, ExtensionSpecificsToValue); |
452 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); | 462 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); |
453 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue); | 463 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue); |
454 SET_FIELD(nigori, NigoriSpecificsToValue); | 464 SET_FIELD(nigori, NigoriSpecificsToValue); |
455 SET_FIELD(password, PasswordSpecificsToValue); | 465 SET_FIELD(password, PasswordSpecificsToValue); |
456 SET_FIELD(preference, PreferenceSpecificsToValue); | 466 SET_FIELD(preference, PreferenceSpecificsToValue); |
457 SET_FIELD(search_engine, SearchEngineSpecificsToValue); | 467 SET_FIELD(search_engine, SearchEngineSpecificsToValue); |
458 SET_FIELD(session, SessionSpecificsToValue); | 468 SET_FIELD(session, SessionSpecificsToValue); |
459 SET_FIELD(theme, ThemeSpecificsToValue); | 469 SET_FIELD(theme, ThemeSpecificsToValue); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 #undef SET_BYTES | 715 #undef SET_BYTES |
706 #undef SET_INT32 | 716 #undef SET_INT32 |
707 #undef SET_INT64 | 717 #undef SET_INT64 |
708 #undef SET_INT64_REP | 718 #undef SET_INT64_REP |
709 #undef SET_STR | 719 #undef SET_STR |
710 #undef SET_STR_REP | 720 #undef SET_STR_REP |
711 | 721 |
712 #undef SET_FIELD | 722 #undef SET_FIELD |
713 | 723 |
714 } // namespace syncer | 724 } // namespace syncer |
OLD | NEW |