| 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/encryption.pb.h" | 19 #include "sync/protocol/encryption.pb.h" |
| 20 #include "sync/protocol/experiments_specifics.pb.h" | 20 #include "sync/protocol/experiments_specifics.pb.h" |
| 21 #include "sync/protocol/extension_setting_specifics.pb.h" | 21 #include "sync/protocol/extension_setting_specifics.pb.h" |
| 22 #include "sync/protocol/extension_specifics.pb.h" | 22 #include "sync/protocol/extension_specifics.pb.h" |
| 23 #include "sync/protocol/history_delete_directive_specifics.pb.h" | 23 #include "sync/protocol/history_delete_directive_specifics.pb.h" |
| 24 #include "sync/protocol/nigori_specifics.pb.h" | 24 #include "sync/protocol/nigori_specifics.pb.h" |
| 25 #include "sync/protocol/password_specifics.pb.h" | 25 #include "sync/protocol/password_specifics.pb.h" |
| 26 #include "sync/protocol/preference_specifics.pb.h" | 26 #include "sync/protocol/preference_specifics.pb.h" |
| 27 #include "sync/protocol/priority_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" |
| 29 #include "sync/protocol/session_specifics.pb.h" | 30 #include "sync/protocol/session_specifics.pb.h" |
| 30 #include "sync/protocol/sync.pb.h" | 31 #include "sync/protocol/sync.pb.h" |
| 31 #include "sync/protocol/synced_notification_specifics.pb.h" | 32 #include "sync/protocol/synced_notification_specifics.pb.h" |
| 32 #include "sync/protocol/theme_specifics.pb.h" | 33 #include "sync/protocol/theme_specifics.pb.h" |
| 33 #include "sync/protocol/typed_url_specifics.pb.h" | 34 #include "sync/protocol/typed_url_specifics.pb.h" |
| 34 | 35 |
| 35 namespace syncer { | 36 namespace syncer { |
| 36 | 37 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 const sync_pb::BookmarkSpecifics& proto) { | 293 const sync_pb::BookmarkSpecifics& proto) { |
| 293 DictionaryValue* value = new DictionaryValue(); | 294 DictionaryValue* value = new DictionaryValue(); |
| 294 SET_STR(url); | 295 SET_STR(url); |
| 295 SET_BYTES(favicon); | 296 SET_BYTES(favicon); |
| 296 SET_STR(title); | 297 SET_STR(title); |
| 297 SET_INT64(creation_time_us); | 298 SET_INT64(creation_time_us); |
| 298 SET_STR(icon_url); | 299 SET_STR(icon_url); |
| 299 return value; | 300 return value; |
| 300 } | 301 } |
| 301 | 302 |
| 303 DictionaryValue* PriorityPreferenceSpecificsToValue( |
| 304 const sync_pb::PriorityPreferenceSpecifics& proto) { |
| 305 DictionaryValue* value = new DictionaryValue(); |
| 306 SET_STR(name); |
| 307 SET_STR(value); |
| 308 return value; |
| 309 } |
| 310 |
| 302 DictionaryValue* DeviceInfoSpecificsToValue( | 311 DictionaryValue* DeviceInfoSpecificsToValue( |
| 303 const sync_pb::DeviceInfoSpecifics& proto) { | 312 const sync_pb::DeviceInfoSpecifics& proto) { |
| 304 DictionaryValue* value = new DictionaryValue(); | 313 DictionaryValue* value = new DictionaryValue(); |
| 305 SET_STR(cache_guid); | 314 SET_STR(cache_guid); |
| 306 SET_STR(client_name); | 315 SET_STR(client_name); |
| 307 SET_ENUM(device_type, GetDeviceTypeString); | 316 SET_ENUM(device_type, GetDeviceTypeString); |
| 308 SET_STR(sync_user_agent); | 317 SET_STR(sync_user_agent); |
| 309 SET_STR(chrome_version); | 318 SET_STR(chrome_version); |
| 310 return value; | 319 return value; |
| 311 } | 320 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 462 SET_FIELD(experiments, ExperimentsSpecificsToValue); | 471 SET_FIELD(experiments, ExperimentsSpecificsToValue); |
| 463 SET_FIELD(extension, ExtensionSpecificsToValue); | 472 SET_FIELD(extension, ExtensionSpecificsToValue); |
| 464 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); | 473 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); |
| 465 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue); | 474 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue); |
| 466 SET_FIELD(nigori, NigoriSpecificsToValue); | 475 SET_FIELD(nigori, NigoriSpecificsToValue); |
| 467 SET_FIELD(password, PasswordSpecificsToValue); | 476 SET_FIELD(password, PasswordSpecificsToValue); |
| 468 SET_FIELD(preference, PreferenceSpecificsToValue); | 477 SET_FIELD(preference, PreferenceSpecificsToValue); |
| 478 SET_FIELD(priority_preference, PriorityPreferenceSpecificsToValue); |
| 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); |
| 472 SET_FIELD(theme, ThemeSpecificsToValue); | 482 SET_FIELD(theme, ThemeSpecificsToValue); |
| 473 SET_FIELD(typed_url, TypedUrlSpecificsToValue); | 483 SET_FIELD(typed_url, TypedUrlSpecificsToValue); |
| 474 return value; | 484 return value; |
| 475 } | 485 } |
| 476 | 486 |
| 477 namespace { | 487 namespace { |
| 478 | 488 |
| (...skipping 239 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 |