Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
|
pavely
2016/10/20 05:10:39
You need to add this file to BUILD.gn too.
Dmitry Skiba
2016/10/20 18:31:19
Done.
| |
| 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::PrinterPPDData& proto) { | |
| 216 VISIT(id); | |
| 217 VISIT(file_name); | |
| 218 VISIT(version_number); | |
| 219 VISIT(from_quirks_server); | |
| 220 } | |
| 221 | |
| 222 template <class V> | |
| 223 void VisitProtoFields(V& visitor, const sync_pb::ReadingListSpecifics& proto) { | |
| 224 VISIT(entry_id); | |
| 225 VISIT(title); | |
| 226 VISIT(url); | |
| 227 VISIT(creation_time_us); | |
| 228 VISIT(update_time_us); | |
| 229 VISIT_ENUM(status); | |
| 230 } | |
| 231 | |
| 232 template <class V> | |
| 233 void VisitProtoFields(V& visitor, const sync_pb::AppNotification& proto) { | |
| 234 VISIT(guid); | |
| 235 VISIT(app_id); | |
| 236 VISIT(creation_timestamp_ms); | |
| 237 VISIT(title); | |
| 238 VISIT(body_text); | |
| 239 VISIT(link_url); | |
| 240 VISIT(link_text); | |
| 241 } | |
| 242 | |
| 243 template <class V> | |
| 244 void VisitProtoFields(V& visitor, const sync_pb::AppSettingSpecifics& proto) { | |
| 245 VISIT(extension_setting); | |
| 246 } | |
| 247 | |
| 248 template <class V> | |
| 249 void VisitProtoFields(V& visitor, const sync_pb::LinkedAppIconInfo& proto) { | |
| 250 VISIT(url); | |
| 251 VISIT(size); | |
| 252 } | |
| 253 | |
| 254 template <class V> | |
| 255 void VisitProtoFields(V& visitor, const sync_pb::AppSpecifics& proto) { | |
| 256 VISIT(extension); | |
| 257 VISIT(notification_settings); | |
| 258 VISIT(app_launch_ordinal); | |
| 259 VISIT(page_ordinal); | |
| 260 VISIT_ENUM(launch_type); | |
| 261 VISIT(bookmark_app_url); | |
| 262 VISIT(bookmark_app_description); | |
| 263 VISIT(bookmark_app_icon_color); | |
| 264 VISIT_REP(linked_app_icons); | |
| 265 | |
| 266 } | |
| 267 | |
| 268 template <class V> | |
| 269 void VisitProtoFields(V& visitor, const sync_pb::AutofillSpecifics& proto) { | |
| 270 VISIT(name); | |
| 271 VISIT(value); | |
| 272 VISIT_REP(usage_timestamp); | |
| 273 VISIT(profile); | |
| 274 } | |
| 275 | |
| 276 template <class V> | |
| 277 void VisitProtoFields(V& visitor, | |
| 278 const sync_pb::AutofillProfileSpecifics& proto) { | |
| 279 VISIT(guid); | |
| 280 VISIT(origin); | |
| 281 VISIT(use_count); | |
| 282 VISIT(use_date); | |
| 283 VISIT_REP(name_first); | |
| 284 VISIT_REP(name_middle); | |
| 285 VISIT_REP(name_last); | |
| 286 VISIT_REP(name_full); | |
| 287 VISIT_REP(email_address); | |
| 288 VISIT(company_name); | |
| 289 VISIT(address_home_line1); | |
| 290 VISIT(address_home_line2); | |
| 291 VISIT(address_home_city); | |
| 292 VISIT(address_home_state); | |
| 293 VISIT(address_home_zip); | |
| 294 VISIT(address_home_country); | |
| 295 VISIT(address_home_street_address); | |
| 296 VISIT(address_home_sorting_code); | |
| 297 VISIT(address_home_dependent_locality); | |
| 298 VISIT(address_home_language_code); | |
| 299 VISIT_REP(phone_home_whole_number); | |
| 300 } | |
| 301 | |
| 302 template <class V> | |
| 303 void VisitProtoFields(V& visitor, | |
| 304 const sync_pb::WalletMetadataSpecifics& proto) { | |
| 305 VISIT_ENUM(type); | |
| 306 VISIT(id); | |
| 307 VISIT(use_count); | |
| 308 VISIT(use_date); | |
| 309 } | |
| 310 | |
| 311 template <class V> | |
| 312 void VisitProtoFields(V& visitor, | |
| 313 const sync_pb::AutofillWalletSpecifics& proto) { | |
| 314 VISIT_ENUM(type); | |
| 315 VISIT(masked_card); | |
| 316 VISIT(address); | |
| 317 } | |
| 318 | |
| 319 template <class V> | |
| 320 void VisitProtoFields(V& visitor, const sync_pb::MetaInfo& proto) { | |
| 321 VISIT(key); | |
| 322 VISIT(value); | |
| 323 } | |
| 324 | |
| 325 template <class V> | |
| 326 void VisitProtoFields(V& visitor, const sync_pb::BookmarkSpecifics& proto) { | |
| 327 VISIT(url); | |
| 328 VISIT_BYTES(favicon); | |
| 329 VISIT(title); | |
| 330 VISIT(creation_time_us); | |
| 331 VISIT(icon_url); | |
| 332 VISIT_REP(meta_info); | |
| 333 } | |
| 334 | |
| 335 template <class V> | |
| 336 void VisitProtoFields(V& visitor, const sync_pb::DeviceInfoSpecifics& proto) { | |
| 337 VISIT(cache_guid); | |
| 338 VISIT(client_name); | |
| 339 VISIT_ENUM(device_type); | |
| 340 VISIT(sync_user_agent); | |
| 341 VISIT(chrome_version); | |
| 342 VISIT(signin_scoped_device_id); | |
| 343 } | |
| 344 | |
| 345 template <class V> | |
| 346 void VisitProtoFields(V& visitor, const sync_pb::DictionarySpecifics& proto) { | |
| 347 VISIT(word); | |
| 348 } | |
| 349 | |
| 350 template <class V> | |
| 351 void VisitProtoFields(V& visitor, const sync_pb::FaviconSyncFlags& proto) { | |
| 352 VISIT(enabled); | |
| 353 VISIT(favicon_sync_limit); | |
| 354 } | |
| 355 | |
| 356 template <class V> | |
| 357 void VisitProtoFields(V& visitor, | |
| 358 const sync_pb::KeystoreEncryptionFlags& proto) { | |
| 359 VISIT(enabled); | |
| 360 } | |
| 361 | |
| 362 template <class V> | |
| 363 void VisitProtoFields(V& visitor, | |
| 364 const sync_pb::HistoryDeleteDirectives& proto) { | |
| 365 VISIT(enabled); | |
| 366 } | |
| 367 | |
| 368 template <class V> | |
| 369 void VisitProtoFields(V& visitor, const sync_pb::AutofillCullingFlags& proto) { | |
| 370 VISIT(enabled); | |
| 371 } | |
| 372 | |
| 373 template <class V> | |
| 374 void VisitProtoFields(V& visitor, | |
| 375 const sync_pb::PreCommitUpdateAvoidanceFlags& proto) { | |
| 376 VISIT(enabled); | |
| 377 } | |
| 378 | |
| 379 template <class V> | |
| 380 void VisitProtoFields(V& visitor, const sync_pb::GcmChannelFlags& proto) { | |
| 381 VISIT(enabled); | |
| 382 } | |
| 383 | |
| 384 template <class V> | |
| 385 void VisitProtoFields(V& visitor, const sync_pb::GcmInvalidationsFlags& proto) { | |
| 386 VISIT(enabled); | |
| 387 } | |
| 388 | |
| 389 template <class V> | |
| 390 void VisitProtoFields(V& visitor, const sync_pb::ExperimentsSpecifics& proto) { | |
| 391 VISIT(keystore_encryption); | |
| 392 VISIT(history_delete_directives); | |
| 393 VISIT(autofill_culling); | |
| 394 VISIT(pre_commit_update_avoidance); | |
| 395 VISIT(favicon_sync); | |
| 396 VISIT(gcm_channel); | |
| 397 VISIT(gcm_invalidations); | |
| 398 } | |
| 399 | |
| 400 template <class V> | |
| 401 void VisitProtoFields(V& visitor, | |
| 402 const sync_pb::ExtensionSettingSpecifics& proto) { | |
| 403 VISIT(extension_id); | |
| 404 VISIT(key); | |
| 405 VISIT(value); | |
| 406 } | |
| 407 | |
| 408 template <class V> | |
| 409 void VisitProtoFields(V& visitor, const sync_pb::ExtensionSpecifics& proto) { | |
| 410 VISIT(id); | |
| 411 VISIT(version); | |
| 412 VISIT(update_url); | |
| 413 VISIT(enabled); | |
| 414 VISIT(incognito_enabled); | |
| 415 VISIT(name); | |
| 416 VISIT(remote_install); | |
| 417 VISIT(installed_by_custodian); | |
| 418 VISIT(all_urls_enabled); | |
| 419 VISIT(disable_reasons); | |
| 420 } | |
| 421 | |
| 422 template <class V> | |
| 423 void VisitProtoFields(V& visitor, const sync_pb::FaviconData& proto) { | |
| 424 VISIT_BYTES(favicon); | |
| 425 VISIT(width); | |
| 426 VISIT(height); | |
| 427 } | |
| 428 | |
| 429 template <class V> | |
| 430 void VisitProtoFields(V& visitor, const sync_pb::FaviconImageSpecifics& proto) { | |
| 431 VISIT(favicon_url); | |
| 432 VISIT(favicon_web); | |
| 433 VISIT(favicon_web_32); | |
| 434 VISIT(favicon_touch_64); | |
| 435 VISIT(favicon_touch_precomposed_64); | |
| 436 } | |
| 437 | |
| 438 template <class V> | |
| 439 void VisitProtoFields(V& visitor, | |
| 440 const sync_pb::FaviconTrackingSpecifics& proto) { | |
| 441 VISIT(favicon_url); | |
| 442 VISIT(last_visit_time_ms); | |
| 443 VISIT(is_bookmarked); | |
| 444 } | |
| 445 | |
| 446 template <class V> | |
| 447 void VisitProtoFields(V& visitor, | |
| 448 const sync_pb::HistoryDeleteDirectiveSpecifics& proto) { | |
| 449 VISIT(global_id_directive); | |
| 450 VISIT(time_range_directive); | |
| 451 } | |
| 452 | |
| 453 template <class V> | |
| 454 void VisitProtoFields(V& visitor, | |
| 455 const sync_pb::ManagedUserSettingSpecifics& proto) { | |
| 456 VISIT(name); | |
| 457 VISIT(value); | |
| 458 } | |
| 459 | |
| 460 template <class V> | |
| 461 void VisitProtoFields(V& visitor, const sync_pb::ManagedUserSpecifics& proto) { | |
| 462 VISIT(id); | |
| 463 VISIT(name); | |
| 464 VISIT(acknowledged); | |
| 465 VISIT(master_key); | |
| 466 VISIT(chrome_avatar); | |
| 467 VISIT(chromeos_avatar); | |
| 468 } | |
| 469 | |
| 470 template <class V> | |
| 471 void VisitProtoFields(V& visitor, | |
| 472 const sync_pb::ManagedUserSharedSettingSpecifics& proto) { | |
| 473 VISIT(mu_id); | |
| 474 VISIT(key); | |
| 475 VISIT(value); | |
| 476 VISIT(acknowledged); | |
| 477 } | |
| 478 | |
| 479 template <class V> | |
| 480 void VisitProtoFields(V& visitor, | |
| 481 const sync_pb::ManagedUserWhitelistSpecifics& proto) { | |
| 482 VISIT(id); | |
| 483 VISIT(name); | |
| 484 } | |
| 485 | |
| 486 template <class V> | |
| 487 void VisitProtoFields(V& visitor, const sync_pb::NigoriSpecifics& proto) { | |
| 488 VISIT(encryption_keybag); | |
| 489 VISIT(keybag_is_frozen); | |
| 490 VISIT(encrypt_bookmarks); | |
| 491 VISIT(encrypt_preferences); | |
| 492 VISIT(encrypt_autofill_profile); | |
| 493 VISIT(encrypt_autofill); | |
| 494 VISIT(encrypt_themes); | |
| 495 VISIT(encrypt_typed_urls); | |
| 496 VISIT(encrypt_extension_settings); | |
| 497 VISIT(encrypt_extensions); | |
| 498 VISIT(encrypt_sessions); | |
| 499 VISIT(encrypt_app_settings); | |
| 500 VISIT(encrypt_apps); | |
| 501 VISIT(encrypt_search_engines); | |
| 502 VISIT(encrypt_dictionary); | |
| 503 VISIT(encrypt_articles); | |
| 504 VISIT(encrypt_app_list); | |
| 505 VISIT(encrypt_arc_package); | |
| 506 VISIT(encrypt_reading_list); | |
| 507 VISIT(encrypt_everything); | |
| 508 VISIT(server_only_was_missing_keystore_migration_time); | |
| 509 VISIT(sync_tab_favicons); | |
| 510 VISIT_ENUM(passphrase_type); | |
| 511 VISIT(keystore_decryptor_token); | |
| 512 VISIT(keystore_migration_time); | |
| 513 VISIT(custom_passphrase_time); | |
| 514 } | |
| 515 | |
| 516 template <class V> | |
| 517 void VisitProtoFields(V& visitor, const sync_pb::ArticlePage& proto) { | |
| 518 VISIT(url); | |
| 519 } | |
| 520 | |
| 521 template <class V> | |
| 522 void VisitProtoFields(V& visitor, const sync_pb::ArticleSpecifics& proto) { | |
| 523 VISIT(entry_id); | |
| 524 VISIT(title); | |
| 525 VISIT_REP(pages); | |
| 526 } | |
| 527 | |
| 528 template <class V> | |
| 529 void VisitProtoFields(V& visitor, const sync_pb::PasswordSpecifics& proto) { | |
| 530 VISIT(encrypted); | |
| 531 VISIT(unencrypted_metadata); | |
| 532 } | |
| 533 | |
| 534 template <class V> | |
| 535 void VisitProtoFields(V& visitor, const sync_pb::PreferenceSpecifics& proto) { | |
| 536 VISIT(name); | |
| 537 VISIT(value); | |
| 538 } | |
| 539 | |
| 540 template <class V> | |
| 541 void VisitProtoFields(V& visitor, const sync_pb::PrinterSpecifics& proto) { | |
| 542 VISIT(id); | |
| 543 VISIT(display_name); | |
| 544 VISIT(description); | |
| 545 VISIT(manufacturer); | |
| 546 VISIT(model); | |
| 547 VISIT(uri); | |
| 548 VISIT(uuid); | |
| 549 VISIT(ppd); | |
| 550 } | |
| 551 | |
| 552 template <class V> | |
| 553 void VisitProtoFields(V& visitor, | |
| 554 const sync_pb::PriorityPreferenceSpecifics& proto) { | |
| 555 VISIT(preference); | |
| 556 } | |
| 557 | |
| 558 template <class V> | |
| 559 void VisitProtoFields( | |
| 560 V& visitor, | |
| 561 const sync_pb::SyncedNotificationAppInfoSpecifics& proto) { | |
| 562 } | |
| 563 | |
| 564 template <class V> | |
| 565 void VisitProtoFields(V& visitor, | |
| 566 const sync_pb::SyncedNotificationSpecifics& proto) { | |
| 567 } | |
| 568 | |
| 569 template <class V> | |
| 570 void VisitProtoFields(V& visitor, const sync_pb::SearchEngineSpecifics& proto) { | |
| 571 VISIT(short_name); | |
| 572 VISIT(keyword); | |
| 573 VISIT(favicon_url); | |
| 574 VISIT(url); | |
| 575 VISIT(safe_for_autoreplace); | |
| 576 VISIT(originating_url); | |
| 577 VISIT(date_created); | |
| 578 VISIT(input_encodings); | |
| 579 VISIT(show_in_default_list); | |
| 580 VISIT(suggestions_url); | |
| 581 VISIT(prepopulate_id); | |
| 582 VISIT(autogenerate_keyword); | |
| 583 VISIT(instant_url); | |
| 584 VISIT(last_modified); | |
| 585 VISIT(sync_guid); | |
| 586 VISIT_REP(alternate_urls); | |
| 587 VISIT(search_terms_replacement_key); | |
| 588 VISIT(image_url); | |
| 589 VISIT(search_url_post_params); | |
| 590 VISIT(suggestions_url_post_params); | |
| 591 VISIT(instant_url_post_params); | |
| 592 VISIT(image_url_post_params); | |
| 593 VISIT(new_tab_url); | |
| 594 } | |
| 595 | |
| 596 template <class V> | |
| 597 void VisitProtoFields(V& visitor, const sync_pb::SessionSpecifics& proto) { | |
| 598 VISIT(session_tag); | |
| 599 VISIT(header); | |
| 600 VISIT(tab); | |
| 601 VISIT(tab_node_id); | |
| 602 } | |
| 603 | |
| 604 template <class V> | |
| 605 void VisitProtoFields(V& visitor, const sync_pb::ThemeSpecifics& proto) { | |
| 606 VISIT(use_custom_theme); | |
| 607 VISIT(use_system_theme_by_default); | |
| 608 VISIT(custom_theme_name); | |
| 609 VISIT(custom_theme_id); | |
| 610 VISIT(custom_theme_update_url); | |
| 611 } | |
| 612 | |
| 613 template <class V> | |
| 614 void VisitProtoFields(V& visitor, const sync_pb::TypedUrlSpecifics& proto) { | |
| 615 VISIT(url); | |
| 616 VISIT(title); | |
| 617 VISIT(hidden); | |
| 618 VISIT_REP(visits); | |
| 619 VISIT_REP(visit_transitions); | |
| 620 } | |
| 621 | |
| 622 template <class V> | |
| 623 void VisitProtoFields(V& visitor, | |
| 624 const sync_pb::WalletMaskedCreditCard& proto) { | |
| 625 VISIT(id); | |
| 626 VISIT_ENUM(status); | |
| 627 VISIT(name_on_card); | |
| 628 VISIT_ENUM(type); | |
| 629 VISIT(last_four); | |
| 630 VISIT(exp_month); | |
| 631 VISIT(exp_year); | |
| 632 VISIT(billing_address_id); | |
| 633 } | |
| 634 | |
| 635 template <class V> | |
| 636 void VisitProtoFields(V& visitor, const sync_pb::WalletPostalAddress& proto) { | |
| 637 VISIT(id); | |
| 638 VISIT(recipient_name); | |
| 639 VISIT(company_name); | |
| 640 VISIT_REP(street_address); | |
| 641 VISIT(address_1); | |
| 642 VISIT(address_2); | |
| 643 VISIT(address_3); | |
| 644 VISIT(address_4); | |
| 645 VISIT(postal_code); | |
| 646 VISIT(sorting_code); | |
| 647 VISIT(country_code); | |
| 648 VISIT(phone_number); | |
| 649 VISIT(language_code); | |
| 650 } | |
| 651 | |
| 652 template <class V> | |
| 653 void VisitProtoFields(V& visitor, | |
| 654 const sync_pb::WifiCredentialSpecifics& proto) { | |
| 655 VISIT_BYTES(ssid); | |
| 656 VISIT_ENUM(security_class); | |
| 657 VISIT_BYTES(passphrase); | |
| 658 } | |
| 659 | |
| 660 template <class V> | |
| 661 void VisitProtoFields(V& visitor, const sync_pb::EntitySpecifics& proto) { | |
| 662 VISIT(app); | |
| 663 VISIT(app_list); | |
| 664 VISIT(app_notification); | |
| 665 VISIT(app_setting); | |
| 666 VISIT(arc_package); | |
| 667 VISIT(article); | |
| 668 VISIT(autofill); | |
| 669 VISIT(autofill_profile); | |
| 670 VISIT(autofill_wallet); | |
| 671 VISIT(wallet_metadata); | |
| 672 VISIT(bookmark); | |
| 673 VISIT(device_info); | |
| 674 VISIT(dictionary); | |
| 675 VISIT(experiments); | |
| 676 VISIT(extension); | |
| 677 VISIT(extension_setting); | |
| 678 VISIT(favicon_image); | |
| 679 VISIT(favicon_tracking); | |
| 680 VISIT(history_delete_directive); | |
| 681 VISIT(managed_user_setting); | |
| 682 VISIT(managed_user_shared_setting); | |
| 683 VISIT(managed_user); | |
| 684 VISIT(managed_user_whitelist); | |
| 685 VISIT(nigori); | |
| 686 VISIT(password); | |
| 687 VISIT(preference); | |
| 688 VISIT(printer); | |
| 689 VISIT(priority_preference); | |
| 690 VISIT(reading_list); | |
| 691 VISIT(search_engine); | |
| 692 VISIT(session); | |
| 693 VISIT(synced_notification); | |
| 694 VISIT(synced_notification_app_info); | |
| 695 VISIT(theme); | |
| 696 VISIT(typed_url); | |
| 697 VISIT(wifi_credential); | |
| 698 } | |
| 699 | |
| 700 template <class V> | |
| 701 void VisitProtoFields(V& visitor, const sync_pb::SyncEntity& proto) { | |
| 702 VISIT(id_string); | |
| 703 VISIT(parent_id_string); | |
| 704 VISIT(old_parent_id); | |
| 705 VISIT(version); | |
| 706 VISIT(mtime); | |
| 707 VISIT(ctime); | |
| 708 VISIT(name); | |
| 709 VISIT(non_unique_name); | |
| 710 VISIT(sync_timestamp); | |
| 711 VISIT(server_defined_unique_tag); | |
| 712 VISIT(position_in_parent); | |
| 713 VISIT(unique_position); | |
| 714 VISIT(insert_after_item_id); | |
| 715 VISIT(deleted); | |
| 716 VISIT(originator_cache_guid); | |
| 717 VISIT(originator_client_item_id); | |
| 718 VISIT(specifics); | |
| 719 VISIT(folder); | |
| 720 VISIT(client_defined_unique_tag); | |
| 721 VISIT_REP(attachment_id); | |
| 722 } | |
| 723 | |
| 724 template <class V> | |
| 725 void VisitProtoFields(V& visitor, | |
| 726 const sync_pb::ChromiumExtensionsActivity& proto) { | |
| 727 VISIT(extension_id); | |
| 728 VISIT(bookmark_writes_since_last_commit); | |
| 729 } | |
| 730 | |
| 731 template <class V> | |
| 732 void VisitProtoFields(V& visitor, const sync_pb::CommitMessage& proto) { | |
| 733 VISIT_REP(entries); | |
| 734 VISIT(cache_guid); | |
| 735 VISIT_REP(extensions_activity); | |
| 736 VISIT(config_params); | |
| 737 } | |
| 738 | |
| 739 template <class V> | |
| 740 void VisitProtoFields(V& visitor, const sync_pb::GetUpdateTriggers& proto) { | |
| 741 VISIT_REP(notification_hint); | |
| 742 VISIT(client_dropped_hints); | |
| 743 VISIT(invalidations_out_of_sync); | |
| 744 VISIT(local_modification_nudges); | |
| 745 VISIT(datatype_refresh_nudges); | |
| 746 } | |
| 747 | |
| 748 template <class V> | |
| 749 void VisitProtoFields(V& visitor, | |
| 750 const sync_pb::DataTypeProgressMarker& proto) { | |
| 751 VISIT(data_type_id); | |
| 752 VISIT_BYTES(token); | |
| 753 VISIT(timestamp_token_for_migration); | |
| 754 VISIT(notification_hint); | |
| 755 VISIT(get_update_triggers); | |
| 756 } | |
| 757 | |
| 758 template <class V> | |
| 759 void VisitProtoFields(V& visitor, const sync_pb::DataTypeContext& proto) { | |
| 760 VISIT(data_type_id); | |
| 761 VISIT(context); | |
| 762 VISIT(version); | |
| 763 } | |
| 764 | |
| 765 template <class V> | |
| 766 void VisitProtoFields(V& visitor, const sync_pb::GetUpdatesCallerInfo& proto) { | |
| 767 VISIT_ENUM(source); | |
| 768 VISIT(notifications_enabled); | |
| 769 } | |
| 770 | |
| 771 template <class V> | |
| 772 void VisitProtoFields(V& visitor, const sync_pb::GetUpdatesMessage& proto) { | |
| 773 VISIT(caller_info); | |
| 774 VISIT(fetch_folders); | |
| 775 VISIT(batch_size); | |
| 776 VISIT_REP(from_progress_marker); | |
| 777 VISIT(streaming); | |
| 778 VISIT(need_encryption_key); | |
| 779 VISIT(create_mobile_bookmarks_folder); | |
| 780 VISIT_ENUM(get_updates_origin); | |
| 781 VISIT_REP(client_contexts); | |
| 782 } | |
| 783 | |
| 784 template <class V> | |
| 785 void VisitProtoFields(V& visitor, const sync_pb::ClientStatus& proto) { | |
| 786 VISIT(hierarchy_conflict_detected); | |
| 787 } | |
| 788 | |
| 789 template <class V> | |
| 790 void VisitProtoFields(V& visitor, | |
| 791 const sync_pb::CommitResponse::EntryResponse& proto) { | |
| 792 VISIT_ENUM(response_type); | |
| 793 VISIT(id_string); | |
| 794 VISIT(parent_id_string); | |
| 795 VISIT(position_in_parent); | |
| 796 VISIT(version); | |
| 797 VISIT(name); | |
| 798 VISIT(error_message); | |
| 799 VISIT(mtime); | |
| 800 } | |
| 801 | |
| 802 template <class V> | |
| 803 void VisitProtoFields(V& visitor, const sync_pb::CommitResponse& proto) { | |
| 804 VISIT_REP(entryresponse); | |
| 805 } | |
| 806 | |
| 807 template <class V> | |
| 808 void VisitProtoFields(V& visitor, const sync_pb::GetUpdatesResponse& proto) { | |
| 809 VISIT_REP(entries) | |
| 810 VISIT(changes_remaining); | |
| 811 VISIT_REP(new_progress_marker); | |
| 812 VISIT_REP(context_mutations); | |
| 813 } | |
| 814 | |
| 815 template <class V> | |
| 816 void VisitProtoFields(V& visitor, const sync_pb::ClientCommand& proto) { | |
| 817 VISIT(set_sync_poll_interval); | |
| 818 VISIT(set_sync_long_poll_interval); | |
| 819 VISIT(max_commit_batch_size); | |
| 820 VISIT(sessions_commit_delay_seconds); | |
| 821 VISIT(throttle_delay_seconds); | |
| 822 VISIT(client_invalidation_hint_buffer_size); | |
| 823 } | |
| 824 | |
| 825 template <class V> | |
| 826 void VisitProtoFields(V& visitor, | |
| 827 const sync_pb::ClientToServerResponse::Error& proto) { | |
| 828 VISIT_ENUM(error_type); | |
| 829 VISIT(error_description); | |
| 830 VISIT(url); | |
| 831 VISIT_ENUM(action); | |
| 832 } | |
| 833 | |
| 834 template <class V> | |
| 835 void VisitProtoFields(V& visitor, | |
| 836 const sync_pb::ClientToServerResponse& proto) { | |
| 837 VISIT(commit); | |
| 838 VISIT(get_updates); | |
| 839 VISIT(error); | |
| 840 VISIT_ENUM(error_code); | |
| 841 VISIT(error_message); | |
| 842 VISIT(store_birthday); | |
| 843 VISIT(client_command); | |
| 844 VISIT_REP(migrated_data_type_id); | |
| 845 } | |
| 846 | |
| 847 template <class V> | |
| 848 void VisitProtoFields(V& visitor, const sync_pb::ClientToServerMessage& proto) { | |
| 849 VISIT(share); | |
| 850 VISIT(protocol_version); | |
| 851 VISIT(commit); | |
| 852 VISIT(get_updates); | |
| 853 VISIT(store_birthday); | |
| 854 VISIT(sync_problem_detected); | |
| 855 VISIT(debug_info); | |
| 856 VISIT(client_status); | |
| 857 } | |
| 858 | |
| 859 template <class V> | |
| 860 void VisitProtoFields(V& visitor, | |
| 861 const sync_pb::DatatypeAssociationStats& proto) { | |
| 862 VISIT(data_type_id); | |
| 863 VISIT(num_local_items_before_association); | |
| 864 VISIT(num_sync_items_before_association); | |
| 865 VISIT(num_local_items_after_association); | |
| 866 VISIT(num_sync_items_after_association); | |
| 867 VISIT(num_local_items_added); | |
| 868 VISIT(num_local_items_deleted); | |
| 869 VISIT(num_local_items_modified); | |
| 870 VISIT(num_sync_items_added); | |
| 871 VISIT(num_sync_items_deleted); | |
| 872 VISIT(num_sync_items_modified); | |
| 873 VISIT(local_version_pre_association); | |
| 874 VISIT(sync_version_pre_association); | |
| 875 VISIT(had_error); | |
| 876 VISIT(download_wait_time_us); | |
| 877 VISIT(download_time_us); | |
| 878 VISIT(association_wait_time_for_high_priority_us); | |
| 879 VISIT(association_wait_time_for_same_priority_us); | |
| 880 } | |
| 881 | |
| 882 template <class V> | |
| 883 void VisitProtoFields(V& visitor, const sync_pb::DebugEventInfo& proto) { | |
| 884 VISIT_ENUM(singleton_event); | |
| 885 VISIT(sync_cycle_completed_event_info); | |
| 886 VISIT(nudging_datatype); | |
| 887 VISIT_REP(datatypes_notified_from_server); | |
| 888 VISIT(datatype_association_stats); | |
| 889 } | |
| 890 | |
| 891 template <class V> | |
| 892 void VisitProtoFields(V& visitor, const sync_pb::DebugInfo& proto) { | |
| 893 VISIT_REP(events); | |
| 894 VISIT(cryptographer_ready); | |
| 895 VISIT(cryptographer_has_pending_keys); | |
| 896 VISIT(events_dropped); | |
| 897 } | |
| 898 | |
| 899 template <class V> | |
| 900 void VisitProtoFields(V& visitor, | |
| 901 const sync_pb::SyncCycleCompletedEventInfo& proto) { | |
| 902 VISIT(num_encryption_conflicts); | |
| 903 VISIT(num_hierarchy_conflicts); | |
| 904 VISIT(num_server_conflicts); | |
| 905 VISIT(num_updates_downloaded); | |
| 906 VISIT(num_reflected_updates_downloaded); | |
| 907 VISIT(caller_info); | |
| 908 } | |
| 909 | |
| 910 template <class V> | |
| 911 void VisitProtoFields(V& visitor, const sync_pb::ClientConfigParams& proto) { | |
| 912 VISIT_REP(enabled_type_ids); | |
| 913 VISIT(tabs_datatype_enabled); | |
| 914 VISIT(cookie_jar_mismatch); | |
| 915 } | |
| 916 | |
| 917 template <class V> | |
| 918 void VisitProtoFields(V& visitor, const sync_pb::AttachmentIdProto& proto) { | |
| 919 VISIT(unique_id); | |
| 920 } | |
| 921 | |
| 922 template <class V> | |
| 923 void VisitProtoFields(V& visitor, const sync_pb::EntityMetadata& proto) { | |
| 924 VISIT(client_tag_hash); | |
| 925 VISIT(server_id); | |
| 926 VISIT(is_deleted); | |
| 927 VISIT(sequence_number); | |
| 928 VISIT(acked_sequence_number); | |
| 929 VISIT(server_version); | |
| 930 VISIT(creation_time); | |
| 931 VISIT(modification_time); | |
| 932 VISIT(specifics_hash); | |
| 933 VISIT(base_specifics_hash); | |
| 934 } | |
| 935 | |
| 936 } // namespace syncer | |
| 937 | |
| 938 #undef VISIT_ | |
| 939 #undef VISIT_BYTES | |
| 940 #undef VISIT_ENUM | |
| 941 #undef VISIT | |
| 942 #undef VISIT_REP | |
| 943 | |
| 944 #endif // COMPONENTS_SYNC_PROTOCOL_PROTO_VISITORS_H_ | |
| OLD | NEW |