1 // Copyright 2015 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.
5 #ifndef COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_
6 #define COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "sync/internal_api/public/base/model_type.h"
16 class AutofillWebDataService
;
17 class AutocompleteSyncableService
;
18 class PersonalDataManager
;
19 } // namespace autofill
23 } // namespace bookmarks
27 } // namespace history
29 namespace password_manager
{
31 } // namespace password_manager
34 class SyncableService
;
37 namespace sync_driver
{
39 class SyncApiComponentFactory
;
42 // Interface for clients of the Sync API to plumb through necessary dependent
43 // components. This interface is purely for abstracting dependencies, and
44 // should not contain any non-trivial functional logic.
46 // Note: on some platforms, getters might return nullptr. Callers are expected
47 // to handle these scenarios gracefully.
52 // Returns the current SyncService instance.
53 virtual SyncService
* GetSyncService() = 0;
55 // Returns the current profile's preference service.
56 virtual PrefService
* GetPrefService() = 0;
58 // DataType specific service getters.
59 virtual bookmarks::BookmarkModel
* GetBookmarkModel() = 0;
60 virtual history::HistoryService
* GetHistoryService() = 0;
61 virtual scoped_refptr
<password_manager::PasswordStore
> GetPasswordStore() = 0;
62 virtual autofill::PersonalDataManager
* GetPersonalDataManager() = 0;
63 virtual scoped_refptr
<autofill::AutofillWebDataService
>
64 GetWebDataService() = 0;
66 // Returns a weak pointer to the syncable service specified by |type|.
67 // Weak pointer may be unset if service is already destroyed.
68 // Note: Should only be called from the model type thread.
69 virtual base::WeakPtr
<syncer::SyncableService
> GetSyncableServiceForType(
70 syncer::ModelType type
) = 0;
72 // Returns the current SyncApiComponentFactory instance.
73 virtual SyncApiComponentFactory
* GetSyncApiComponentFactory() = 0;
76 virtual ~SyncClient();
79 DISALLOW_COPY_AND_ASSIGN(SyncClient
);
82 } // namespace sync_driver
84 #endif // COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_