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

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

Issue 15404005: sync: deferred initialization support for app/extension settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/storage/settings_backend.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SETTINGS_BACKEND_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_BACKEND_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_BACKEND_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_BACKEND_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 22 matching lines...) Expand all
33 // Lives entirely on the FILE thread. 33 // Lives entirely on the FILE thread.
34 class SettingsBackend : public syncer::SyncableService { 34 class SettingsBackend : public syncer::SyncableService {
35 public: 35 public:
36 // |storage_factory| is use to create leveldb storage areas. 36 // |storage_factory| is use to create leveldb storage areas.
37 // |base_path| is the base of the extension settings directory, so the 37 // |base_path| is the base of the extension settings directory, so the
38 // databases will be at base_path/extension_id. 38 // databases will be at base_path/extension_id.
39 // |observers| is the list of observers to settings changes. 39 // |observers| is the list of observers to settings changes.
40 SettingsBackend( 40 SettingsBackend(
41 const scoped_refptr<SettingsStorageFactory>& storage_factory, 41 const scoped_refptr<SettingsStorageFactory>& storage_factory,
42 const base::FilePath& base_path, 42 const base::FilePath& base_path,
43 syncer::ModelType sync_type,
44 const syncer::SyncableService::StartSyncFlare& flare,
43 const SettingsStorageQuotaEnforcer::Limits& quota, 45 const SettingsStorageQuotaEnforcer::Limits& quota,
44 const scoped_refptr<SettingsObserverList>& observers); 46 const scoped_refptr<SettingsObserverList>& observers);
45 47
46 virtual ~SettingsBackend(); 48 virtual ~SettingsBackend();
47 49
48 // Gets a weak reference to the storage area for |extension_id|. 50 // Gets a weak reference to the storage area for |extension_id|.
49 // Must be run on the FILE thread. 51 // Must be run on the FILE thread.
50 ValueStore* GetStorage(const std::string& extension_id) const; 52 ValueStore* GetStorage(const std::string& extension_id) const;
51 53
52 // Deletes all setting data for an extension. Call on the FILE thread. 54 // Deletes all setting data for an extension. Call on the FILE thread.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 93
92 // The list of observers to settings changes. 94 // The list of observers to settings changes.
93 const scoped_refptr<SettingsObserverList> observers_; 95 const scoped_refptr<SettingsObserverList> observers_;
94 96
95 // A cache of ValueStore objects that have already been created. 97 // A cache of ValueStore objects that have already been created.
96 // Ensure that there is only ever one created per extension. 98 // Ensure that there is only ever one created per extension.
97 typedef std::map<std::string, linked_ptr<SyncableSettingsStorage> > 99 typedef std::map<std::string, linked_ptr<SyncableSettingsStorage> >
98 StorageObjMap; 100 StorageObjMap;
99 mutable StorageObjMap storage_objs_; 101 mutable StorageObjMap storage_objs_;
100 102
101 // Current sync model type. Will be UNSPECIFIED if sync hasn't been enabled 103 // Current sync model type. Either EXTENSION_SETTINGS or APP_SETTINGS.
102 // yet, and either SETTINGS or APP_SETTINGS if it has been.
103 syncer::ModelType sync_type_; 104 syncer::ModelType sync_type_;
104 105
105 // Current sync processor, if any. 106 // Current sync processor, if any.
106 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; 107 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_;
107 108
108 // Current sync error handler if any. 109 // Current sync error handler if any.
109 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_; 110 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_;
110 111
112 syncer::SyncableService::StartSyncFlare flare_;
113
111 DISALLOW_COPY_AND_ASSIGN(SettingsBackend); 114 DISALLOW_COPY_AND_ASSIGN(SettingsBackend);
112 }; 115 };
113 116
114 } // namespace extensions 117 } // namespace extensions
115 118
116 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_BACKEND_H_ 119 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTINGS_BACKEND_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/storage/settings_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698