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.
4
5 #include "chrome/browser/extensions/api/chrome_extensions_api_client.h"
6
7 #include "base/files/file_path.h"
8 #include "chrome/browser/extensions/api/storage/sync_value_store_cache.h"
9 #include "content/public/browser/browser_context.h"
10
11 #if defined(ENABLE_CONFIGURATION_POLICY)
12 #include "chrome/browser/extensions/api/storage/managed_value_store_cache.h"
13 #endif
14
15 namespace extensions {
16
ChromeExtensionsAPIClient()17 ChromeExtensionsAPIClient::ChromeExtensionsAPIClient() {}
18
~ChromeExtensionsAPIClient()19 ChromeExtensionsAPIClient::~ChromeExtensionsAPIClient() {}
20
AddAdditionalValueStoreCaches(content::BrowserContext * context,const scoped_refptr<SettingsStorageFactory> & factory,const scoped_refptr<ObserverListThreadSafe<SettingsObserver>> & observers,std::map<settings_namespace::Namespace,ValueStoreCache * > * caches)21 void ChromeExtensionsAPIClient::AddAdditionalValueStoreCaches(
22 content::BrowserContext* context,
23 const scoped_refptr<SettingsStorageFactory>& factory,
24 const scoped_refptr<ObserverListThreadSafe<SettingsObserver> >& observers,
25 std::map<settings_namespace::Namespace, ValueStoreCache*>* caches) {
26 // Add support for chrome.storage.sync.
27 (*caches)[settings_namespace::SYNC] =
28 new SyncValueStoreCache(factory, observers, context->GetPath());
29
30 #if defined(ENABLE_CONFIGURATION_POLICY)
31 // Add support for chrome.storage.managed.
32 (*caches)[settings_namespace::MANAGED] =
33 new ManagedValueStoreCache(context, factory, observers);
34 #endif
35 }
36
37 } // namespace extensions
38