Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: sync/protocol/proto_value_conversions.h

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Keep this file in sync with the .proto files in this directory.
6
7 #ifndef SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_
8 #define SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_
9
10 #include <memory>
11
12 #include "sync/base/sync_export.h"
13
14 namespace base {
15 class DictionaryValue;
16 }
17
18 namespace sync_pb {
19 class AppListSpecifics;
20 class AppNotification;
21 class AppNotificationSettings;
22 class AppSettingSpecifics;
23 class AppSpecifics;
24 class ArcPackageSpecifics;
25 class ArticleSpecifics;
26 class AttachmentIdProto;
27 class AutofillProfileSpecifics;
28 class AutofillSpecifics;
29 class AutofillWalletSpecifics;
30 class BookmarkSpecifics;
31 class ClientConfigParams;
32 class ClientToServerMessage;
33 class ClientToServerResponse;
34 class CollapsedInfo;
35 class DatatypeAssociationStats;
36 class DebugEventInfo;
37 class DebugInfo;
38 class DeviceInfoSpecifics;
39 class DeviceInformation;
40 class DictionarySpecifics;
41 class EncryptedData;
42 class EntitySpecifics;
43 class EverythingDirective;
44 class ExperimentsSpecifics;
45 class ExtensionSettingSpecifics;
46 class ExtensionSpecifics;
47 class FaviconImageSpecifics;
48 class FaviconTrackingSpecifics;
49 class GlobalIdDirective;
50 class HistoryDeleteDirectiveSpecifics;
51 class KeystoreEncryptionFlagsSpecifics;
52 class LinkedAppIconInfo;
53 class ManagedUserSettingSpecifics;
54 class ManagedUserSharedSettingSpecifics;
55 class ManagedUserSpecifics;
56 class ManagedUserWhitelistSpecifics;
57 class Media;
58 class NavigationRedirect;
59 class NigoriSpecifics;
60 class PasswordSpecifics;
61 class PasswordSpecificsData;
62 class PreferenceSpecifics;
63 class PriorityPreferenceSpecifics;
64 class SearchEngineSpecifics;
65 class SessionHeader;
66 class SessionSpecifics;
67 class SessionTab;
68 class SessionWindow;
69 class SimpleCollapsedLayout;
70 class SyncCycleCompletedEventInfo;
71 class SyncEntity;
72 class SyncedNotificationAppInfoSpecifics;
73 class SyncedNotificationSpecifics;
74 class TabNavigation;
75 class Target;
76 class ThemeSpecifics;
77 class TimeRangeDirective;
78 class TypedUrlSpecifics;
79 class WalletMaskedCreditCard;
80 class WalletMetadataSpecifics;
81 class WalletPostalAddress;
82 class WifiCredentialSpecifics;
83 } // namespace sync_pb
84
85 // Utility functions to convert sync protocol buffers to dictionaries.
86 // Each protocol field is mapped to a key of the same name. Repeated
87 // fields are mapped to array values and sub-messages are mapped to
88 // sub-dictionary values.
89 //
90 // TODO(akalin): Add has_* information.
91 //
92 // TODO(akalin): Improve enum support.
93
94 namespace syncer {
95
96 // Ownership of all returned DictionaryValues are transferred to the
97 // caller.
98
99 // TODO(akalin): Perhaps extend this to decrypt?
100 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> EncryptedDataToValue(
101 const sync_pb::EncryptedData& encrypted_data);
102
103 // Sub-protocol of AppListSpecifics.
104 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> AppListSpecificsToValue(
105 const sync_pb::AppListSpecifics& proto);
106
107 // Sub-protocols of AppSpecifics.
108 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> AppSettingsToValue(
109 const sync_pb::AppNotificationSettings& app_notification_settings);
110
111 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> LinkedAppIconInfoToValue(
112 const sync_pb::LinkedAppIconInfo& linked_app_icon_info);
113
114 // Sub-protocol of ArcPackageSpecifics.
115 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> ArcPackageSpecificsToValue(
116 const sync_pb::ArcPackageSpecifics& proto);
117
118 // Sub-protocols of SessionSpecifics.
119
120 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> SessionHeaderToValue(
121 const sync_pb::SessionHeader& session_header);
122
123 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> SessionTabToValue(
124 const sync_pb::SessionTab& session_tab);
125
126 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> SessionWindowToValue(
127 const sync_pb::SessionWindow& session_window);
128
129 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> TabNavigationToValue(
130 const sync_pb::TabNavigation& tab_navigation);
131
132 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> NavigationRedirectToValue(
133 const sync_pb::NavigationRedirect& navigation_redirect);
134
135 // Sub-protocol of PasswordSpecifics.
136
137 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> PasswordSpecificsDataToValue(
138 const sync_pb::PasswordSpecificsData& password_specifics_data);
139
140 // Sub-protocol of NigoriSpecifics.
141
142 std::unique_ptr<base::DictionaryValue> DeviceInformationToValue(
143 const sync_pb::DeviceInformation& device_information);
144
145 // Sub-protocol of HistoryDeleteDirectiveSpecifics.
146
147 std::unique_ptr<base::DictionaryValue> GlobalIdDirectiveToValue(
148 const sync_pb::GlobalIdDirective& global_id_directive);
149
150 std::unique_ptr<base::DictionaryValue> TimeRangeDirectiveToValue(
151 const sync_pb::TimeRangeDirective& time_range_directive);
152
153 // Sub-protocol of Experiments.
154
155 std::unique_ptr<base::DictionaryValue> KeystoreEncryptionToValue(
156 const sync_pb::KeystoreEncryptionFlagsSpecifics& proto);
157
158 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> SessionSpecificsToValue(
159 const sync_pb::SessionSpecifics& session_specifics);
160
161 // Main *SpecificsToValue functions.
162
163 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> AppNotificationToValue(
164 const sync_pb::AppNotification& app_notification_specifics);
165
166 std::unique_ptr<base::DictionaryValue> AppSettingSpecificsToValue(
167 const sync_pb::AppSettingSpecifics& app_setting_specifics);
168
169 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> AppSpecificsToValue(
170 const sync_pb::AppSpecifics& app_specifics);
171
172 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> ArticleSpecificsToValue(
173 const sync_pb::ArticleSpecifics& article_specifics);
174
175 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> AutofillSpecificsToValue(
176 const sync_pb::AutofillSpecifics& autofill_specifics);
177
178 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
179 AutofillProfileSpecificsToValue(
180 const sync_pb::AutofillProfileSpecifics& autofill_profile_specifics);
181
182 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
183 WalletMetadataSpecificsToValue(
184 const sync_pb::WalletMetadataSpecifics& wallet_metadata_specifics);
185
186 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
187 AutofillWalletSpecificsToValue(
188 const sync_pb::AutofillWalletSpecifics& autofill_wallet_specifics);
189
190 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> BookmarkSpecificsToValue(
191 const sync_pb::BookmarkSpecifics& bookmark_specifics);
192
193 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> DeviceInfoSpecificsToValue(
194 const sync_pb::DeviceInfoSpecifics& device_info_specifics);
195
196 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> DictionarySpecificsToValue(
197 const sync_pb::DictionarySpecifics& dictionary_specifics);
198
199 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> ExperimentsSpecificsToValue(
200 const sync_pb::ExperimentsSpecifics& proto);
201
202 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
203 PriorityPreferenceSpecificsToValue(
204 const sync_pb::PriorityPreferenceSpecifics& proto);
205
206 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
207 ExtensionSettingSpecificsToValue(
208 const sync_pb::ExtensionSettingSpecifics& extension_setting_specifics);
209
210 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> ExtensionSpecificsToValue(
211 const sync_pb::ExtensionSpecifics& extension_specifics);
212
213 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> FaviconImageSpecificsToValue(
214 const sync_pb::FaviconImageSpecifics& favicon_image_specifics);
215
216 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
217 FaviconTrackingSpecificsToValue(
218 const sync_pb::FaviconTrackingSpecifics& favicon_tracking_specifics);
219
220 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
221 HistoryDeleteDirectiveSpecificsToValue(
222 const sync_pb::HistoryDeleteDirectiveSpecifics&
223 history_delete_directive_specifics);
224
225 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
226 ManagedUserSettingSpecificsToValue(
227 const sync_pb::ManagedUserSettingSpecifics& managed_user_setting_specifics);
228
229 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> ManagedUserSpecificsToValue(
230 const sync_pb::ManagedUserSpecifics& managed_user_specifics);
231
232 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
233 ManagedUserSharedSettingSpecificsToValue(
234 const sync_pb::ManagedUserSharedSettingSpecifics&
235 managed_user_shared_setting_specifics);
236
237 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
238 ManagedUserWhitelistSpecificsToValue(
239 const sync_pb::ManagedUserWhitelistSpecifics&
240 managed_user_whitelist_specifics);
241
242 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> MediaToValue(
243 const sync_pb::Media& media);
244
245 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> NigoriSpecificsToValue(
246 const sync_pb::NigoriSpecifics& nigori_specifics);
247
248 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> PasswordSpecificsToValue(
249 const sync_pb::PasswordSpecifics& password_specifics);
250
251 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> PreferenceSpecificsToValue(
252 const sync_pb::PreferenceSpecifics& password_specifics);
253
254 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
255 SyncedNotificationAppInfoSpecificsToValue(
256 const sync_pb::SyncedNotificationAppInfoSpecifics&
257 synced_notification_specifics);
258
259 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
260 SyncedNotificationSpecificsToValue(
261 const sync_pb::SyncedNotificationSpecifics& synced_notification_specifics);
262
263 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> SearchEngineSpecificsToValue(
264 const sync_pb::SearchEngineSpecifics& search_engine_specifics);
265
266 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> ThemeSpecificsToValue(
267 const sync_pb::ThemeSpecifics& theme_specifics);
268
269 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> TypedUrlSpecificsToValue(
270 const sync_pb::TypedUrlSpecifics& typed_url_specifics);
271
272 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
273 WalletMaskedCreditCardToValue(
274 const sync_pb::WalletMaskedCreditCard& wallet_masked_card);
275
276 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> WalletPostalAddressToValue(
277 const sync_pb::WalletPostalAddress& wallet_postal_address);
278
279 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
280 WifiCredentialSpecificsToValue(
281 const sync_pb::WifiCredentialSpecifics& wifi_credential_specifics);
282
283 // Any present extensions are mapped to sub-dictionary values with the
284 // key equal to the extension name.
285 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> EntitySpecificsToValue(
286 const sync_pb::EntitySpecifics& specifics);
287
288 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> SyncEntityToValue(
289 const sync_pb::SyncEntity& entity,
290 bool include_specifics);
291
292 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> ClientToServerMessageToValue(
293 const sync_pb::ClientToServerMessage& proto,
294 bool include_specifics);
295
296 SYNC_EXPORT std::unique_ptr<base::DictionaryValue>
297 ClientToServerResponseToValue(const sync_pb::ClientToServerResponse& proto,
298 bool include_specifics);
299
300 std::unique_ptr<base::DictionaryValue> DatatypeAssociationStatsToValue(
301 const sync_pb::DatatypeAssociationStats& proto);
302
303 std::unique_ptr<base::DictionaryValue> DebugEventInfoToValue(
304 const sync_pb::DebugEventInfo& proto);
305
306 std::unique_ptr<base::DictionaryValue> DebugInfoToValue(
307 const sync_pb::DebugInfo& proto);
308
309 std::unique_ptr<base::DictionaryValue> SyncCycleCompletedEventInfoToValue(
310 const sync_pb::SyncCycleCompletedEventInfo& proto);
311
312 std::unique_ptr<base::DictionaryValue> ClientConfigParamsToValue(
313 const sync_pb::ClientConfigParams& proto);
314
315 SYNC_EXPORT std::unique_ptr<base::DictionaryValue> AttachmentIdProtoToValue(
316 const sync_pb::AttachmentIdProto& proto);
317
318 } // namespace syncer
319
320 #endif // SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_
OLDNEW
« no previous file with comments | « sync/protocol/proto_enum_conversions_unittest.cc ('k') | sync/protocol/proto_value_conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698