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 18 matching lines...) Expand all Loading... | |
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/session_specifics.pb.h" | 37 #include "sync/protocol/session_specifics.pb.h" |
38 #include "sync/protocol/sync.pb.h" | 38 #include "sync/protocol/sync.pb.h" |
39 #include "sync/protocol/synced_notification_app_info_specifics.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 { |
47 | 48 |
48 // Basic Type -> Value functions. | 49 // Basic Type -> Value functions. |
(...skipping 185 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. | |
Nicolas Zea
2014/01/28 08:21:03
nit: no need for this comment
| |
246 base::DictionaryValue* SyncedNotificationAppInfoToValue( | |
247 const sync_pb::SyncedNotificationAppInfo& 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::SyncedNotificationAppInfoSpecifics& proto) { | |
667 base::DictionaryValue* value = new base::DictionaryValue(); | |
668 SET_REP(synced_notification_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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
744 SET_FIELD(managed_user_shared_setting, | 763 SET_FIELD(managed_user_shared_setting, |
745 ManagedUserSharedSettingSpecificsToValue); | 764 ManagedUserSharedSettingSpecificsToValue); |
746 SET_FIELD(managed_user, ManagedUserSpecificsToValue); | 765 SET_FIELD(managed_user, ManagedUserSpecificsToValue); |
747 SET_FIELD(nigori, NigoriSpecificsToValue); | 766 SET_FIELD(nigori, NigoriSpecificsToValue); |
748 SET_FIELD(password, PasswordSpecificsToValue); | 767 SET_FIELD(password, PasswordSpecificsToValue); |
749 SET_FIELD(preference, PreferenceSpecificsToValue); | 768 SET_FIELD(preference, PreferenceSpecificsToValue); |
750 SET_FIELD(priority_preference, PriorityPreferenceSpecificsToValue); | 769 SET_FIELD(priority_preference, PriorityPreferenceSpecificsToValue); |
751 SET_FIELD(search_engine, SearchEngineSpecificsToValue); | 770 SET_FIELD(search_engine, SearchEngineSpecificsToValue); |
752 SET_FIELD(session, SessionSpecificsToValue); | 771 SET_FIELD(session, SessionSpecificsToValue); |
753 SET_FIELD(synced_notification, SyncedNotificationSpecificsToValue); | 772 SET_FIELD(synced_notification, SyncedNotificationSpecificsToValue); |
773 SET_FIELD(synced_notification_app_info, | |
774 SyncedNotificationAppInfoSpecificsToValue); | |
754 SET_FIELD(theme, ThemeSpecificsToValue); | 775 SET_FIELD(theme, ThemeSpecificsToValue); |
755 SET_FIELD(typed_url, TypedUrlSpecificsToValue); | 776 SET_FIELD(typed_url, TypedUrlSpecificsToValue); |
756 return value; | 777 return value; |
757 } | 778 } |
758 | 779 |
759 namespace { | 780 namespace { |
760 | 781 |
761 base::StringValue* UniquePositionToStringValue( | 782 base::StringValue* UniquePositionToStringValue( |
762 const sync_pb::UniquePosition& proto) { | 783 const sync_pb::UniquePosition& proto) { |
763 UniquePosition pos = UniquePosition::FromProto(proto); | 784 UniquePosition pos = UniquePosition::FromProto(proto); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1044 #undef SET_BYTES | 1065 #undef SET_BYTES |
1045 #undef SET_INT32 | 1066 #undef SET_INT32 |
1046 #undef SET_INT64 | 1067 #undef SET_INT64 |
1047 #undef SET_INT64_REP | 1068 #undef SET_INT64_REP |
1048 #undef SET_STR | 1069 #undef SET_STR |
1049 #undef SET_STR_REP | 1070 #undef SET_STR_REP |
1050 | 1071 |
1051 #undef SET_FIELD | 1072 #undef SET_FIELD |
1052 | 1073 |
1053 } // namespace syncer | 1074 } // namespace syncer |
OLD | NEW |