sync_internals_util.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. #ifndef COMPONENTS_SYNC_DRIVER_SYNC_INTERNALS_UTIL_H_
  5. #define COMPONENTS_SYNC_DRIVER_SYNC_INTERNALS_UTIL_H_
  6. #include <memory>
  7. #include <string>
  8. #include "base/types/strong_alias.h"
  9. #include "base/values.h"
  10. #include "components/signin/public/identity_manager/account_info.h"
  11. namespace syncer {
  12. class SyncService;
  13. namespace sync_ui_util {
  14. // These strings are used from logs to pull out specific data from sync; we
  15. // don't want these to ever go out of sync between the logs and sync util.
  16. inline constexpr char kIdentityTitle[] = "Identity";
  17. inline constexpr char kDetailsKey[] = "details";
  18. // Resource paths.
  19. // Must match the resource file names.
  20. inline constexpr char kAboutJS[] = "about.js";
  21. inline constexpr char kChromeSyncJS[] = "chrome_sync.js";
  22. inline constexpr char kDataJS[] = "data.js";
  23. inline constexpr char kEventsJS[] = "events.js";
  24. inline constexpr char kSearchJS[] = "search.js";
  25. inline constexpr char kSyncIndexJS[] = "sync_index.js";
  26. inline constexpr char kSyncLogJS[] = "sync_log.js";
  27. inline constexpr char kSyncNodeBrowserJS[] = "sync_node_browser.js";
  28. inline constexpr char kSyncSearchJS[] = "sync_search.js";
  29. inline constexpr char kUserEventsJS[] = "user_events.js";
  30. inline constexpr char kTrafficLogJS[] = "traffic_log.js";
  31. inline constexpr char kInvalidationsJS[] = "invalidations.js";
  32. // Message handlers.
  33. // Must match the constants used in the resource files.
  34. inline constexpr char kGetAllNodes[] = "getAllNodes";
  35. inline constexpr char kRequestDataAndRegisterForUpdates[] =
  36. "requestDataAndRegisterForUpdates";
  37. inline constexpr char kRequestIncludeSpecificsInitialState[] =
  38. "requestIncludeSpecificsInitialState";
  39. inline constexpr char kRequestListOfTypes[] = "requestListOfTypes";
  40. inline constexpr char kRequestStart[] = "requestStart";
  41. inline constexpr char kRequestStopKeepData[] = "requestStopKeepData";
  42. inline constexpr char kRequestStopClearData[] = "requestStopClearData";
  43. inline constexpr char kSetIncludeSpecifics[] = "setIncludeSpecifics";
  44. inline constexpr char kTriggerRefresh[] = "triggerRefresh";
  45. inline constexpr char kWriteUserEvent[] = "writeUserEvent";
  46. // Other strings.
  47. // WARNING: Must match the property names used in the resource files.
  48. inline constexpr char kEntityCounts[] = "entityCounts";
  49. inline constexpr char kEntities[] = "entities";
  50. inline constexpr char kNonTombstoneEntities[] = "nonTombstoneEntities";
  51. inline constexpr char kIncludeSpecifics[] = "includeSpecifics";
  52. inline constexpr char kModelType[] = "modelType";
  53. inline constexpr char kOnAboutInfoUpdated[] = "onAboutInfoUpdated";
  54. inline constexpr char kOnEntityCountsUpdated[] = "onEntityCountsUpdated";
  55. inline constexpr char kOnProtocolEvent[] = "onProtocolEvent";
  56. inline constexpr char kOnReceivedIncludeSpecificsInitialState[] =
  57. "onReceivedIncludeSpecificsInitialState";
  58. inline constexpr char kOnReceivedListOfTypes[] = "onReceivedListOfTypes";
  59. inline constexpr char kTypes[] = "types";
  60. inline constexpr char kOnInvalidationReceived[] = "onInvalidationReceived";
  61. using IncludeSensitiveData =
  62. base::StrongAlias<class IncludeSensitiveDataTag, bool>;
  63. // This function returns a DictionaryValue which contains all the information
  64. // required to populate the 'About' tab of chrome://sync-internals.
  65. // Note that |service| may be null.
  66. // If |include_sensitive_data| is false, Personally Identifiable Information
  67. // won't be included in the return value.
  68. base::Value::Dict ConstructAboutInformation(
  69. IncludeSensitiveData include_sensitive_data,
  70. SyncService* service,
  71. const std::string& channel);
  72. } // namespace sync_ui_util
  73. } // namespace syncer
  74. #endif // COMPONENTS_SYNC_DRIVER_SYNC_INTERNALS_UTIL_H_