OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_STORAGE_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_STORAGE_BACKEND_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_STORAGE_BACKEND_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_STORAGE_BACKEND_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/linked_ptr.h" | |
17 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
18 #include "components/sync/model/syncable_service.h" | 17 #include "components/sync/model/syncable_service.h" |
19 #include "extensions/browser/api/storage/settings_observer.h" | 18 #include "extensions/browser/api/storage/settings_observer.h" |
20 #include "extensions/browser/api/storage/settings_storage_quota_enforcer.h" | 19 #include "extensions/browser/api/storage/settings_storage_quota_enforcer.h" |
21 #include "extensions/browser/value_store/value_store_factory.h" | 20 #include "extensions/browser/value_store/value_store_factory.h" |
22 | 21 |
23 namespace syncer { | 22 namespace syncer { |
24 class SyncErrorFactory; | 23 class SyncErrorFactory; |
25 } | 24 } |
26 | 25 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 const scoped_refptr<ValueStoreFactory> storage_factory_; | 79 const scoped_refptr<ValueStoreFactory> storage_factory_; |
81 | 80 |
82 // Quota limits (see SettingsStorageQuotaEnforcer). | 81 // Quota limits (see SettingsStorageQuotaEnforcer). |
83 const SettingsStorageQuotaEnforcer::Limits quota_; | 82 const SettingsStorageQuotaEnforcer::Limits quota_; |
84 | 83 |
85 // The list of observers to settings changes. | 84 // The list of observers to settings changes. |
86 const scoped_refptr<SettingsObserverList> observers_; | 85 const scoped_refptr<SettingsObserverList> observers_; |
87 | 86 |
88 // A cache of ValueStore objects that have already been created. | 87 // A cache of ValueStore objects that have already been created. |
89 // Ensure that there is only ever one created per extension. | 88 // Ensure that there is only ever one created per extension. |
90 typedef std::map<std::string, linked_ptr<SyncableSettingsStorage> > | 89 using StorageObjMap = |
91 StorageObjMap; | 90 std::map<std::string, std::unique_ptr<SyncableSettingsStorage>>; |
92 mutable StorageObjMap storage_objs_; | 91 mutable StorageObjMap storage_objs_; |
93 | 92 |
94 // Current sync model type. Either EXTENSION_SETTINGS or APP_SETTINGS. | 93 // Current sync model type. Either EXTENSION_SETTINGS or APP_SETTINGS. |
95 syncer::ModelType sync_type_; | 94 syncer::ModelType sync_type_; |
96 | 95 |
97 // Current sync processor, if any. | 96 // Current sync processor, if any. |
98 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; | 97 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; |
99 | 98 |
100 // Current sync error handler if any. | 99 // Current sync error handler if any. |
101 std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory_; | 100 std::unique_ptr<syncer::SyncErrorFactory> sync_error_factory_; |
102 | 101 |
103 syncer::SyncableService::StartSyncFlare flare_; | 102 syncer::SyncableService::StartSyncFlare flare_; |
104 | 103 |
105 DISALLOW_COPY_AND_ASSIGN(SyncStorageBackend); | 104 DISALLOW_COPY_AND_ASSIGN(SyncStorageBackend); |
106 }; | 105 }; |
107 | 106 |
108 } // namespace extensions | 107 } // namespace extensions |
109 | 108 |
110 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_STORAGE_BACKEND_H_ | 109 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_STORAGE_BACKEND_H_ |
OLD | NEW |