File: proto_value_conversions.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (360 lines) | stat: -rw-r--r-- 12,131 bytes parent folder | download | duplicates (6)
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_
#define COMPONENTS_SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_

namespace base {
class Value;
}

namespace sync_pb {
class AppListSpecifics;
class AppSettingSpecifics;
class AppSpecifics;
class ArcPackageSpecifics;
class AutofillProfileSpecifics;
class AutofillSpecifics;
class AutofillOfferSpecifics;
class AutofillWalletCredentialSpecifics;
class AutofillWalletSpecifics;
class AutofillWalletUsageSpecifics;
class BankAccountDetails;
class BookmarkSpecifics;
class ClientConfigParams;
class ClientToServerMessage;
class ClientToServerResponse;
class CollaborationGroupSpecifics;
class ContactInfoSpecifics;
class CookieSpecifics;
class CrossUserSharingPublicKey;
class DebugEventInfo;
class DebugInfo;
class DeviceDetails;
class DeviceInfoSpecifics;
class DictionarySpecifics;
class EncryptedData;
class EntityMetadata;
class EntitySpecifics;
class EwalletDetails;
class ExtensionSettingSpecifics;
class ExtensionSpecifics;
class HistoryDeleteDirectiveSpecifics;
class HistorySpecifics;
class IncomingPasswordSharingInvitationSpecifics;
class LinkedAppIconInfo;
class ManagedUserSettingSpecifics;
class NavigationRedirect;
class NigoriSpecifics;
class OsPreferenceSpecifics;
class OsPriorityPreferenceSpecifics;
class OutgoingPasswordSharingInvitationSpecifics;
class PasswordSpecifics;
class PasswordSpecificsData;
class PaymentInstrument;
class PaymentsCustomerData;
class PlusAddressSettingSpecifics;
class PlusAddressSpecifics;
class PowerBookmarkSpecifics;
class PreferenceSpecifics;
class PrinterPPDReference;
class PrinterSpecifics;
class PrintersAuthorizationServerSpecifics;
class PriorityPreferenceSpecifics;
class ProductComparisonSpecifics;
class ReadingListSpecifics;
class SavedTabGroupSpecifics;
class SearchEngineSpecifics;
class SecurityEventSpecifics;
class SendTabToSelfPush;
class SendTabToSelfSpecifics;
class SessionHeader;
class SessionSpecifics;
class SessionTab;
class SessionWindow;
class SharingMessageSpecifics;
class SyncCycleCompletedEventInfo;
class SyncEntity;
class TabNavigation;
class ThemeSpecifics;
class TimeRangeDirective;
class TypedUrlSpecifics;
class UnencryptedSharingMessage;
class UrlDirective;
class UserConsentSpecifics;
class UserEventSpecifics;
class WalletCreditCardCloudTokenData;
class WalletMaskedCreditCard;
class WalletMetadataSpecifics;
class WalletPostalAddress;
class WebApkSpecifics;
class WebAppSpecifics;
class WebauthnCredentialSpecifics;
class WifiConfigurationSpecifics;
class WorkspaceDeskSpecifics;
}  // namespace sync_pb

// Keep this file in sync with the .proto files in this directory.
//
// 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.

