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 base::DictionaryValue* SyncedNotificationAppInfoToValue( |
| 246 const sync_pb::SyncedNotificationAppInfo& proto) { |
| 247 base::DictionaryValue* value = new base::DictionaryValue(); |
| 248 SET_STR_REP(app_id); |
| 249 SET_STR(settings_display_name); |
| 250 SET(icon, SyncedNotificationImageToValue); |
| 251 // TODO(petewil): Add fields for the monochrome icon when it is available. |
| 252 return value; |
| 253 } |
| 254 |
244 base::DictionaryValue* SyncedNotificationImageToValue( | 255 base::DictionaryValue* SyncedNotificationImageToValue( |
245 const sync_pb::SyncedNotificationImage& proto) { | 256 const sync_pb::SyncedNotificationImage& proto) { |
246 base::DictionaryValue* value = new base::DictionaryValue(); | 257 base::DictionaryValue* value = new base::DictionaryValue(); |
247 SET_STR(url); | 258 SET_STR(url); |
248 SET_STR(alt_text); | 259 SET_STR(alt_text); |
249 SET_INT32(preferred_width); | 260 SET_INT32(preferred_width); |
250 SET_INT32(preferred_height); | 261 SET_INT32(preferred_height); |
251 return value; | 262 return value; |
252 } | 263 } |
253 | 264 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 return value; | 654 return value; |
644 } | 655 } |
645 | 656 |
646 base::DictionaryValue* PriorityPreferenceSpecificsToValue( | 657 base::DictionaryValue* PriorityPreferenceSpecificsToValue( |
647 const sync_pb::PriorityPreferenceSpecifics& specifics) { | 658 const sync_pb::PriorityPreferenceSpecifics& specifics) { |
648 base::DictionaryValue* value = new base::DictionaryValue(); | 659 base::DictionaryValue* value = new base::DictionaryValue(); |
649 SET_FIELD(preference, PreferenceSpecificsToValue); | 660 SET_FIELD(preference, PreferenceSpecificsToValue); |
650 return value; | 661 return value; |
651 } | 662 } |
652 | 663 |
| 664 base::DictionaryValue* SyncedNotificationAppInfoSpecificsToValue( |
| 665 const sync_pb::SyncedNotificationAppInfoSpecifics& proto) { |
| 666 base::DictionaryValue* value = new base::DictionaryValue(); |
| 667 SET_REP(synced_notification_app_info, SyncedNotificationAppInfoToValue); |
| 668 return value; |
| 669 } |
| 670 |
653 base::DictionaryValue* SyncedNotificationSpecificsToValue( | 671 base::DictionaryValue* SyncedNotificationSpecificsToValue( |
654 const sync_pb::SyncedNotificationSpecifics& proto) { | 672 const sync_pb::SyncedNotificationSpecifics& proto) { |
655 // There is a lot of data, for now just use heading, description, key, and | 673 // There is a lot of data, for now just use heading, description, key, and |
656 // the read state. | 674 // the read state. |
657 // TODO(petewil): Eventually add more data here. | 675 // TODO(petewil): Eventually add more data here. |
658 base::DictionaryValue* value = new base::DictionaryValue(); | 676 base::DictionaryValue* value = new base::DictionaryValue(); |
659 SET(coalesced_notification, CoalescedNotificationToValue); | 677 SET(coalesced_notification, CoalescedNotificationToValue); |
660 return value; | 678 return value; |
661 } | 679 } |
662 | 680 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 SET_FIELD(managed_user_shared_setting, | 762 SET_FIELD(managed_user_shared_setting, |
745 ManagedUserSharedSettingSpecificsToValue); | 763 ManagedUserSharedSettingSpecificsToValue); |
746 SET_FIELD(managed_user, ManagedUserSpecificsToValue); | 764 SET_FIELD(managed_user, ManagedUserSpecificsToValue); |
747 SET_FIELD(nigori, NigoriSpecificsToValue); | 765 SET_FIELD(nigori, NigoriSpecificsToValue); |
748 SET_FIELD(password, PasswordSpecificsToValue); | 766 SET_FIELD(password, PasswordSpecificsToValue); |
749 SET_FIELD(preference, PreferenceSpecificsToValue); | 767 SET_FIELD(preference, PreferenceSpecificsToValue); |
750 SET_FIELD(priority_preference, PriorityPreferenceSpecificsToValue); | 768 SET_FIELD(priority_preference, PriorityPreferenceSpecificsToValue); |
751 SET_FIELD(search_engine, SearchEngineSpecificsToValue); | 769 SET_FIELD(search_engine, SearchEngineSpecificsToValue); |
752 SET_FIELD(session, SessionSpecificsToValue); | 770 SET_FIELD(session, SessionSpecificsToValue); |
753 SET_FIELD(synced_notification, SyncedNotificationSpecificsToValue); | 771 SET_FIELD(synced_notification, SyncedNotificationSpecificsToValue); |
| 772 SET_FIELD(synced_notification_app_info, |
| 773 SyncedNotificationAppInfoSpecificsToValue); |
754 SET_FIELD(theme, ThemeSpecificsToValue); | 774 SET_FIELD(theme, ThemeSpecificsToValue); |
755 SET_FIELD(typed_url, TypedUrlSpecificsToValue); | 775 SET_FIELD(typed_url, TypedUrlSpecificsToValue); |
756 return value; | 776 return value; |
757 } | 777 } |
758 | 778 |
759 namespace { | 779 namespace { |
760 | 780 |
761 base::StringValue* UniquePositionToStringValue( | 781 base::StringValue* UniquePositionToStringValue( |
762 const sync_pb::UniquePosition& proto) { | 782 const sync_pb::UniquePosition& proto) { |
763 UniquePosition pos = UniquePosition::FromProto(proto); | 783 UniquePosition pos = UniquePosition::FromProto(proto); |
(...skipping 280 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 |