| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SETTINGS_SETTINGS_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_BACKEND_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_BACKEND_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_BACKEND_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // Gets a weak reference to the storage area for |extension_id|. | 44 // Gets a weak reference to the storage area for |extension_id|. |
| 45 // Must be run on the FILE thread. | 45 // Must be run on the FILE thread. |
| 46 ValueStore* GetStorage(const std::string& extension_id) const; | 46 ValueStore* GetStorage(const std::string& extension_id) const; |
| 47 | 47 |
| 48 // Deletes all setting data for an extension. Call on the FILE thread. | 48 // Deletes all setting data for an extension. Call on the FILE thread. |
| 49 void DeleteStorage(const std::string& extension_id); | 49 void DeleteStorage(const std::string& extension_id); |
| 50 | 50 |
| 51 // syncer::SyncableService implementation. | 51 // syncer::SyncableService implementation. |
| 52 virtual syncer::SyncDataList GetAllSyncData( | 52 virtual syncer::SyncDataList GetAllSyncData( |
| 53 syncable::ModelType type) const OVERRIDE; | 53 syncer::ModelType type) const OVERRIDE; |
| 54 virtual syncer::SyncError MergeDataAndStartSyncing( | 54 virtual syncer::SyncError MergeDataAndStartSyncing( |
| 55 syncable::ModelType type, | 55 syncer::ModelType type, |
| 56 const syncer::SyncDataList& initial_sync_data, | 56 const syncer::SyncDataList& initial_sync_data, |
| 57 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 57 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
| 58 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) OVERRIDE; | 58 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) OVERRIDE; |
| 59 virtual syncer::SyncError ProcessSyncChanges( | 59 virtual syncer::SyncError ProcessSyncChanges( |
| 60 const tracked_objects::Location& from_here, | 60 const tracked_objects::Location& from_here, |
| 61 const syncer::SyncChangeList& change_list) OVERRIDE; | 61 const syncer::SyncChangeList& change_list) OVERRIDE; |
| 62 virtual void StopSyncing(syncable::ModelType type) OVERRIDE; | 62 virtual void StopSyncing(syncer::ModelType type) OVERRIDE; |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 // Gets a weak reference to the storage area for a given extension, | 65 // Gets a weak reference to the storage area for a given extension, |
| 66 // initializing sync with some initial data if sync enabled. | 66 // initializing sync with some initial data if sync enabled. |
| 67 SyncableSettingsStorage* GetOrCreateStorageWithSyncData( | 67 SyncableSettingsStorage* GetOrCreateStorageWithSyncData( |
| 68 const std::string& extension_id, | 68 const std::string& extension_id, |
| 69 const DictionaryValue& sync_data) const; | 69 const DictionaryValue& sync_data) const; |
| 70 | 70 |
| 71 // Gets all extension IDs known to extension settings. This may not be all | 71 // Gets all extension IDs known to extension settings. This may not be all |
| 72 // installed extensions. | 72 // installed extensions. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 89 const scoped_refptr<SettingsObserverList> observers_; | 89 const scoped_refptr<SettingsObserverList> observers_; |
| 90 | 90 |
| 91 // A cache of ValueStore objects that have already been created. | 91 // A cache of ValueStore objects that have already been created. |
| 92 // Ensure that there is only ever one created per extension. | 92 // Ensure that there is only ever one created per extension. |
| 93 typedef std::map<std::string, linked_ptr<SyncableSettingsStorage> > | 93 typedef std::map<std::string, linked_ptr<SyncableSettingsStorage> > |
| 94 StorageObjMap; | 94 StorageObjMap; |
| 95 mutable StorageObjMap storage_objs_; | 95 mutable StorageObjMap storage_objs_; |
| 96 | 96 |
| 97 // Current sync model type. Will be UNSPECIFIED if sync hasn't been enabled | 97 // Current sync model type. Will be UNSPECIFIED if sync hasn't been enabled |
| 98 // yet, and either SETTINGS or APP_SETTINGS if it has been. | 98 // yet, and either SETTINGS or APP_SETTINGS if it has been. |
| 99 syncable::ModelType sync_type_; | 99 syncer::ModelType sync_type_; |
| 100 | 100 |
| 101 // Current sync processor, if any. | 101 // Current sync processor, if any. |
| 102 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; | 102 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; |
| 103 | 103 |
| 104 // Current sync error handler if any. | 104 // Current sync error handler if any. |
| 105 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_; | 105 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(SettingsBackend); | 107 DISALLOW_COPY_AND_ASSIGN(SettingsBackend); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace extensions | 110 } // namespace extensions |
| 111 | 111 |
| 112 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_BACKEND_H_ | 112 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_BACKEND_H_ |
| OLD | NEW |