namespace syncer {

base::Value AppListSpecificsToValue(const sync_pb::AppListSpecifics& proto);

base::Value AppSettingSpecificsToValue(
    const sync_pb::AppSettingSpecifics& app_setting_specifics);

base::Value AppSpecificsToValue(const sync_pb::AppSpecifics& app_specifics);

base::Value ArcPackageSpecificsToValue(
    const sync_pb::ArcPackageSpecifics& proto);

base::Value AutofillOfferSpecificsToValue(
    const sync_pb::AutofillOfferSpecifics& autofill_offer_specifics);

base::Value AutofillProfileSpecificsToValue(
    const sync_pb::AutofillProfileSpecifics& autofill_profile_specifics);

base::Value AutofillSpecificsToValue(
    const sync_pb::AutofillSpecifics& autofill_specifics);

base::Value AutofillWalletCredentialSpecificsToValue(
    const sync_pb::AutofillWalletCredentialSpecifics&
        autofill_wallet_credential_specifics);

base::Value AutofillWalletSpecificsToValue(
    const sync_pb::AutofillWalletSpecifics& autofill_wallet_specifics);

base::Value AutofillWalletUsageSpecificsToValue(
    const sync_pb::AutofillWalletUsageSpecifics&
        autofill_wallet_usage_specifics);

base::Value BankAccountDetailsToValue(
    const sync_pb::BankAccountDetails& bank_account_details);

base::Value BookmarkSpecificsToValue(
    const sync_pb::BookmarkSpecifics& bookmark_specifics);

base::Value ClientConfigParamsToValue(const sync_pb::ClientConfigParams& proto);

base::Value CollaborationGroupSpecificsToValue(
    const sync_pb::CollaborationGroupSpecifics& proto);

base::Value ContactInfoSpecificsToValue(
    const sync_pb::ContactInfoSpecifics& proto);

base::Value CookieSpecificsToValue(const sync_pb::CookieSpecifics& proto);

base::Value DebugEventInfoToValue(const sync_pb::DebugEventInfo& proto);

base::Value DebugInfoToValue(const sync_pb::DebugInfo& proto);

base::Value DeviceDetailsToValue(const sync_pb::DeviceDetails& device_details);

base::Value DeviceInfoSpecificsToValue(
    const sync_pb::DeviceInfoSpecifics& device_info_specifics);

base::Value DictionarySpecificsToValue(
    const sync_pb::DictionarySpecifics& dictionary_specifics);

base::Value EncryptedDataToValue(const sync_pb::EncryptedData& encrypted_data);

base::Value EntityMetadataToValue(const sync_pb::EntityMetadata& metadata);

base::Value EntitySpecificsToValue(const sync_pb::EntitySpecifics& specifics);

base::Value EwalletDetailsToValue(
    const sync_pb::EwalletDetails& ewallet_details);

base::Value ExtensionSettingSpecificsToValue(
    const sync_pb::ExtensionSettingSpecifics& extension_setting_specifics);

base::Value ExtensionSpecificsToValue(
    const sync_pb::ExtensionSpecifics& extension_specifics);

base::Value HistoryDeleteDirectiveSpecificsToValue(
    const sync_pb::HistoryDeleteDirectiveSpecifics&
        history_delete_directive_specifics);

base::Value HistorySpecificsToValue(
    const sync_pb::HistorySpecifics& history_specifics);

base::Value IncomingPasswordSharingInvitationSpecificsToValue(
    const sync_pb::IncomingPasswordSharingInvitationSpecifics& specifics);

base::Value LinkedAppIconInfoToValue(
    const sync_pb::LinkedAppIconInfo& linked_app_icon_info);

base::Value ManagedUserSettingSpecificsToValue(
    const sync_pb::ManagedUserSettingSpecifics& managed_user_setting_specifics);

base::Value NavigationRedirectToValue(
    const sync_pb::NavigationRedirect& navigation_redirect);

base::Value NigoriSpecificsToValue(
    const sync_pb::NigoriSpecifics& nigori_specifics);

base::Value OsPreferenceSpecificsToValue(
    const sync_pb::OsPreferenceSpecifics& specifics);

base::Value OsPriorityPreferenceSpecificsToValue(
    const sync_pb::OsPriorityPreferenceSpecifics& specifics);

base::Value OutgoingPasswordSharingInvitationSpecificsToValue(
    const sync_pb::OutgoingPasswordSharingInvitationSpecifics& specifics);

base::Value PasswordSpecificsToValue(
    const sync_pb::PasswordSpecifics& password_specifics);

base::Value PasswordSpecificsDataToValue(
    const sync_pb::PasswordSpecificsData& password_specifics_data);

base::Value PaymentInstrumentToValue(
    const sync_pb::PaymentInstrument& payment_instrument);

base::Value PaymentsCustomerDataToValue(
    const sync_pb::PaymentsCustomerData& payments_customer_data);

base::Value PlusAddressSettingSpecificsToValue(
    const sync_pb::PlusAddressSettingSpecifics& plus_address_setting_specifics);

base::Value PlusAddressSpecificsToValue(
    const sync_pb::PlusAddressSpecifics& plus_address_specifics);

base::Value PowerBookmarkSpecificsToValue(
    const sync_pb::PowerBookmarkSpecifics& power_bookmark_specifics);

base::Value PreferenceSpecificsToValue(
    const sync_pb::PreferenceSpecifics& password_specifics);

base::Value PrinterPPDReferenceToValue(
    const sync_pb::PrinterPPDReference& proto);

base::Value PrinterSpecificsToValue(
    const sync_pb::PrinterSpecifics& printer_specifics);

base::Value PrintersAuthorizationServerSpecificsToValue(
    const sync_pb::PrintersAuthorizationServerSpecifics&
        printers_authorization_server_specifics);

base::Value PriorityPreferenceSpecificsToValue(
    const sync_pb::PriorityPreferenceSpecifics& proto);

base::Value ProductComparisonSpecificsToValue(
    const sync_pb::ProductComparisonSpecifics& product_comparison_specifics);

base::Value CrossUserSharingPublicKeyToValue(
    const sync_pb::CrossUserSharingPublicKey& proto);

base::Value ReadingListSpecificsToValue(
    const sync_pb::ReadingListSpecifics& proto);

base::Value SavedTabGroupSpecificsToValue(
    const sync_pb::SavedTabGroupSpecifics& saved_tab_group_specifics);

base::Value SearchEngineSpecificsToValue(
    const sync_pb::SearchEngineSpecifics& search_engine_specifics);

base::Value SendTabToSelfPushToValue(
    const sync_pb::SendTabToSelfPush& send_tab_push);

base::Value SendTabToSelfSpecificsToValue(
    const sync_pb::SendTabToSelfSpecifics& send_tab_specifics);

base::Value SecurityEventSpecificsToValue(
    const sync_pb::SecurityEventSpecifics& security_event_specifics);

base::Value SessionHeaderToValue(const sync_pb::SessionHeader& session_header);

base::Value SessionSpecificsToValue(
    const sync_pb::SessionSpecifics& session_specifics);

base::Value SessionTabToValue(const sync_pb::SessionTab& session_tab);

base::Value SessionWindowToValue(const sync_pb::SessionWindow& session_window);

base::Value SharingMessageSpecificsToValue(
    const sync_pb::SharingMessageSpecifics& sharing_message_specifics);

base::Value SyncCycleCompletedEventInfoToValue(
    const sync_pb::SyncCycleCompletedEventInfo& proto);

base::Value TabNavigationToValue(const sync_pb::TabNavigation& tab_navigation);

base::Value ThemeSpecificsToValue(
    const sync_pb::ThemeSpecifics& theme_specifics);

base::Value TimeRangeDirectiveToValue(
    const sync_pb::TimeRangeDirective& time_range_directive);

base::Value TypedUrlSpecificsToValue(
    const sync_pb::TypedUrlSpecifics& typed_url_specifics);

base::Value UnencryptedSharingMessageToValue(
    const sync_pb::UnencryptedSharingMessage& proto);

base::Value UrlDirectiveToValue(
    const sync_pb::UrlDirective& time_range_directive);

base::Value UserConsentSpecificsToValue(
    const sync_pb::UserConsentSpecifics& user_consent_specifics);

base::Value UserEventSpecificsToValue(
    const sync_pb::UserEventSpecifics& user_event_specifics);

base::Value WalletCreditCardCloudTokenDataToValue(
    const sync_pb::WalletCreditCardCloudTokenData& cloud_token_data);

base::Value WalletMaskedCreditCardToValue(
    const sync_pb::WalletMaskedCreditCard& wallet_masked_card);

base::Value WalletMetadataSpecificsToValue(
    const sync_pb::WalletMetadataSpecifics& wallet_metadata_specifics);

base::Value WalletPostalAddressToValue(
    const sync_pb::WalletPostalAddress& wallet_postal_address);

base::Value WebApkSpecificsToValue(
    const sync_pb::WebApkSpecifics& web_apk_specifics);

base::Value WebAppSpecificsToValue(
    const sync_pb::WebAppSpecifics& web_app_specifics);

base::Value WebAuthnCredentialSpecificsToValue(
    const sync_pb::WebauthnCredentialSpecifics& webauthn_credential_specifics);

base::Value WifiConfigurationSpecificsToValue(
    const sync_pb::WifiConfigurationSpecifics& wifi_configuration_specifics);

base::Value WorkspaceDeskSpecificsToValue(
    const sync_pb::WorkspaceDeskSpecifics& workspace_desk_specifics);

// ToValue functions that allow omitting specifics and other fields.

struct ProtoValueConversionOptions {
  // Whether to include specifics.
  bool include_specifics = true;

  // Whether to include default values which are set in GetUpdateTriggers.
  bool include_full_get_update_triggers = true;
};

base::Value ClientToServerMessageToValue(
    const sync_pb::ClientToServerMessage& proto,
    const ProtoValueConversionOptions& options);

base::Value ClientToServerResponseToValue(
    const sync_pb::ClientToServerResponse& proto,
    const ProtoValueConversionOptions& options);

base::Value SyncEntityToValue(const sync_pb::SyncEntity& entity,
                              const ProtoValueConversionOptions& options);

}  // namespace syncer

#endif  // COMPONENTS_SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_