Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(999)

Side by Side Diff: chrome/browser/extensions/api/storage/syncable_settings_storage.h

Issue 138073006: sync: fix the way extension/app settings trigger deferred sync init (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/observer_list_threadsafe.h" 11 #include "base/observer_list_threadsafe.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/extensions/api/storage/setting_sync_data.h" 13 #include "chrome/browser/extensions/api/storage/setting_sync_data.h"
14 #include "chrome/browser/extensions/api/storage/settings_observer.h" 14 #include "chrome/browser/extensions/api/storage/settings_observer.h"
15 #include "chrome/browser/value_store/value_store.h" 15 #include "chrome/browser/value_store/value_store.h"
16 #include "sync/api/sync_change.h" 16 #include "sync/api/sync_change.h"
17 #include "sync/api/syncable_service.h" 17 #include "sync/api/syncable_service.h"
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 class SettingsSyncProcessor; 21 class SettingsSyncProcessor;
22 22
23 // Decorates a ValueStore with sync behaviour. 23 // Decorates a ValueStore with sync behaviour.
24 class SyncableSettingsStorage : public ValueStore { 24 class SyncableSettingsStorage : public ValueStore {
25 public: 25 public:
26 SyncableSettingsStorage( 26 SyncableSettingsStorage(
27 const scoped_refptr<SettingsObserverList>& observers, 27 const scoped_refptr<SettingsObserverList>& observers,
28 const std::string& extension_id, 28 const std::string& extension_id,
29 // Ownership taken. 29 // Ownership taken.
30 ValueStore* delegate); 30 ValueStore* delegate,
31 syncer::ModelType sync_type,
32 const syncer::SyncableService::StartSyncFlare& flare);
31 33
32 virtual ~SyncableSettingsStorage(); 34 virtual ~SyncableSettingsStorage();
33 35
34 // ValueStore implementation. 36 // ValueStore implementation.
35 virtual size_t GetBytesInUse(const std::string& key) OVERRIDE; 37 virtual size_t GetBytesInUse(const std::string& key) OVERRIDE;
36 virtual size_t GetBytesInUse(const std::vector<std::string>& keys) OVERRIDE; 38 virtual size_t GetBytesInUse(const std::vector<std::string>& keys) OVERRIDE;
37 virtual size_t GetBytesInUse() OVERRIDE; 39 virtual size_t GetBytesInUse() OVERRIDE;
38 virtual ReadResult Get(const std::string& key) OVERRIDE; 40 virtual ReadResult Get(const std::string& key) OVERRIDE;
39 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE; 41 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE;
40 virtual ReadResult Get() OVERRIDE; 42 virtual ReadResult Get() OVERRIDE;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 99
98 // Id of the extension these settings are for. 100 // Id of the extension these settings are for.
99 std::string const extension_id_; 101 std::string const extension_id_;
100 102
101 // Storage area to sync. 103 // Storage area to sync.
102 const scoped_ptr<ValueStore> delegate_; 104 const scoped_ptr<ValueStore> delegate_;
103 105
104 // Object which sends changes to sync. 106 // Object which sends changes to sync.
105 scoped_ptr<SettingsSyncProcessor> sync_processor_; 107 scoped_ptr<SettingsSyncProcessor> sync_processor_;
106 108
109 const syncer::ModelType sync_type_;
110 const syncer::SyncableService::StartSyncFlare flare_;
111
107 DISALLOW_COPY_AND_ASSIGN(SyncableSettingsStorage); 112 DISALLOW_COPY_AND_ASSIGN(SyncableSettingsStorage);
108 }; 113 };
109 114
110 } // namespace extensions 115 } // namespace extensions
111 116
112 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNCABLE_SETTINGS_STORAGE_H_ 117 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNCABLE_SETTINGS_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698