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 "components/sync_driver/profile_sync_components_factory.h"
12 #include "sync/internal_api/public/base/model_type.h"
15 class AutofillWebDataService
;
16 class AutocompleteSyncableService
;
17 class PersonalDataManager
;
18 } // namespace autofill
22 } // namespace bookmarks
26 } // namespace history
28 namespace password_manager
{
30 } // namespace password_manager
34 namespace sync_driver
{
36 // Interface for clients of the Sync API to plumb through necessary dependent
37 // components. This interface is purely for abstracting dependencies, and
38 // should not contain any non-trivial functional logic.
40 // Note: on some platforms, getters might return nullptr. Callers are expected
41 // to handle these scenarios gracefully.
42 // TODO(zea): crbug.com/512768 Remove the ProfileSyncComponentsFactory
43 // dependency once everything uses SyncClient instead, then have the SyncClient
44 // include a GetSyncApiComponentsFactory getter.
45 class SyncClient
: public ProfileSyncComponentsFactory
{
49 // Returns the current profile's preference service.
50 virtual PrefService
* GetPrefService() = 0;
52 // DataType specific service getters.
53 virtual bookmarks::BookmarkModel
* GetBookmarkModel() = 0;
54 virtual history::HistoryService
* GetHistoryService() = 0;
55 virtual scoped_refptr
<password_manager::PasswordStore
> GetPasswordStore() = 0;
56 virtual autofill::PersonalDataManager
* GetPersonalDataManager() = 0;
57 virtual scoped_refptr
<autofill::AutofillWebDataService
>
58 GetWebDataService() = 0;
61 ~SyncClient() override
;
64 DISALLOW_COPY_AND_ASSIGN(SyncClient
);
67 } // namespace sync_driver
69 #endif // COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_