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

Side by Side Diff: chrome/browser/extensions/settings/settings_backend.h

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 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_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"
11 #include "base/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/observer_list_threadsafe.h" 13 #include "base/observer_list_threadsafe.h"
14 #include "chrome/browser/extensions/settings/settings_observer.h" 14 #include "chrome/browser/extensions/settings/settings_observer.h"
15 #include "chrome/browser/extensions/settings/settings_storage_factory.h" 15 #include "chrome/browser/extensions/settings/settings_storage_factory.h"
16 #include "chrome/browser/extensions/settings/settings_storage_quota_enforcer.h" 16 #include "chrome/browser/extensions/settings/settings_storage_quota_enforcer.h"
17 #include "chrome/browser/extensions/settings/syncable_settings_storage.h" 17 #include "chrome/browser/extensions/settings/syncable_settings_storage.h"
18 #include "chrome/browser/value_store/leveldb_value_store.h" 18 #include "chrome/browser/value_store/leveldb_value_store.h"
19 #include "sync/api/syncable_service.h" 19 #include "sync/api/syncable_service.h"
20 20
21 namespace csync { 21 namespace syncer {
22 class SyncErrorFactory; 22 class SyncErrorFactory;
23 } 23 }
24 24
25 namespace extensions { 25 namespace extensions {
26 26
27 // Manages ValueStore objects for extensions, including routing 27 // Manages ValueStore objects for extensions, including routing
28 // changes from sync to them. 28 // changes from sync to them.
29 // Lives entirely on the FILE thread. 29 // Lives entirely on the FILE thread.
30 class SettingsBackend : public csync::SyncableService { 30 class SettingsBackend : public syncer::SyncableService {
31 public: 31 public:
32 // |storage_factory| is use to create leveldb storage areas. 32 // |storage_factory| is use to create leveldb storage areas.
33 // |base_path| is the base of the extension settings directory, so the 33 // |base_path| is the base of the extension settings directory, so the
34 // databases will be at base_path/extension_id. 34 // databases will be at base_path/extension_id.
35 // |observers| is the list of observers to settings changes. 35 // |observers| is the list of observers to settings changes.
36 SettingsBackend( 36 SettingsBackend(
37 const scoped_refptr<SettingsStorageFactory>& storage_factory, 37 const scoped_refptr<SettingsStorageFactory>& storage_factory,
38 const FilePath& base_path, 38 const FilePath& base_path,
39 const SettingsStorageQuotaEnforcer::Limits& quota, 39 const SettingsStorageQuotaEnforcer::Limits& quota,
40 const scoped_refptr<SettingsObserverList>& observers); 40 const scoped_refptr<SettingsObserverList>& observers);
41 41
42 virtual ~SettingsBackend(); 42 virtual ~SettingsBackend();
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 // csync::SyncableService implementation. 51 // syncer::SyncableService implementation.
52 virtual csync::SyncDataList GetAllSyncData( 52 virtual syncer::SyncDataList GetAllSyncData(
53 syncable::ModelType type) const OVERRIDE; 53 syncable::ModelType type) const OVERRIDE;
54 virtual csync::SyncError MergeDataAndStartSyncing( 54 virtual syncer::SyncError MergeDataAndStartSyncing(
55 syncable::ModelType type, 55 syncable::ModelType type,
56 const csync::SyncDataList& initial_sync_data, 56 const syncer::SyncDataList& initial_sync_data,
57 scoped_ptr<csync::SyncChangeProcessor> sync_processor, 57 scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
58 scoped_ptr<csync::SyncErrorFactory> sync_error_factory) OVERRIDE; 58 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory) OVERRIDE;
59 virtual csync::SyncError ProcessSyncChanges( 59 virtual syncer::SyncError ProcessSyncChanges(
60 const tracked_objects::Location& from_here, 60 const tracked_objects::Location& from_here,
61 const csync::SyncChangeList& change_list) OVERRIDE; 61 const syncer::SyncChangeList& change_list) OVERRIDE;
62 virtual void StopSyncing(syncable::ModelType type) OVERRIDE; 62 virtual void StopSyncing(syncable::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
(...skipping 20 matching lines...) Expand all
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 syncable::ModelType sync_type_;
100 100
101 // Current sync processor, if any. 101 // Current sync processor, if any.
102 scoped_ptr<csync::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<csync::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_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/settings/settings_apitest.cc ('k') | chrome/browser/extensions/settings/settings_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698