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

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

Issue 8539037: Extension Settings API: make it so that when changes received from Sync fail to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable all sync, not just outgoing Created 9 years, 1 month 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) 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_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"
(...skipping 20 matching lines...) Expand all
31 explicit SettingsBackend( 31 explicit SettingsBackend(
32 // Ownership NOT taken. 32 // Ownership NOT taken.
33 SettingsStorageFactory* storage_factory, 33 SettingsStorageFactory* storage_factory,
34 const FilePath& base_path, 34 const FilePath& base_path,
35 const scoped_refptr<SettingsObserverList>& observers); 35 const scoped_refptr<SettingsObserverList>& observers);
36 36
37 virtual ~SettingsBackend(); 37 virtual ~SettingsBackend();
38 38
39 // Gets a weak reference to the storage area for a given extension. 39 // Gets a weak reference to the storage area for a given extension.
40 // Must be run on the FILE thread. 40 // Must be run on the FILE thread.
41 // 41 SettingsStorage* GetStorage(const std::string& extension_id) const;
42 // By default this will be an SettingsLeveldbStorage, but on
43 // failure to create a leveldb instance will fall back to
44 // InMemorySettingsStorage.
45 SettingsStorage* GetStorage(
46 const std::string& extension_id) const;
47 42
48 // Deletes all setting data for an extension. Call on the FILE thread. 43 // Deletes all setting data for an extension. Call on the FILE thread.
49 void DeleteStorage(const std::string& extension_id); 44 void DeleteStorage(const std::string& extension_id);
50 45
51 // SyncableService implementation. 46 // SyncableService implementation.
52 virtual SyncDataList GetAllSyncData(syncable::ModelType type) const OVERRIDE; 47 virtual SyncDataList GetAllSyncData(syncable::ModelType type) const OVERRIDE;
53 virtual SyncError MergeDataAndStartSyncing( 48 virtual SyncError MergeDataAndStartSyncing(
54 syncable::ModelType type, 49 syncable::ModelType type,
55 const SyncDataList& initial_sync_data, 50 const SyncDataList& initial_sync_data,
56 SyncChangeProcessor* sync_processor) OVERRIDE; 51 SyncChangeProcessor* sync_processor) OVERRIDE;
57 virtual SyncError ProcessSyncChanges( 52 virtual SyncError ProcessSyncChanges(
58 const tracked_objects::Location& from_here, 53 const tracked_objects::Location& from_here,
59 const SyncChangeList& change_list) OVERRIDE; 54 const SyncChangeList& change_list) OVERRIDE;
60 virtual void StopSyncing(syncable::ModelType type) OVERRIDE; 55 virtual void StopSyncing(syncable::ModelType type) OVERRIDE;
61 56
62 private: 57 private:
63 // Gets a weak reference to the storage area for a given extension, 58 // Gets a weak reference to the storage area for a given extension,
64 // initializing sync with some initial data if sync enabled. 59 // initializing sync with some initial data if sync enabled.
65 // 60 //
66 // By default this will be of a cached LEVELDB storage, but on failure to 61 // By default this will be of a cached LEVELDB storage, but on failure to
67 // create a leveldb instance will fall back to cached NOOP storage. 62 // create a leveldb instance will fall back to cached NOOP storage.
68 SyncableSettingsStorage* GetOrCreateStorageWithSyncData( 63 SyncableSettingsStorage* GetOrCreateStorageWithSyncData(
69 const std::string& extension_id, const DictionaryValue& sync_data) const; 64 const std::string& extension_id, const DictionaryValue& sync_data) const;
70 65
71 // Gets all extension IDs known to extension settings. This may not be all 66 // Gets all extension IDs known to extension settings. This may not be all
72 // installed extensions. 67 // installed extensions.
73 std::set<std::string> GetKnownExtensionIDs() const; 68 std::set<std::string> GetKnownExtensionIDs() const;
74 69
70 // Disable the syncing of the storage error for |extension_id|.
71 // Incoming sync changes will still be sent to the extension, just no sync
Matt Perry 2011/11/16 19:03:11 comment no longer accurate?
not at google - send to devlin 2011/11/16 21:11:51 Done.
72 // changes will generated by the extension.
73 void DisableSyncForExtension(const std::string& extension_id) const;
74
75 // The Factory to use for creating leveldb storage areas. Not owned. 75 // The Factory to use for creating leveldb storage areas. Not owned.
76 SettingsStorageFactory* const storage_factory_; 76 SettingsStorageFactory* const storage_factory_;
77 77
78 // The base file path to create any leveldb databases at. 78 // The base file path to create any leveldb databases at.
79 const FilePath base_path_; 79 const FilePath base_path_;
80 80
81 // The list of observers to settings changes. 81 // The list of observers to settings changes.
82 const scoped_refptr<SettingsObserverList> observers_; 82 const scoped_refptr<SettingsObserverList> observers_;
83 83
84 // A cache of SettingsStorage objects that have already been created. 84 // A cache of SettingsStorage objects that have already been created.
85 // Ensure that there is only ever one created per extension. 85 // Ensure that there is only ever one created per extension.
86 typedef std::map<std::string, linked_ptr<SyncableSettingsStorage> > 86 typedef std::map<std::string, linked_ptr<SyncableSettingsStorage> >
87 StorageObjMap; 87 StorageObjMap;
88 mutable StorageObjMap storage_objs_; 88 mutable StorageObjMap storage_objs_;
89 89
90 // Current sync model type. Will be UNSPECIFIED if sync hasn't been enabled 90 // Current sync model type. Will be UNSPECIFIED if sync hasn't been enabled
91 // yet, and either SETTINGS or APP_SETTINGS if it has been. 91 // yet, and either SETTINGS or APP_SETTINGS if it has been.
92 syncable::ModelType sync_type_; 92 syncable::ModelType sync_type_;
93 93
94 // Current sync processor, if any. 94 // Current sync processor, if any.
95 SyncChangeProcessor* sync_processor_; 95 SyncChangeProcessor* sync_processor_;
96 96
97 DISALLOW_COPY_AND_ASSIGN(SettingsBackend); 97 DISALLOW_COPY_AND_ASSIGN(SettingsBackend);
98 }; 98 };
99 99
100 } // namespace extensions 100 } // namespace extensions
101 101
102 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_BACKEND_H_ 102 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698