| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SYNCABLE_EXTENSION_SETTINGS_STORAGE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SYNCABLE_EXTENSION_SETTINGS_STORAGE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_SYNCABLE_EXTENSION_SETTINGS_STORAGE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SYNCABLE_EXTENSION_SETTINGS_STORAGE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 virtual Result Get() OVERRIDE; | 34 virtual Result Get() OVERRIDE; |
| 35 virtual Result Set(const std::string& key, const Value& value) OVERRIDE; | 35 virtual Result Set(const std::string& key, const Value& value) OVERRIDE; |
| 36 virtual Result Set(const DictionaryValue& settings) OVERRIDE; | 36 virtual Result Set(const DictionaryValue& settings) OVERRIDE; |
| 37 virtual Result Remove(const std::string& key) OVERRIDE; | 37 virtual Result Remove(const std::string& key) OVERRIDE; |
| 38 virtual Result Remove(const std::vector<std::string>& keys) OVERRIDE; | 38 virtual Result Remove(const std::vector<std::string>& keys) OVERRIDE; |
| 39 virtual Result Clear() OVERRIDE; | 39 virtual Result Clear() OVERRIDE; |
| 40 | 40 |
| 41 // Sync-related methods, analogous to those on SyncableService (handled by | 41 // Sync-related methods, analogous to those on SyncableService (handled by |
| 42 // ExtensionSettings). | 42 // ExtensionSettings). |
| 43 SyncError StartSyncing( | 43 SyncError StartSyncing( |
| 44 // Either EXTENSION_SETTINGS or APP_SETTINGS. |
| 45 syncable::ModelType type, |
| 44 const DictionaryValue& sync_state, | 46 const DictionaryValue& sync_state, |
| 45 // Must NOT be NULL. Ownership NOT taken. | 47 // Must NOT be NULL. Ownership NOT taken. |
| 46 SyncChangeProcessor* sync_processor); | 48 SyncChangeProcessor* sync_processor); |
| 47 void StopSyncing(); | 49 void StopSyncing(); |
| 48 std::vector<SyncError> ProcessSyncChanges( | 50 std::vector<SyncError> ProcessSyncChanges( |
| 49 const ExtensionSettingSyncDataList& sync_changes); | 51 const ExtensionSettingSyncDataList& sync_changes); |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 // Either adds to sync or send updates to sync for some settings. | 54 // Either adds to sync or send updates to sync for some settings. |
| 53 // Whether they're adds or updates depends on the state of |synced_keys_|. | 55 // Whether they're adds or updates depends on the state of |synced_keys_|. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // List of observers to settings changes. | 87 // List of observers to settings changes. |
| 86 const scoped_refptr<ObserverListThreadSafe<ExtensionSettingsObserver> > | 88 const scoped_refptr<ObserverListThreadSafe<ExtensionSettingsObserver> > |
| 87 observers_; | 89 observers_; |
| 88 | 90 |
| 89 // Id of the extension these settings are for. | 91 // Id of the extension these settings are for. |
| 90 std::string const extension_id_; | 92 std::string const extension_id_; |
| 91 | 93 |
| 92 // Storage area to sync. | 94 // Storage area to sync. |
| 93 const scoped_ptr<ExtensionSettingsStorage> delegate_; | 95 const scoped_ptr<ExtensionSettingsStorage> delegate_; |
| 94 | 96 |
| 97 // Sync model type. Either EXTENSION_SETTINGS or APP_SETTINGS while sync is |
| 98 // enabled (between calls to Start/StopSyncing), or UNSPECIFIED while not. |
| 99 syncable::ModelType sync_type_; |
| 100 |
| 95 // Sync processor. Non-NULL while sync is enabled (between calls to | 101 // Sync processor. Non-NULL while sync is enabled (between calls to |
| 96 // StartSyncing and StopSyncing). | 102 // StartSyncing and StopSyncing). |
| 97 SyncChangeProcessor* sync_processor_; | 103 SyncChangeProcessor* sync_processor_; |
| 98 | 104 |
| 99 // Keys of the settings that are currently being synced. Only used to decide | 105 // Keys of the settings that are currently being synced. Only used to decide |
| 100 // whether an ACTION_ADD or ACTION_UPDATE should be sent to sync on a Set(). | 106 // whether an ACTION_ADD or ACTION_UPDATE should be sent to sync on a Set(). |
| 101 std::set<std::string> synced_keys_; | 107 std::set<std::string> synced_keys_; |
| 102 | 108 |
| 103 DISALLOW_COPY_AND_ASSIGN(SyncableExtensionSettingsStorage); | 109 DISALLOW_COPY_AND_ASSIGN(SyncableExtensionSettingsStorage); |
| 104 }; | 110 }; |
| 105 | 111 |
| 106 #endif // CHROME_BROWSER_EXTENSIONS_SYNCABLE_EXTENSION_SETTINGS_STORAGE_H_ | 112 #endif // CHROME_BROWSER_EXTENSIONS_SYNCABLE_EXTENSION_SETTINGS_STORAGE_H_ |
| OLD | NEW |