| 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 #ifndef SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_ | 7 #ifndef SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_ |
| 8 #define SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_ | 8 #define SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_ |
| 9 | 9 |
| 10 namespace base { | 10 namespace base { |
| 11 class DictionaryValue; | 11 class DictionaryValue; |
| 12 } | 12 } |
| 13 | 13 |
| 14 namespace sync_pb { | 14 namespace sync_pb { |
| 15 class AppNotification; | 15 class AppNotification; |
| 16 class AppNotificationSettings; | 16 class AppNotificationSettings; |
| 17 class AppSettingSpecifics; | 17 class AppSettingSpecifics; |
| 18 class AppSpecifics; | 18 class AppSpecifics; |
| 19 class AutofillProfileSpecifics; | 19 class AutofillProfileSpecifics; |
| 20 class AutofillSpecifics; | 20 class AutofillSpecifics; |
| 21 class BookmarkSpecifics; | 21 class BookmarkSpecifics; |
| 22 class ClientToServerMessage; | 22 class ClientToServerMessage; |
| 23 class ClientToServerResponse; | 23 class ClientToServerResponse; |
| 24 class DeviceInfoSpecifics; | 24 class DeviceInfoSpecifics; |
| 25 class DeviceInformation; | 25 class DeviceInformation; |
| 26 class EncryptedData; | 26 class EncryptedData; |
| 27 class EntitySpecifics; | 27 class EntitySpecifics; |
| 28 class EverythingDirective; |
| 28 class ExtensionSettingSpecifics; | 29 class ExtensionSettingSpecifics; |
| 29 class ExtensionSpecifics; | 30 class ExtensionSpecifics; |
| 31 class GlobalIdDirective; |
| 32 class HistoryDeleteDirectiveSpecifics; |
| 30 class NigoriSpecifics; | 33 class NigoriSpecifics; |
| 31 class PasswordSpecifics; | 34 class PasswordSpecifics; |
| 32 class PasswordSpecificsData; | 35 class PasswordSpecificsData; |
| 33 class PreferenceSpecifics; | 36 class PreferenceSpecifics; |
| 34 class SearchEngineSpecifics; | 37 class SearchEngineSpecifics; |
| 35 class SessionHeader; | 38 class SessionHeader; |
| 36 class SessionSpecifics; | 39 class SessionSpecifics; |
| 37 class SessionTab; | 40 class SessionTab; |
| 38 class SessionWindow; | 41 class SessionWindow; |
| 39 class TabNavigation; | 42 class TabNavigation; |
| 40 class ThemeSpecifics; | 43 class ThemeSpecifics; |
| 44 class TimeRangeDirective; |
| 41 class TypedUrlSpecifics; | 45 class TypedUrlSpecifics; |
| 42 } // namespace sync_pb | 46 } // namespace sync_pb |
| 43 | 47 |
| 44 // Utility functions to convert sync protocol buffers to dictionaries. | 48 // Utility functions to convert sync protocol buffers to dictionaries. |
| 45 // Each protocol field is mapped to a key of the same name. Repeated | 49 // Each protocol field is mapped to a key of the same name. Repeated |
| 46 // fields are mapped to array values and sub-messages are mapped to | 50 // fields are mapped to array values and sub-messages are mapped to |
| 47 // sub-dictionary values. | 51 // sub-dictionary values. |
| 48 // | 52 // |
| 49 // TODO(akalin): Add has_* information. | 53 // TODO(akalin): Add has_* information. |
| 50 // | 54 // |
| (...skipping 24 matching lines...) Expand all Loading... |
| 75 const sync_pb::SessionWindow& session_window); | 79 const sync_pb::SessionWindow& session_window); |
| 76 | 80 |
| 77 base::DictionaryValue* TabNavigationToValue( | 81 base::DictionaryValue* TabNavigationToValue( |
| 78 const sync_pb::TabNavigation& tab_navigation); | 82 const sync_pb::TabNavigation& tab_navigation); |
| 79 | 83 |
| 80 // Sub-protocol of PasswordSpecifics. | 84 // Sub-protocol of PasswordSpecifics. |
| 81 | 85 |
| 82 base::DictionaryValue* PasswordSpecificsDataToValue( | 86 base::DictionaryValue* PasswordSpecificsDataToValue( |
| 83 const sync_pb::PasswordSpecificsData& password_specifics_data); | 87 const sync_pb::PasswordSpecificsData& password_specifics_data); |
| 84 | 88 |
| 89 // Sub-protocol of NigoriSpecifics. |
| 90 |
| 91 base::DictionaryValue* DeviceInformationToValue( |
| 92 const sync_pb::DeviceInformation& device_information); |
| 93 |
| 94 // Sub-protocol of HistoryDeleteDirectiveSpecifics. |
| 95 |
| 96 base::DictionaryValue* GlobalIdDirectiveToValue( |
| 97 const sync_pb::GlobalIdDirective& global_id_directive); |
| 98 |
| 99 base::DictionaryValue* TimeRangeDirectiveToValue( |
| 100 const sync_pb::TimeRangeDirective& time_range_directive); |
| 101 |
| 102 base::DictionaryValue* EverythingDirectiveToValue( |
| 103 const sync_pb::EverythingDirective& everything_directive); |
| 104 |
| 85 // Main *SpecificsToValue functions. | 105 // Main *SpecificsToValue functions. |
| 86 | 106 |
| 87 base::DictionaryValue* AppNotificationToValue( | 107 base::DictionaryValue* AppNotificationToValue( |
| 88 const sync_pb::AppNotification& app_notification_specifics); | 108 const sync_pb::AppNotification& app_notification_specifics); |
| 89 | 109 |
| 90 base::DictionaryValue* AppSettingSpecificsToValue( | 110 base::DictionaryValue* AppSettingSpecificsToValue( |
| 91 const sync_pb::AppSettingSpecifics& app_setting_specifics); | 111 const sync_pb::AppSettingSpecifics& app_setting_specifics); |
| 92 | 112 |
| 93 base::DictionaryValue* AppSpecificsToValue( | 113 base::DictionaryValue* AppSpecificsToValue( |
| 94 const sync_pb::AppSpecifics& app_specifics); | 114 const sync_pb::AppSpecifics& app_specifics); |
| 95 | 115 |
| 96 base::DictionaryValue* AutofillSpecificsToValue( | 116 base::DictionaryValue* AutofillSpecificsToValue( |
| 97 const sync_pb::AutofillSpecifics& autofill_specifics); | 117 const sync_pb::AutofillSpecifics& autofill_specifics); |
| 98 | 118 |
| 99 base::DictionaryValue* AutofillProfileSpecificsToValue( | 119 base::DictionaryValue* AutofillProfileSpecificsToValue( |
| 100 const sync_pb::AutofillProfileSpecifics& autofill_profile_specifics); | 120 const sync_pb::AutofillProfileSpecifics& autofill_profile_specifics); |
| 101 | 121 |
| 102 base::DictionaryValue* BookmarkSpecificsToValue( | 122 base::DictionaryValue* BookmarkSpecificsToValue( |
| 103 const sync_pb::BookmarkSpecifics& bookmark_specifics); | 123 const sync_pb::BookmarkSpecifics& bookmark_specifics); |
| 104 | 124 |
| 105 base::DictionaryValue* ExtensionSettingSpecificsToValue( | 125 base::DictionaryValue* ExtensionSettingSpecificsToValue( |
| 106 const sync_pb::ExtensionSettingSpecifics& extension_setting_specifics); | 126 const sync_pb::ExtensionSettingSpecifics& extension_setting_specifics); |
| 107 | 127 |
| 108 base::DictionaryValue* ExtensionSpecificsToValue( | 128 base::DictionaryValue* ExtensionSpecificsToValue( |
| 109 const sync_pb::ExtensionSpecifics& extension_specifics); | 129 const sync_pb::ExtensionSpecifics& extension_specifics); |
| 110 | 130 |
| 131 base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue( |
| 132 const sync_pb::HistoryDeleteDirectiveSpecifics& |
| 133 history_delete_directive_specifics); |
| 134 |
| 111 base::DictionaryValue* NigoriSpecificsToValue( | 135 base::DictionaryValue* NigoriSpecificsToValue( |
| 112 const sync_pb::NigoriSpecifics& nigori_specifics); | 136 const sync_pb::NigoriSpecifics& nigori_specifics); |
| 113 | 137 |
| 114 base::DictionaryValue* PasswordSpecificsToValue( | 138 base::DictionaryValue* PasswordSpecificsToValue( |
| 115 const sync_pb::PasswordSpecifics& password_specifics); | 139 const sync_pb::PasswordSpecifics& password_specifics); |
| 116 | 140 |
| 117 base::DictionaryValue* DeviceInfoSpecificsToValue( | 141 base::DictionaryValue* DeviceInfoSpecificsToValue( |
| 118 const sync_pb::DeviceInfoSpecifics& device_info_specifics); | 142 const sync_pb::DeviceInfoSpecifics& device_info_specifics); |
| 119 | 143 |
| 120 base::DictionaryValue* PreferenceSpecificsToValue( | 144 base::DictionaryValue* PreferenceSpecificsToValue( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 142 bool include_specifics); | 166 bool include_specifics); |
| 143 | 167 |
| 144 base::DictionaryValue* ClientToServerResponseToValue( | 168 base::DictionaryValue* ClientToServerResponseToValue( |
| 145 const sync_pb::ClientToServerResponse& proto, | 169 const sync_pb::ClientToServerResponse& proto, |
| 146 bool include_specifics); | 170 bool include_specifics); |
| 147 | 171 |
| 148 | 172 |
| 149 } // namespace syncer | 173 } // namespace syncer |
| 150 | 174 |
| 151 #endif // SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_ | 175 #endif // SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_ |
| OLD | NEW |