Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / extensions / api / storage / sync_value_store_cache.h
blob5f1a1f5d4c9cbbd7968acd378e72edd59a538507
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_VALUE_STORE_CACHE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_VALUE_STORE_CACHE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "extensions/browser/api/storage/settings_observer.h"
13 #include "extensions/browser/api/storage/value_store_cache.h"
14 #include "sync/api/syncable_service.h"
16 namespace base {
17 class FilePath;
20 namespace syncer {
21 class SyncableService;
24 namespace extensions {
26 class SettingsStorageFactory;
27 class SyncStorageBackend;
29 // ValueStoreCache for the SYNC namespace. It owns a backend for apps and
30 // another for extensions. Each backend takes care of persistence and syncing.
31 class SyncValueStoreCache : public ValueStoreCache {
32 public:
33 SyncValueStoreCache(
34 const scoped_refptr<SettingsStorageFactory>& factory,
35 const scoped_refptr<SettingsObserverList>& observers,
36 const base::FilePath& profile_path);
37 ~SyncValueStoreCache() override;
39 syncer::SyncableService* GetSyncableService(syncer::ModelType type) const;
41 // ValueStoreCache implementation:
42 void RunWithValueStoreForExtension(
43 const StorageCallback& callback,
44 scoped_refptr<const Extension> extension) override;
45 void DeleteStorageSoon(const std::string& extension_id) override;
47 private:
48 void InitOnFileThread(const scoped_refptr<SettingsStorageFactory>& factory,
49 const scoped_refptr<SettingsObserverList>& observers,
50 const base::FilePath& profile_path);
52 bool initialized_;
53 scoped_ptr<SyncStorageBackend> app_backend_;
54 scoped_ptr<SyncStorageBackend> extension_backend_;
56 DISALLOW_COPY_AND_ASSIGN(SyncValueStoreCache);
59 } // namespace extensions
61 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SYNC_VALUE_STORE_CACHE_H_