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 EXTENSIONS_BROWSER_API_EXTENSIONS_API_CLIENT_H_
6 #define EXTENSIONS_BROWSER_API_EXTENSIONS_API_CLIENT_H_
10 #include "base/memory/ref_counted.h"
11 #include "extensions/browser/api/storage/settings_namespace.h"
14 class ObserverListThreadSafe
;
20 namespace extensions
{
22 class SettingsObserver
;
23 class SettingsStorageFactory
;
24 class ValueStoreCache
;
26 // Allows the embedder of the extensions module to customize its support for
27 // API features. The embedder must create a single instance in the browser
28 // process. Provides a default implementation that does nothing.
29 class ExtensionsAPIClient
{
31 // Construction sets the single instance.
32 ExtensionsAPIClient();
34 // Destruction clears the single instance.
35 virtual ~ExtensionsAPIClient();
37 // Returns the single instance of |this|.
38 static ExtensionsAPIClient
* Get();
40 // Storage API support.
42 // Add any additional value store caches (e.g. for chrome.storage.managed)
43 // to |caches|. By default adds nothing.
44 virtual void AddAdditionalValueStoreCaches(
45 content::BrowserContext
* context
,
46 const scoped_refptr
<SettingsStorageFactory
>& factory
,
47 const scoped_refptr
<ObserverListThreadSafe
<SettingsObserver
> >& observers
,
48 std::map
<settings_namespace::Namespace
, ValueStoreCache
*>* caches
);
50 // NOTE: If this interface gains too many methods (perhaps more than 20) it
51 // should be split into one interface per API.
54 } // namespace extensions
56 #endif // EXTENSIONS_BROWSER_API_EXTENSIONS_API_CLIENT_H_