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 CHROME_BROWSER_SYNC_CHROME_SYNC_CLIENT_H__
6 #define CHROME_BROWSER_SYNC_CHROME_SYNC_CLIENT_H__
8 #include "components/sync_driver/sync_client.h"
12 namespace sync_driver
{
13 class SyncApiComponentFactory
;
17 namespace browser_sync
{
19 class ChromeSyncClient
: public sync_driver::SyncClient
{
21 ChromeSyncClient(Profile
* profile
,
22 sync_driver::SyncApiComponentFactory
* component_factory
);
23 ~ChromeSyncClient() override
;
25 // Initializes the ChromeSyncClient internal state.
26 void Initialize(sync_driver::SyncService
* sync_service
);
28 // SyncClient implementation.
29 sync_driver::SyncService
* GetSyncService() override
;
30 PrefService
* GetPrefService() override
;
31 bookmarks::BookmarkModel
* GetBookmarkModel() override
;
32 history::HistoryService
* GetHistoryService() override
;
33 scoped_refptr
<password_manager::PasswordStore
> GetPasswordStore() override
;
34 autofill::PersonalDataManager
* GetPersonalDataManager() override
;
35 scoped_refptr
<autofill::AutofillWebDataService
> GetWebDataService() override
;
36 base::WeakPtr
<syncer::SyncableService
> GetSyncableServiceForType(
37 syncer::ModelType type
) override
;
39 sync_driver::SyncApiComponentFactory
* GetSyncApiComponentFactory() override
;
42 Profile
* const profile_
;
44 // TODO(zea): This is currently a pointer to the "parent" of this class, and
45 // is therefore not owned, but we should eventually have the SyncClient own
46 // the component factory (crbug.com/512832).
47 sync_driver::SyncApiComponentFactory
* const component_factory_
;
49 // Members that must be fetched on the UI thread but accessed on their
50 // respective backend threads.
51 scoped_refptr
<autofill::AutofillWebDataService
> web_data_service_
;
52 scoped_refptr
<password_manager::PasswordStore
> password_store_
;
54 // TODO(zea): this is a member only because Typed URLs needs access to
55 // the UserShare and Cryptographer outside of the UI thread. Remove this
56 // once that's no longer the case.
58 sync_driver::SyncService
* sync_service_
;
61 } // namespace browser_sync
63 #endif // CHROME_BROWSER_SYNC_CHROME_SYNC_CLIENT_H__