browser_sync_client.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright 2019 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_BROWSER_SYNC_BROWSER_SYNC_CLIENT_H_
  5. #define COMPONENTS_BROWSER_SYNC_BROWSER_SYNC_CLIENT_H_
  6. #include "base/callback_forward.h"
  7. #include "base/memory/ref_counted.h"
  8. #include "base/memory/weak_ptr.h"
  9. #include "components/sync/driver/sync_client.h"
  10. #include "components/sync/model/model_type_controller_delegate.h"
  11. namespace favicon {
  12. class FaviconService;
  13. } // namespace favicon
  14. namespace history {
  15. class HistoryService;
  16. } // namespace history
  17. namespace send_tab_to_self {
  18. class SendTabToSelfSyncService;
  19. } // namespace send_tab_to_self
  20. namespace sync_preferences {
  21. class PrefServiceSyncable;
  22. } // namespace sync_preferences
  23. namespace sync_sessions {
  24. class SessionSyncService;
  25. } // namespace sync_sessions
  26. namespace syncer {
  27. class DeviceInfoSyncService;
  28. class ModelTypeStoreService;
  29. } // namespace syncer
  30. namespace browser_sync {
  31. // Extension to interface syncer::SyncClient to bundle dependencies that
  32. // sync-the-feature requires for datatypes common to all platforms.
  33. // Note: on some platforms, getters might return nullptr. Callers are expected
  34. // to handle these scenarios gracefully.
  35. class BrowserSyncClient : public syncer::SyncClient {
  36. public:
  37. BrowserSyncClient() = default;
  38. BrowserSyncClient(const BrowserSyncClient&) = delete;
  39. BrowserSyncClient& operator=(const BrowserSyncClient&) = delete;
  40. ~BrowserSyncClient() override = default;
  41. virtual syncer::ModelTypeStoreService* GetModelTypeStoreService() = 0;
  42. // Returns a weak pointer to the ModelTypeControllerDelegate specified by
  43. // |type|. Weak pointer may be unset if service is already destroyed.
  44. virtual base::WeakPtr<syncer::ModelTypeControllerDelegate>
  45. GetControllerDelegateForModelType(syncer::ModelType type) = 0;
  46. // DataType specific service getters.
  47. virtual syncer::DeviceInfoSyncService* GetDeviceInfoSyncService() = 0;
  48. virtual favicon::FaviconService* GetFaviconService() = 0;
  49. virtual history::HistoryService* GetHistoryService() = 0;
  50. virtual sync_preferences::PrefServiceSyncable* GetPrefServiceSyncable() = 0;
  51. virtual sync_sessions::SessionSyncService* GetSessionSyncService() = 0;
  52. virtual send_tab_to_self::SendTabToSelfSyncService*
  53. GetSendTabToSelfSyncService() = 0;
  54. };
  55. } // namespace browser_sync
  56. #endif // COMPONENTS_BROWSER_SYNC_BROWSER_SYNC_CLIENT_H_