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

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

Issue 175853002: Revert of Add a Restore() method to ValueStore and make StorageAPI use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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
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_SYNC_OR_LOCAL_VALUE_STORE_CACHE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_OR_LOCAL_VALUE_STORE_CACHE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_OR_LOCAL_VALUE_STORE_CACHE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_OR_LOCAL_VALUE_STORE_CACHE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/extensions/api/storage/settings_observer.h" 12 #include "chrome/browser/extensions/api/storage/settings_observer.h"
13 #include "chrome/browser/extensions/api/storage/settings_storage_quota_enforcer. h" 13 #include "chrome/browser/extensions/api/storage/settings_storage_quota_enforcer. h"
14 #include "chrome/browser/extensions/api/storage/value_store_cache.h" 14 #include "chrome/browser/extensions/api/storage/value_store_cache.h"
15 #include "sync/api/syncable_service.h"
16 15
17 namespace base { 16 namespace base {
18 class FilePath; 17 class FilePath;
19 } 18 }
20 19
21 namespace syncer {
22 class SyncableService;
23 }
24
25 namespace extensions { 20 namespace extensions {
26 21
27 class SettingsBackend; 22 class SettingsBackend;
28 class SettingsStorageFactory; 23 class SettingsStorageFactory;
29 24
30 // ValueStoreCache for the LOCAL and SYNC namespaces. It owns a backend for 25 // ValueStoreCache for the LOCAL and SYNC namespaces. It owns a backend for
31 // apps and another for extensions. Each backend takes care of persistence and 26 // apps and another for extensions. Each backend takes care of persistence and
32 // syncing. 27 // syncing.
33 class SyncOrLocalValueStoreCache : public ValueStoreCache { 28 class SyncOrLocalValueStoreCache : public ValueStoreCache {
34 public: 29 public:
35 SyncOrLocalValueStoreCache( 30 SyncOrLocalValueStoreCache(
36 settings_namespace::Namespace settings_namespace, 31 settings_namespace::Namespace settings_namespace,
37 const scoped_refptr<SettingsStorageFactory>& factory, 32 const scoped_refptr<SettingsStorageFactory>& factory,
38 const SettingsStorageQuotaEnforcer::Limits& quota, 33 const SettingsStorageQuotaEnforcer::Limits& quota,
39 const scoped_refptr<SettingsObserverList>& observers, 34 const scoped_refptr<SettingsObserverList>& observers,
40 const base::FilePath& profile_path); 35 const base::FilePath& profile_path);
41 virtual ~SyncOrLocalValueStoreCache(); 36 virtual ~SyncOrLocalValueStoreCache();
42 37
43 syncer::SyncableService* GetSyncableService(syncer::ModelType type) const; 38 SettingsBackend* GetAppBackend() const;
39 SettingsBackend* GetExtensionBackend() const;
44 40
45 // ValueStoreCache implementation: 41 // ValueStoreCache implementation:
46 42
47 virtual void RunWithValueStoreForExtension( 43 virtual void RunWithValueStoreForExtension(
48 const StorageCallback& callback, 44 const StorageCallback& callback,
49 scoped_refptr<const Extension> extension) OVERRIDE; 45 scoped_refptr<const Extension> extension) OVERRIDE;
50 46
51 virtual void DeleteStorageSoon(const std::string& extension_id) OVERRIDE; 47 virtual void DeleteStorageSoon(const std::string& extension_id) OVERRIDE;
52 48
53 private: 49 private:
54 void InitOnFileThread(const scoped_refptr<SettingsStorageFactory>& factory, 50 void InitOnFileThread(const scoped_refptr<SettingsStorageFactory>& factory,
55 const SettingsStorageQuotaEnforcer::Limits& quota, 51 const SettingsStorageQuotaEnforcer::Limits& quota,
56 const scoped_refptr<SettingsObserverList>& observers, 52 const scoped_refptr<SettingsObserverList>& observers,
57 const base::FilePath& profile_path); 53 const base::FilePath& profile_path);
58 54
59 settings_namespace::Namespace settings_namespace_; 55 settings_namespace::Namespace settings_namespace_;
60 bool initialized_;
61 scoped_ptr<SettingsBackend> app_backend_; 56 scoped_ptr<SettingsBackend> app_backend_;
62 scoped_ptr<SettingsBackend> extension_backend_; 57 scoped_ptr<SettingsBackend> extension_backend_;
63 58
64 DISALLOW_COPY_AND_ASSIGN(SyncOrLocalValueStoreCache); 59 DISALLOW_COPY_AND_ASSIGN(SyncOrLocalValueStoreCache);
65 }; 60 };
66 61
67 } // namespace extensions 62 } // namespace extensions
68 63
69 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_OR_LOCAL_VALUE_STORE_CACHE _H_ 64 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_OR_LOCAL_VALUE_STORE_CACHE _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698