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