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_API_STORAGE_SYNCABLE_SETTINGS_STORAGE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNCABLE_SETTINGS_STORAGE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNCABLE_SETTINGS_STORAGE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNCABLE_SETTINGS_STORAGE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // Returns any error when trying to sync, or an empty error on success. | 91 // Returns any error when trying to sync, or an empty error on success. |
92 syncer::SyncError SendLocalSettingsToSync( | 92 syncer::SyncError SendLocalSettingsToSync( |
93 std::unique_ptr<base::DictionaryValue> local_state); | 93 std::unique_ptr<base::DictionaryValue> local_state); |
94 | 94 |
95 // Overwrites local state with sync state. | 95 // Overwrites local state with sync state. |
96 // Returns any error when trying to sync, or an empty error on success. | 96 // Returns any error when trying to sync, or an empty error on success. |
97 syncer::SyncError OverwriteLocalSettingsWithSync( | 97 syncer::SyncError OverwriteLocalSettingsWithSync( |
98 std::unique_ptr<base::DictionaryValue> sync_state, | 98 std::unique_ptr<base::DictionaryValue> sync_state, |
99 std::unique_ptr<base::DictionaryValue> local_state); | 99 std::unique_ptr<base::DictionaryValue> local_state); |
100 | 100 |
101 // Called when an Add/Update/Remove comes from sync. Ownership of Value*s | 101 // Called when an Add/Update/Remove comes from sync. |
102 // are taken. | 102 syncer::SyncError OnSyncAdd(const std::string& key, |
103 syncer::SyncError OnSyncAdd( | 103 std::unique_ptr<base::Value> new_value, |
104 const std::string& key, | 104 ValueStoreChangeList* changes); |
105 base::Value* new_value, | 105 syncer::SyncError OnSyncUpdate(const std::string& key, |
106 ValueStoreChangeList* changes); | 106 std::unique_ptr<base::Value> old_value, |
107 syncer::SyncError OnSyncUpdate( | 107 std::unique_ptr<base::Value> new_value, |
108 const std::string& key, | 108 ValueStoreChangeList* changes); |
109 base::Value* old_value, | 109 syncer::SyncError OnSyncDelete(const std::string& key, |
110 base::Value* new_value, | 110 std::unique_ptr<base::Value> old_value, |
111 ValueStoreChangeList* changes); | 111 ValueStoreChangeList* changes); |
112 syncer::SyncError OnSyncDelete( | |
113 const std::string& key, | |
114 base::Value* old_value, | |
115 ValueStoreChangeList* changes); | |
116 | 112 |
117 // List of observers to settings changes. | 113 // List of observers to settings changes. |
118 const scoped_refptr<SettingsObserverList> observers_; | 114 const scoped_refptr<SettingsObserverList> observers_; |
119 | 115 |
120 // Id of the extension these settings are for. | 116 // Id of the extension these settings are for. |
121 std::string const extension_id_; | 117 std::string const extension_id_; |
122 | 118 |
123 // Storage area to sync. | 119 // Storage area to sync. |
124 const std::unique_ptr<ValueStore> delegate_; | 120 const std::unique_ptr<ValueStore> delegate_; |
125 | 121 |
126 // Object which sends changes to sync. | 122 // Object which sends changes to sync. |
127 std::unique_ptr<SettingsSyncProcessor> sync_processor_; | 123 std::unique_ptr<SettingsSyncProcessor> sync_processor_; |
128 | 124 |
129 const syncer::ModelType sync_type_; | 125 const syncer::ModelType sync_type_; |
130 const syncer::SyncableService::StartSyncFlare flare_; | 126 const syncer::SyncableService::StartSyncFlare flare_; |
131 | 127 |
132 DISALLOW_COPY_AND_ASSIGN(SyncableSettingsStorage); | 128 DISALLOW_COPY_AND_ASSIGN(SyncableSettingsStorage); |
133 }; | 129 }; |
134 | 130 |
135 } // namespace extensions | 131 } // namespace extensions |
136 | 132 |
137 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNCABLE_SETTINGS_STORAGE_H_ | 133 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNCABLE_SETTINGS_STORAGE_H_ |
OLD | NEW |