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

Side by Side Diff: components/sync/protocol/proto_visitors.h

Issue 2433563002: [Sync] Reimplement proto value conversions on top of field visitors. (Closed)
Patch Set: Remove temporary tests Created 4 years, 2 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
« no previous file with comments | « components/sync/protocol/proto_value_conversions_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 #ifndef COMPONENTS_SYNC_PROTOCOL_PROTO_VISITORS_H_
6 #define COMPONENTS_SYNC_PROTOCOL_PROTO_VISITORS_H_
7
8 #include "components/sync/protocol/app_list_specifics.pb.h"
9 #include "components/sync/protocol/app_notification_specifics.pb.h"
10 #include "components/sync/protocol/app_setting_specifics.pb.h"
11 #include "components/sync/protocol/app_specifics.pb.h"
12 #include "components/sync/protocol/arc_package_specifics.pb.h"
13 #include "components/sync/protocol/autofill_specifics.pb.h"
14 #include "components/sync/protocol/bookmark_specifics.pb.h"
15 #include "components/sync/protocol/dictionary_specifics.pb.h"
16 #include "components/sync/protocol/encryption.pb.h"
17 #include "components/sync/protocol/entity_metadata.pb.h"
18 #include "components/sync/protocol/experiments_specifics.pb.h"
19 #include "components/sync/protocol/extension_setting_specifics.pb.h"
20 #include "components/sync/protocol/extension_specifics.pb.h"
21 #include "components/sync/protocol/favicon_image_specifics.pb.h"
22 #include "components/sync/protocol/favicon_tracking_specifics.pb.h"
23 #include "components/sync/protocol/history_delete_directive_specifics.pb.h"
24 #include "components/sync/protocol/nigori_specifics.pb.h"
25 #include "components/sync/protocol/password_specifics.pb.h"
26 #include "components/sync/protocol/preference_specifics.pb.h"
27 #include "components/sync/protocol/printer_specifics.pb.h"
28 #include "components/sync/protocol/priority_preference_specifics.pb.h"
29 #include "components/sync/protocol/proto_enum_conversions.h"
30 #include "components/sync/protocol/reading_list_specifics.pb.h"
31 #include "components/sync/protocol/search_engine_specifics.pb.h"
32 #include "components/sync/protocol/session_specifics.pb.h"
33 #include "components/sync/protocol/sync.pb.h"
34 #include "components/sync/protocol/theme_specifics.pb.h"
35 #include "components/sync/protocol/typed_url_specifics.pb.h"
36 #include "components/sync/protocol/unique_position.pb.h"
37
38 // This file implements VisitProtoFields() functions for sync protos.
39 //
40 // VisitProtoFields(visitor, proto) calls |visitor| for each field in
41 // |proto|. When called, |visitor| gets passed |proto|, field name and
42 // field value.
43 //
44 // VisitProtoFields() used to implement two distinctive features:
45 // 1. Serialization into base::DictionaryValue
46 // 2. Proto memory usage estimation
47 //
48 // To achieve that it's very important for VisitProtoFields() to be free
49 // of any logic. It must just call visitor for each field in a proto.
50 //
51 // Logic (like clobbering sensitive fields) must be implemented in visitors.
52 // For example see how ToValueVisitor (from proto_value_conversions.cc)
53 // implements various customizations.
54
55 #define VISIT_(Kind, field) \
56 if (proto.has_##field()) \
57 visitor.Visit##Kind(proto, #field, proto.field())
58
59 // Generic version, calls visitor.Visit(). Handles almost everything except
60 // for special cases below.
61 #define VISIT(field) VISIT_(, field)
62
63 // 'bytes' protobuf type maps to std::string, and is indistinguishable
64 // from 'string' type. To solve that 'bytes' fields are special cased to
65 // call visitor.VisitBytes().
66 #define VISIT_BYTES(field) VISIT_(Bytes, field)
67
68 // We could use template magic (std::is_enum) to handle enums, but that would
69 // complicate visitors, and besides we already have special case for 'bytes',
70 // so just add one more special case. Calls visitor.VisitEnum().
71 #define VISIT_ENUM(field) VISIT_(Enum, field)
72
73 // Repeated fields are always present, so there are no 'has_<field>' methods.
74 // This macro unconditionally calls visitor.Visit().
75 #define VISIT_REP(field) \
76 visitor.Visit(proto, #field, proto.field());
77
78 namespace syncer {
79
80 template <class V>
81 void VisitProtoFields(V& visitor, const sync_pb::EncryptedData& proto) {
82 VISIT(key_name);
83 // TODO(akalin): Shouldn't blob be of type bytes instead of string?
84 VISIT_BYTES(blob);
85 }
86
87 template <class V>
88 void VisitProtoFields(V& visitor,
89 const sync_pb::PasswordSpecificsMetadata& proto) {
90 VISIT(url);
91 }
92
93 template <class V>
94 void VisitProtoFields(V& visitor,
95 const sync_pb::AppNotificationSettings& proto) {
96 VISIT(initial_setup_done);
97 VISIT(disabled);
98 VISIT(oauth_client_id);
99 }
100
101 template <class V>
102 void VisitProtoFields(V& visitor, const sync_pb::SessionHeader& proto) {
103 VISIT_REP(window);
104 VISIT(client_name);
105 VISIT_ENUM(device_type);
106 }
107
108 template <class V>
109 void VisitProtoFields(V& visitor, const sync_pb::SessionTab& proto) {
110 VISIT(tab_id);
111 VISIT(window_id);
112 VISIT(tab_visual_index);
113 VISIT(current_navigation_index);
114 VISIT(pinned);
115 VISIT(extension_app_id);
116 VISIT_REP(navigation);
117 VISIT_BYTES(favicon);
118 VISIT_ENUM(favicon_type);
119 VISIT(favicon_source);
120 VISIT_REP(variation_id);
121 }
122
123 template <class V>
124 void VisitProtoFields(V& visitor, const sync_pb::SessionWindow& proto) {
125 VISIT(window_id);
126 VISIT(selected_tab_index);
127 VISIT_REP(tab);
128 VISIT_ENUM(browser_type);
129 }
130
131 template <class V>
132 void VisitProtoFields(V& visitor, const sync_pb::TabNavigation& proto) {
133 VISIT(virtual_url);
134 VISIT(referrer);
135 VISIT(title);
136 VISIT_ENUM(page_transition);
137 VISIT_ENUM(redirect_type);
138 VISIT(unique_id);
139 VISIT(timestamp_msec);
140 VISIT(navigation_forward_back);
141 VISIT(navigation_from_address_bar);
142 VISIT(navigation_home_page);
143 VISIT(navigation_chain_start);
144 VISIT(navigation_chain_end);
145 VISIT(global_id);
146 VISIT(search_terms);
147 VISIT(favicon_url);
148 VISIT_ENUM(blocked_state);
149 VISIT_REP(content_pack_categories);
150 VISIT(http_status_code);
151 VISIT(obsolete_referrer_policy);
152 VISIT(is_restored);
153 VISIT_REP(navigation_redirect);
154 VISIT(last_navigation_redirect_url);
155 VISIT(correct_referrer_policy);
156 VISIT_ENUM(password_state);
157 }
158
159 template <class V>
160 void VisitProtoFields(V& visitor, const sync_pb::NavigationRedirect& proto) {
161 VISIT(url);
162 }
163
164 template <class V>
165 void VisitProtoFields(V& visitor, const sync_pb::PasswordSpecificsData& proto) {
166 VISIT(scheme);
167 VISIT(signon_realm);
168 VISIT(origin);
169 VISIT(action);
170 VISIT(username_element);
171 VISIT(username_value);
172 VISIT(password_element);
173 VISIT(preferred);
174 VISIT(date_created);
175 VISIT(blacklisted);
176 VISIT(type);
177 VISIT(times_used);
178 VISIT(display_name);
179 VISIT(avatar_url);
180 VISIT(federation_url);
181 }
182
183 template <class V>
184 void VisitProtoFields(V& visitor, const sync_pb::GlobalIdDirective& proto) {
185 VISIT_REP(global_id);
186 VISIT(start_time_usec);
187 VISIT(end_time_usec);
188 }
189
190 template <class V>
191 void VisitProtoFields(V& visitor, const sync_pb::TimeRangeDirective& proto) {
192 VISIT(start_time_usec);
193 VISIT(end_time_usec);
194 }
195
196 template <class V>
197 void VisitProtoFields(V& visitor, const sync_pb::AppListSpecifics& proto) {
198 VISIT(item_id);
199 VISIT_ENUM(item_type);
200 VISIT(item_name);
201 VISIT(parent_id);
202 VISIT(item_ordinal);
203 VISIT(item_pin_ordinal);
204 }
205
206 template <class V>
207 void VisitProtoFields(V& visitor, const sync_pb::ArcPackageSpecifics& proto) {
208 VISIT(package_name);
209 VISIT(package_version);
210 VISIT(last_backup_android_id);
211 VISIT(last_backup_time);
212 }
213
214 template <class V>
215 void VisitProtoFields(V& visitor, const sync_pb::PrinterPPDReference& proto) {
216 VISIT(user_supplied_ppd_url);
217 VISIT(effective_manufacturer);
218 VISIT(effective_model);
219 }
220
221 template <class V>
222 void VisitProtoFields(V& visitor, const sync_pb::ReadingListSpecifics& proto) {
223 VISIT(entry_id);
224 VISIT(title);
225 VISIT(url);
226 VISIT(creation_time_us);
227 VISIT(update_time_us);
228 VISIT_ENUM(status);
229 }
230
231 template <class V>
232 void VisitProtoFields(V& visitor, const sync_pb::AppNotification& proto) {
233 VISIT(guid);
234 VISIT(app_id);
235 VISIT(creation_timestamp_ms);
236 VISIT(title);
237 VISIT(body_text);
238 VISIT(link_url);
239 VISIT(link_text);
240 }
241
242 template <class V>
243 void VisitProtoFields(V& visitor, const sync_pb::AppSettingSpecifics& proto) {
244 VISIT(extension_setting);
245 }
246
247 template <class V>
248 void VisitProtoFields(V& visitor, const sync_pb::LinkedAppIconInfo& proto) {
249 VISIT(url);
250 VISIT(size);
251 }
252
253 template <class V>
254 void VisitProtoFields(V& visitor, const sync_pb::AppSpecifics& proto) {
255 VISIT(extension);
256 VISIT(notification_settings);
257 VISIT(app_launch_ordinal);
258 VISIT(page_ordinal);
259 VISIT_ENUM(launch_type);
260 VISIT(bookmark_app_url);
261 VISIT(bookmark_app_description);
262 VISIT(bookmark_app_icon_color);
263 VISIT_REP(linked_app_icons);
264
265 }
266
267 template <class V>
268 void VisitProtoFields(V& visitor, const sync_pb::AutofillSpecifics& proto) {
269 VISIT(name);
270 VISIT(value);
271 VISIT_REP(usage_timestamp);
272 VISIT(profile);
273 }
274
275 template <class V>
276 void VisitProtoFields(V& visitor,
277 const sync_pb::AutofillProfileSpecifics& proto) {
278 VISIT(guid);
279 VISIT(origin);
280 VISIT(use_count);
281 VISIT(use_date);
282 VISIT_REP(name_first);
283 VISIT_REP(name_middle);
284 VISIT_REP(name_last);
285 VISIT_REP(name_full);
286 VISIT_REP(email_address);
287 VISIT(company_name);
288 VISIT(address_home_line1);
289 VISIT(address_home_line2);
290 VISIT(address_home_city);
291 VISIT(address_home_state);
292 VISIT(address_home_zip);
293 VISIT(address_home_country);
294 VISIT(address_home_street_address);
295 VISIT(address_home_sorting_code);
296 VISIT(address_home_dependent_locality);
297 VISIT(address_home_language_code);
298 VISIT_REP(phone_home_whole_number);
299 }
300
301 template <class V>
302 void VisitProtoFields(V& visitor,
303 const sync_pb::WalletMetadataSpecifics& proto) {
304 VISIT_ENUM(type);
305 VISIT(id);
306 VISIT(use_count);
307 VISIT(use_date);
308 }
309
310 template <class V>
311 void VisitProtoFields(V& visitor,
312 const sync_pb::AutofillWalletSpecifics& proto) {
313 VISIT_ENUM(type);
314 VISIT(masked_card);
315 VISIT(address);
316 }
317
318 template <class V>
319 void VisitProtoFields(V& visitor, const sync_pb::MetaInfo& proto) {
320 VISIT(key);
321 VISIT(value);
322 }
323
324 template <class V>
325 void VisitProtoFields(V& visitor, const sync_pb::BookmarkSpecifics& proto) {
326 VISIT(url);
327 VISIT_BYTES(favicon);
328 VISIT(title);
329 VISIT(creation_time_us);
330 VISIT(icon_url);
331 VISIT_REP(meta_info);
332 }
333
334 template <class V>
335 void VisitProtoFields(V& visitor, const sync_pb::DeviceInfoSpecifics& proto) {
336 VISIT(cache_guid);
337 VISIT(client_name);
338 VISIT_ENUM(device_type);
339 VISIT(sync_user_agent);
340 VISIT(chrome_version);
341 VISIT(signin_scoped_device_id);
342 }
343
344 template <class V>
345 void VisitProtoFields(V& visitor, const sync_pb::DictionarySpecifics& proto) {
346 VISIT(word);
347 }
348
349 template <class V>
350 void VisitProtoFields(V& visitor, const sync_pb::FaviconSyncFlags& proto) {
351 VISIT(enabled);
352 VISIT(favicon_sync_limit);
353 }
354
355 template <class V>
356 void VisitProtoFields(V& visitor,
357 const sync_pb::KeystoreEncryptionFlags& proto) {
358 VISIT(enabled);
359 }
360
361 template <class V>
362 void VisitProtoFields(V& visitor,
363 const sync_pb::HistoryDeleteDirectives& proto) {
364 VISIT(enabled);
365 }
366
367 template <class V>
368 void VisitProtoFields(V& visitor, const sync_pb::AutofillCullingFlags& proto) {
369 VISIT(enabled);
370 }
371
372 template <class V>
373 void VisitProtoFields(V& visitor,
374 const sync_pb::PreCommitUpdateAvoidanceFlags& proto) {
375 VISIT(enabled);
376 }
377
378 template <class V>
379 void VisitProtoFields(V& visitor, const sync_pb::GcmChannelFlags& proto) {
380 VISIT(enabled);
381 }
382
383 template <class V>
384 void VisitProtoFields(V& visitor, const sync_pb::GcmInvalidationsFlags& proto) {
385 VISIT(enabled);
386 }
387
388 template <class V>
389 void VisitProtoFields(V& visitor, const sync_pb::ExperimentsSpecifics& proto) {
390 VISIT(keystore_encryption);
391 VISIT(history_delete_directives);
392 VISIT(autofill_culling);
393 VISIT(pre_commit_update_avoidance);
394 VISIT(favicon_sync);
395 VISIT(gcm_channel);
396 VISIT(gcm_invalidations);
397 }
398
399 template <class V>
400 void VisitProtoFields(V& visitor,
401 const sync_pb::ExtensionSettingSpecifics& proto) {
402 VISIT(extension_id);
403 VISIT(key);
404 VISIT(value);
405 }
406
407 template <class V>
408 void VisitProtoFields(V& visitor, const sync_pb::ExtensionSpecifics& proto) {
409 VISIT(id);
410 VISIT(version);
411 VISIT(update_url);
412 VISIT(enabled);
413 VISIT(incognito_enabled);
414 VISIT(name);
415 VISIT(remote_install);
416 VISIT(installed_by_custodian);
417 VISIT(all_urls_enabled);
418 VISIT(disable_reasons);
419 }
420
421 template <class V>
422 void VisitProtoFields(V& visitor, const sync_pb::FaviconData& proto) {
423 VISIT_BYTES(favicon);
424 VISIT(width);
425 VISIT(height);
426 }
427
428 template <class V>
429 void VisitProtoFields(V& visitor, const sync_pb::FaviconImageSpecifics& proto) {
430 VISIT(favicon_url);
431 VISIT(favicon_web);
432 VISIT(favicon_web_32);
433 VISIT(favicon_touch_64);
434 VISIT(favicon_touch_precomposed_64);
435 }
436
437 template <class V>
438 void VisitProtoFields(V& visitor,
439 const sync_pb::FaviconTrackingSpecifics& proto) {
440 VISIT(favicon_url);
441 VISIT(last_visit_time_ms);
442 VISIT(is_bookmarked);
443 }
444
445 template <class V>
446 void VisitProtoFields(V& visitor,
447 const sync_pb::HistoryDeleteDirectiveSpecifics& proto) {
448 VISIT(global_id_directive);
449 VISIT(time_range_directive);
450 }
451
452 template <class V>
453 void VisitProtoFields(V& visitor,
454 const sync_pb::ManagedUserSettingSpecifics& proto) {
455 VISIT(name);
456 VISIT(value);
457 }
458
459 template <class V>
460 void VisitProtoFields(V& visitor, const sync_pb::ManagedUserSpecifics& proto) {
461 VISIT(id);
462 VISIT(name);
463 VISIT(acknowledged);
464 VISIT(master_key);
465 VISIT(chrome_avatar);
466 VISIT(chromeos_avatar);
467 }
468
469 template <class V>
470 void VisitProtoFields(V& visitor,
471 const sync_pb::ManagedUserSharedSettingSpecifics& proto) {
472 VISIT(mu_id);
473 VISIT(key);
474 VISIT(value);
475 VISIT(acknowledged);
476 }
477
478 template <class V>
479 void VisitProtoFields(V& visitor,
480 const sync_pb::ManagedUserWhitelistSpecifics& proto) {
481 VISIT(id);
482 VISIT(name);
483 }
484
485 template <class V>
486 void VisitProtoFields(V& visitor, const sync_pb::NigoriSpecifics& proto) {
487 VISIT(encryption_keybag);
488 VISIT(keybag_is_frozen);
489 VISIT(encrypt_bookmarks);
490 VISIT(encrypt_preferences);
491 VISIT(encrypt_autofill_profile);
492 VISIT(encrypt_autofill);
493 VISIT(encrypt_themes);
494 VISIT(encrypt_typed_urls);
495 VISIT(encrypt_extension_settings);
496 VISIT(encrypt_extensions);
497 VISIT(encrypt_sessions);
498 VISIT(encrypt_app_settings);
499 VISIT(encrypt_apps);
500 VISIT(encrypt_search_engines);
501 VISIT(encrypt_dictionary);
502 VISIT(encrypt_articles);
503 VISIT(encrypt_app_list);
504 VISIT(encrypt_arc_package);
505 VISIT(encrypt_reading_list);
506 VISIT(encrypt_everything);
507 VISIT(server_only_was_missing_keystore_migration_time);
508 VISIT(sync_tab_favicons);
509 VISIT_ENUM(passphrase_type);
510 VISIT(keystore_decryptor_token);
511 VISIT(keystore_migration_time);
512 VISIT(custom_passphrase_time);
513 }
514
515 template <class V>
516 void VisitProtoFields(V& visitor, const sync_pb::ArticlePage& proto) {
517 VISIT(url);
518 }
519
520 template <class V>
521 void VisitProtoFields(V& visitor, const sync_pb::ArticleSpecifics& proto) {
522 VISIT(entry_id);
523 VISIT(title);
524 VISIT_REP(pages);
525 }
526
527 template <class V>
528 void VisitProtoFields(V& visitor, const sync_pb::PasswordSpecifics& proto) {
529 VISIT(encrypted);
530 VISIT(unencrypted_metadata);
531 }
532
533 template <class V>
534 void VisitProtoFields(V& visitor, const sync_pb::PreferenceSpecifics& proto) {
535 VISIT(name);
536 VISIT(value);
537 }
538
539 template <class V>
540 void VisitProtoFields(V& visitor, const sync_pb::PrinterSpecifics& proto) {
541 VISIT(id);
542 VISIT(display_name);
543 VISIT(description);
544 VISIT(manufacturer);
545 VISIT(model);
546 VISIT(uri);
547 VISIT(uuid);
548 VISIT(ppd_reference);
549 }
550
551 template <class V>
552 void VisitProtoFields(V& visitor,
553 const sync_pb::PriorityPreferenceSpecifics& proto) {
554 VISIT(preference);
555 }
556
557 template <class V>
558 void VisitProtoFields(
559 V& visitor,
560 const sync_pb::SyncedNotificationAppInfoSpecifics& proto) {
561 }
562
563 template <class V>
564 void VisitProtoFields(V& visitor,
565 const sync_pb::SyncedNotificationSpecifics& proto) {
566 }
567
568 template <class V>
569 void VisitProtoFields(V& visitor, const sync_pb::SearchEngineSpecifics& proto) {
570 VISIT(short_name);
571 VISIT(keyword);
572 VISIT(favicon_url);
573 VISIT(url);
574 VISIT(safe_for_autoreplace);
575 VISIT(originating_url);
576 VISIT(date_created);
577 VISIT(input_encodings);
578 VISIT(show_in_default_list);
579 VISIT(suggestions_url);
580 VISIT(prepopulate_id);
581 VISIT(autogenerate_keyword);
582 VISIT(instant_url);
583 VISIT(last_modified);
584 VISIT(sync_guid);
585 VISIT_REP(alternate_urls);
586 VISIT(search_terms_replacement_key);
587 VISIT(image_url);
588 VISIT(search_url_post_params);
589 VISIT(suggestions_url_post_params);
590 VISIT(instant_url_post_params);
591 VISIT(image_url_post_params);
592 VISIT(new_tab_url);
593 }
594
595 template <class V>
596 void VisitProtoFields(V& visitor, const sync_pb::SessionSpecifics& proto) {
597 VISIT(session_tag);
598 VISIT(header);
599 VISIT(tab);
600 VISIT(tab_node_id);
601 }
602
603 template <class V>
604 void VisitProtoFields(V& visitor, const sync_pb::ThemeSpecifics& proto) {
605 VISIT(use_custom_theme);
606 VISIT(use_system_theme_by_default);
607 VISIT(custom_theme_name);
608 VISIT(custom_theme_id);
609 VISIT(custom_theme_update_url);
610 }
611
612 template <class V>
613 void VisitProtoFields(V& visitor, const sync_pb::TypedUrlSpecifics& proto) {
614 VISIT(url);
615 VISIT(title);
616 VISIT(hidden);
617 VISIT_REP(visits);
618 VISIT_REP(visit_transitions);
619 }
620
621 template <class V>
622 void VisitProtoFields(V& visitor,
623 const sync_pb::WalletMaskedCreditCard& proto) {
624 VISIT(id);
625 VISIT_ENUM(status);
626 VISIT(name_on_card);
627 VISIT_ENUM(type);
628 VISIT(last_four);
629 VISIT(exp_month);
630 VISIT(exp_year);
631 VISIT(billing_address_id);
632 }
633
634 template <class V>
635 void VisitProtoFields(V& visitor, const sync_pb::WalletPostalAddress& proto) {
636 VISIT(id);
637 VISIT(recipient_name);
638 VISIT(company_name);
639 VISIT_REP(street_address);
640 VISIT(address_1);
641 VISIT(address_2);
642 VISIT(address_3);
643 VISIT(address_4);
644 VISIT(postal_code);
645 VISIT(sorting_code);
646 VISIT(country_code);
647 VISIT(phone_number);
648 VISIT(language_code);
649 }
650
651 template <class V>
652 void VisitProtoFields(V& visitor,
653 const sync_pb::WifiCredentialSpecifics& proto) {
654 VISIT_BYTES(ssid);
655 VISIT_ENUM(security_class);
656 VISIT_BYTES(passphrase);
657 }
658
659 template <class V>
660 void VisitProtoFields(V& visitor, const sync_pb::EntitySpecifics& proto) {
661 VISIT(app);
662 VISIT(app_list);
663 VISIT(app_notification);
664 VISIT(app_setting);
665 VISIT(arc_package);
666 VISIT(article);
667 VISIT(autofill);
668 VISIT(autofill_profile);
669 VISIT(autofill_wallet);
670 VISIT(wallet_metadata);
671 VISIT(bookmark);
672 VISIT(device_info);
673 VISIT(dictionary);
674 VISIT(experiments);
675 VISIT(extension);
676 VISIT(extension_setting);
677 VISIT(favicon_image);
678 VISIT(favicon_tracking);
679 VISIT(history_delete_directive);
680 VISIT(managed_user_setting);
681 VISIT(managed_user_shared_setting);
682 VISIT(managed_user);
683 VISIT(managed_user_whitelist);
684 VISIT(nigori);
685 VISIT(password);
686 VISIT(preference);
687 VISIT(printer);
688 VISIT(priority_preference);
689 VISIT(reading_list);
690 VISIT(search_engine);
691 VISIT(session);
692 VISIT(synced_notification);
693 VISIT(synced_notification_app_info);
694 VISIT(theme);
695 VISIT(typed_url);
696 VISIT(wifi_credential);
697 }
698
699 template <class V>
700 void VisitProtoFields(V& visitor, const sync_pb::SyncEntity& proto) {
701 VISIT(id_string);
702 VISIT(parent_id_string);
703 VISIT(old_parent_id);
704 VISIT(version);
705 VISIT(mtime);
706 VISIT(ctime);
707 VISIT(name);
708 VISIT(non_unique_name);
709 VISIT(sync_timestamp);
710 VISIT(server_defined_unique_tag);
711 VISIT(position_in_parent);
712 VISIT(unique_position);
713 VISIT(insert_after_item_id);
714 VISIT(deleted);
715 VISIT(originator_cache_guid);
716 VISIT(originator_client_item_id);
717 VISIT(specifics);
718 VISIT(folder);
719 VISIT(client_defined_unique_tag);
720 VISIT_REP(attachment_id);
721 }
722
723 template <class V>
724 void VisitProtoFields(V& visitor,
725 const sync_pb::ChromiumExtensionsActivity& proto) {
726 VISIT(extension_id);
727 VISIT(bookmark_writes_since_last_commit);
728 }
729
730 template <class V>
731 void VisitProtoFields(V& visitor, const sync_pb::CommitMessage& proto) {
732 VISIT_REP(entries);
733 VISIT(cache_guid);
734 VISIT_REP(extensions_activity);
735 VISIT(config_params);
736 }
737
738 template <class V>
739 void VisitProtoFields(V& visitor, const sync_pb::GetUpdateTriggers& proto) {
740 VISIT_REP(notification_hint);
741 VISIT(client_dropped_hints);
742 VISIT(invalidations_out_of_sync);
743 VISIT(local_modification_nudges);
744 VISIT(datatype_refresh_nudges);
745 }
746
747 template <class V>
748 void VisitProtoFields(V& visitor,
749 const sync_pb::DataTypeProgressMarker& proto) {
750 VISIT(data_type_id);
751 VISIT_BYTES(token);
752 VISIT(timestamp_token_for_migration);
753 VISIT(notification_hint);
754 VISIT(get_update_triggers);
755 }
756
757 template <class V>
758 void VisitProtoFields(V& visitor, const sync_pb::DataTypeContext& proto) {
759 VISIT(data_type_id);
760 VISIT(context);
761 VISIT(version);
762 }
763
764 template <class V>
765 void VisitProtoFields(V& visitor, const sync_pb::GetUpdatesCallerInfo& proto) {
766 VISIT_ENUM(source);
767 VISIT(notifications_enabled);
768 }
769
770 template <class V>
771 void VisitProtoFields(V& visitor, const sync_pb::GetUpdatesMessage& proto) {
772 VISIT(caller_info);
773 VISIT(fetch_folders);
774 VISIT(batch_size);
775 VISIT_REP(from_progress_marker);
776 VISIT(streaming);
777 VISIT(need_encryption_key);
778 VISIT(create_mobile_bookmarks_folder);
779 VISIT_ENUM(get_updates_origin);
780 VISIT_REP(client_contexts);
781 }
782
783 template <class V>
784 void VisitProtoFields(V& visitor, const sync_pb::ClientStatus& proto) {
785 VISIT(hierarchy_conflict_detected);
786 }
787
788 template <class V>
789 void VisitProtoFields(V& visitor,
790 const sync_pb::CommitResponse::EntryResponse& proto) {
791 VISIT_ENUM(response_type);
792 VISIT(id_string);
793 VISIT(parent_id_string);
794 VISIT(position_in_parent);
795 VISIT(version);
796 VISIT(name);
797 VISIT(error_message);
798 VISIT(mtime);
799 }
800
801 template <class V>
802 void VisitProtoFields(V& visitor, const sync_pb::CommitResponse& proto) {
803 VISIT_REP(entryresponse);
804 }
805
806 template <class V>
807 void VisitProtoFields(V& visitor, const sync_pb::GetUpdatesResponse& proto) {
808 VISIT_REP(entries)
809 VISIT(changes_remaining);
810 VISIT_REP(new_progress_marker);
811 VISIT_REP(context_mutations);
812 }
813
814 template <class V>
815 void VisitProtoFields(V& visitor, const sync_pb::ClientCommand& proto) {
816 VISIT(set_sync_poll_interval);
817 VISIT(set_sync_long_poll_interval);
818 VISIT(max_commit_batch_size);
819 VISIT(sessions_commit_delay_seconds);
820 VISIT(throttle_delay_seconds);
821 VISIT(client_invalidation_hint_buffer_size);
822 }
823
824 template <class V>
825 void VisitProtoFields(V& visitor,
826 const sync_pb::ClientToServerResponse::Error& proto) {
827 VISIT_ENUM(error_type);
828 VISIT(error_description);
829 VISIT(url);
830 VISIT_ENUM(action);
831 }
832
833 template <class V>
834 void VisitProtoFields(V& visitor,
835 const sync_pb::ClientToServerResponse& proto) {
836 VISIT(commit);
837 VISIT(get_updates);
838 VISIT(error);
839 VISIT_ENUM(error_code);
840 VISIT(error_message);
841 VISIT(store_birthday);
842 VISIT(client_command);
843 VISIT_REP(migrated_data_type_id);
844 }
845
846 template <class V>
847 void VisitProtoFields(V& visitor, const sync_pb::ClientToServerMessage& proto) {
848 VISIT(share);
849 VISIT(protocol_version);
850 VISIT(commit);
851 VISIT(get_updates);
852 VISIT(store_birthday);
853 VISIT(sync_problem_detected);
854 VISIT(debug_info);
855 VISIT(client_status);
856 }
857
858 template <class V>
859 void VisitProtoFields(V& visitor,
860 const sync_pb::DatatypeAssociationStats& proto) {
861 VISIT(data_type_id);
862 VISIT(num_local_items_before_association);
863 VISIT(num_sync_items_before_association);
864 VISIT(num_local_items_after_association);
865 VISIT(num_sync_items_after_association);
866 VISIT(num_local_items_added);
867 VISIT(num_local_items_deleted);
868 VISIT(num_local_items_modified);
869 VISIT(num_sync_items_added);
870 VISIT(num_sync_items_deleted);
871 VISIT(num_sync_items_modified);
872 VISIT(local_version_pre_association);
873 VISIT(sync_version_pre_association);
874 VISIT(had_error);
875 VISIT(download_wait_time_us);
876 VISIT(download_time_us);
877 VISIT(association_wait_time_for_high_priority_us);
878 VISIT(association_wait_time_for_same_priority_us);
879 }
880
881 template <class V>
882 void VisitProtoFields(V& visitor, const sync_pb::DebugEventInfo& proto) {
883 VISIT_ENUM(singleton_event);
884 VISIT(sync_cycle_completed_event_info);
885 VISIT(nudging_datatype);
886 VISIT_REP(datatypes_notified_from_server);
887 VISIT(datatype_association_stats);
888 }
889
890 template <class V>
891 void VisitProtoFields(V& visitor, const sync_pb::DebugInfo& proto) {
892 VISIT_REP(events);
893 VISIT(cryptographer_ready);
894 VISIT(cryptographer_has_pending_keys);
895 VISIT(events_dropped);
896 }
897
898 template <class V>
899 void VisitProtoFields(V& visitor,
900 const sync_pb::SyncCycleCompletedEventInfo& proto) {
901 VISIT(num_encryption_conflicts);
902 VISIT(num_hierarchy_conflicts);
903 VISIT(num_server_conflicts);
904 VISIT(num_updates_downloaded);
905 VISIT(num_reflected_updates_downloaded);
906 VISIT(caller_info);
907 }
908
909 template <class V>
910 void VisitProtoFields(V& visitor, const sync_pb::ClientConfigParams& proto) {
911 VISIT_REP(enabled_type_ids);
912 VISIT(tabs_datatype_enabled);
913 VISIT(cookie_jar_mismatch);
914 }
915
916 template <class V>
917 void VisitProtoFields(V& visitor, const sync_pb::AttachmentIdProto& proto) {
918 VISIT(unique_id);
919 }
920
921 template <class V>
922 void VisitProtoFields(V& visitor, const sync_pb::EntityMetadata& proto) {
923 VISIT(client_tag_hash);
924 VISIT(server_id);
925 VISIT(is_deleted);
926 VISIT(sequence_number);
927 VISIT(acked_sequence_number);
928 VISIT(server_version);
929 VISIT(creation_time);
930 VISIT(modification_time);
931 VISIT(specifics_hash);
932 VISIT(base_specifics_hash);
933 }
934
935 } // namespace syncer
936
937 #undef VISIT_
938 #undef VISIT_BYTES
939 #undef VISIT_ENUM
940 #undef VISIT
941 #undef VISIT_REP
942
943 #endif // COMPONENTS_SYNC_PROTOCOL_PROTO_VISITORS_H_
OLDNEW
« no previous file with comments | « components/sync/protocol/proto_value_conversions_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698