| 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 <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "sync/protocol/extension_specifics.pb.h" | 27 #include "sync/protocol/extension_specifics.pb.h" |
| 28 #include "sync/protocol/favicon_image_specifics.pb.h" | 28 #include "sync/protocol/favicon_image_specifics.pb.h" |
| 29 #include "sync/protocol/favicon_tracking_specifics.pb.h" | 29 #include "sync/protocol/favicon_tracking_specifics.pb.h" |
| 30 #include "sync/protocol/history_delete_directive_specifics.pb.h" | 30 #include "sync/protocol/history_delete_directive_specifics.pb.h" |
| 31 #include "sync/protocol/nigori_specifics.pb.h" | 31 #include "sync/protocol/nigori_specifics.pb.h" |
| 32 #include "sync/protocol/password_specifics.pb.h" | 32 #include "sync/protocol/password_specifics.pb.h" |
| 33 #include "sync/protocol/preference_specifics.pb.h" | 33 #include "sync/protocol/preference_specifics.pb.h" |
| 34 #include "sync/protocol/priority_preference_specifics.pb.h" | 34 #include "sync/protocol/priority_preference_specifics.pb.h" |
| 35 #include "sync/protocol/proto_enum_conversions.h" | 35 #include "sync/protocol/proto_enum_conversions.h" |
| 36 #include "sync/protocol/search_engine_specifics.pb.h" | 36 #include "sync/protocol/search_engine_specifics.pb.h" |
| 37 #include "sync/protocol/server_app_info_specifics.pb.h" |
| 37 #include "sync/protocol/session_specifics.pb.h" | 38 #include "sync/protocol/session_specifics.pb.h" |
| 38 #include "sync/protocol/sync.pb.h" | 39 #include "sync/protocol/sync.pb.h" |
| 39 #include "sync/protocol/synced_notification_specifics.pb.h" | 40 #include "sync/protocol/synced_notification_specifics.pb.h" |
| 40 #include "sync/protocol/theme_specifics.pb.h" | 41 #include "sync/protocol/theme_specifics.pb.h" |
| 41 #include "sync/protocol/typed_url_specifics.pb.h" | 42 #include "sync/protocol/typed_url_specifics.pb.h" |
| 42 #include "sync/protocol/unique_position.pb.h" | 43 #include "sync/protocol/unique_position.pb.h" |
| 43 | 44 |
| 44 namespace syncer { | 45 namespace syncer { |
| 45 | 46 |
| 46 namespace { | 47 namespace { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 235 } |
| 235 | 236 |
| 236 base::DictionaryValue* TimeRangeDirectiveToValue( | 237 base::DictionaryValue* TimeRangeDirectiveToValue( |
| 237 const sync_pb::TimeRangeDirective& proto) { | 238 const sync_pb::TimeRangeDirective& proto) { |
| 238 base::DictionaryValue* value = new base::DictionaryValue(); | 239 base::DictionaryValue* value = new base::DictionaryValue(); |
| 239 SET_INT64(start_time_usec); | 240 SET_INT64(start_time_usec); |
| 240 SET_INT64(end_time_usec); | 241 SET_INT64(end_time_usec); |
| 241 return value; | 242 return value; |
| 242 } | 243 } |
| 243 | 244 |
| 245 // AppInfo conversion functions. |
| 246 base::DictionaryValue* SyncedNotificationAppInfoToValue( |
| 247 const sync_pb::AppInfo& proto) { |
| 248 base::DictionaryValue* value = new base::DictionaryValue(); |
| 249 SET_STR_REP(app_id); |
| 250 SET_STR(settings_display_name); |
| 251 SET(icon, SyncedNotificationImageToValue); |
| 252 // TODO(petewil): Add fields for the monochrome icon when it is available. |
| 253 return value; |
| 254 } |
| 255 |
| 244 base::DictionaryValue* SyncedNotificationImageToValue( | 256 base::DictionaryValue* SyncedNotificationImageToValue( |
| 245 const sync_pb::SyncedNotificationImage& proto) { | 257 const sync_pb::SyncedNotificationImage& proto) { |
| 246 base::DictionaryValue* value = new base::DictionaryValue(); | 258 base::DictionaryValue* value = new base::DictionaryValue(); |
| 247 SET_STR(url); | 259 SET_STR(url); |
| 248 SET_STR(alt_text); | 260 SET_STR(alt_text); |
| 249 SET_INT32(preferred_width); | 261 SET_INT32(preferred_width); |
| 250 SET_INT32(preferred_height); | 262 SET_INT32(preferred_height); |
| 251 return value; | 263 return value; |
| 252 } | 264 } |
| 253 | 265 |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 return value; | 655 return value; |
| 644 } | 656 } |
| 645 | 657 |
| 646 base::DictionaryValue* PriorityPreferenceSpecificsToValue( | 658 base::DictionaryValue* PriorityPreferenceSpecificsToValue( |
| 647 const sync_pb::PriorityPreferenceSpecifics& specifics) { | 659 const sync_pb::PriorityPreferenceSpecifics& specifics) { |
| 648 base::DictionaryValue* value = new base::DictionaryValue(); | 660 base::DictionaryValue* value = new base::DictionaryValue(); |
| 649 SET_FIELD(preference, PreferenceSpecificsToValue); | 661 SET_FIELD(preference, PreferenceSpecificsToValue); |
| 650 return value; | 662 return value; |
| 651 } | 663 } |
| 652 | 664 |
| 665 base::DictionaryValue* SyncedNotificationAppInfoSpecificsToValue( |
| 666 const sync_pb::AppInfoSpecifics& proto) { |
| 667 base::DictionaryValue* value = new base::DictionaryValue(); |
| 668 SET_REP(app_info, SyncedNotificationAppInfoToValue); |
| 669 return value; |
| 670 } |
| 671 |
| 653 base::DictionaryValue* SyncedNotificationSpecificsToValue( | 672 base::DictionaryValue* SyncedNotificationSpecificsToValue( |
| 654 const sync_pb::SyncedNotificationSpecifics& proto) { | 673 const sync_pb::SyncedNotificationSpecifics& proto) { |
| 655 // There is a lot of data, for now just use heading, description, key, and | 674 // There is a lot of data, for now just use heading, description, key, and |
| 656 // the read state. | 675 // the read state. |
| 657 // TODO(petewil): Eventually add more data here. | 676 // TODO(petewil): Eventually add more data here. |
| 658 base::DictionaryValue* value = new base::DictionaryValue(); | 677 base::DictionaryValue* value = new base::DictionaryValue(); |
| 659 SET(coalesced_notification, CoalescedNotificationToValue); | 678 SET(coalesced_notification, CoalescedNotificationToValue); |
| 660 return value; | 679 return value; |
| 661 } | 680 } |
| 662 | 681 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 SET_BOOL(hidden); | 737 SET_BOOL(hidden); |
| 719 SET_INT64_REP(visits); | 738 SET_INT64_REP(visits); |
| 720 SET_INT32_REP(visit_transitions); | 739 SET_INT32_REP(visit_transitions); |
| 721 return value; | 740 return value; |
| 722 } | 741 } |
| 723 | 742 |
| 724 base::DictionaryValue* EntitySpecificsToValue( | 743 base::DictionaryValue* EntitySpecificsToValue( |
| 725 const sync_pb::EntitySpecifics& specifics) { | 744 const sync_pb::EntitySpecifics& specifics) { |
| 726 base::DictionaryValue* value = new base::DictionaryValue(); | 745 base::DictionaryValue* value = new base::DictionaryValue(); |
| 727 SET_FIELD(app, AppSpecificsToValue); | 746 SET_FIELD(app, AppSpecificsToValue); |
| 747 SET_FIELD(app_info, SyncedNotificationAppInfoSpecificsToValue); |
| 728 SET_FIELD(app_list, AppListSpecificsToValue); | 748 SET_FIELD(app_list, AppListSpecificsToValue); |
| 729 SET_FIELD(app_notification, AppNotificationToValue); | 749 SET_FIELD(app_notification, AppNotificationToValue); |
| 730 SET_FIELD(app_setting, AppSettingSpecificsToValue); | 750 SET_FIELD(app_setting, AppSettingSpecificsToValue); |
| 731 SET_FIELD(article, ArticleSpecificsToValue); | 751 SET_FIELD(article, ArticleSpecificsToValue); |
| 732 SET_FIELD(autofill, AutofillSpecificsToValue); | 752 SET_FIELD(autofill, AutofillSpecificsToValue); |
| 733 SET_FIELD(autofill_profile, AutofillProfileSpecificsToValue); | 753 SET_FIELD(autofill_profile, AutofillProfileSpecificsToValue); |
| 734 SET_FIELD(bookmark, BookmarkSpecificsToValue); | 754 SET_FIELD(bookmark, BookmarkSpecificsToValue); |
| 735 SET_FIELD(device_info, DeviceInfoSpecificsToValue); | 755 SET_FIELD(device_info, DeviceInfoSpecificsToValue); |
| 736 SET_FIELD(dictionary, DictionarySpecificsToValue); | 756 SET_FIELD(dictionary, DictionarySpecificsToValue); |
| 737 SET_FIELD(experiments, ExperimentsSpecificsToValue); | 757 SET_FIELD(experiments, ExperimentsSpecificsToValue); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 #undef SET_BYTES | 1064 #undef SET_BYTES |
| 1045 #undef SET_INT32 | 1065 #undef SET_INT32 |
| 1046 #undef SET_INT64 | 1066 #undef SET_INT64 |
| 1047 #undef SET_INT64_REP | 1067 #undef SET_INT64_REP |
| 1048 #undef SET_STR | 1068 #undef SET_STR |
| 1049 #undef SET_STR_REP | 1069 #undef SET_STR_REP |
| 1050 | 1070 |
| 1051 #undef SET_FIELD | 1071 #undef SET_FIELD |
| 1052 | 1072 |
| 1053 } // namespace syncer | 1073 } // namespace syncer |
| OLD | NEW |