Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / components / sync_driver / sync_client.h
blobe8e668da7404b2dc5f73cf49d4baf8a23b50d464
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"
13 class PrefService;
15 namespace autofill {
16 class AutofillWebDataService;
17 class AutocompleteSyncableService;
18 class PersonalDataManager;
19 } // namespace autofill
21 namespace bookmarks {
22 class BookmarkModel;
23 } // namespace bookmarks
25 namespace history {
26 class HistoryService;
27 } // namespace history
29 namespace password_manager {
30 class PasswordStore;
31 } // namespace password_manager
33 namespace syncer {
34 class SyncableService;
35 } // namespace syncer
37 namespace sync_driver {
39 class SyncApiComponentFactory;
40 class SyncService;
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.
48 class SyncClient {
49 public:
50 SyncClient();
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;
75 protected:
76 virtual ~SyncClient();
78 private:
79 DISALLOW_COPY_AND_ASSIGN(SyncClient);
82 } // namespace sync_driver
84 #endif // COMPONENTS_SYNC_DRIVER_SYNC_CLIENT_H_