OLD | NEW |
(Empty) | |
| 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 #ifndef EXTENSIONS_BROWSER_API_EXTENSIONS_API_CLIENT_H_ |
| 6 #define EXTENSIONS_BROWSER_API_EXTENSIONS_API_CLIENT_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "extensions/browser/api/storage/settings_namespace.h" |
| 12 |
| 13 template <class T> |
| 14 class ObserverListThreadSafe; |
| 15 |
| 16 namespace content { |
| 17 class BrowserContext; |
| 18 } |
| 19 |
| 20 namespace extensions { |
| 21 |
| 22 class SettingsObserver; |
| 23 class SettingsStorageFactory; |
| 24 class ValueStoreCache; |
| 25 |
| 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 { |
| 30 public: |
| 31 // Construction sets the single instance. |
| 32 ExtensionsAPIClient(); |
| 33 |
| 34 // Destruction clears the single instance. |
| 35 virtual ~ExtensionsAPIClient(); |
| 36 |
| 37 // Returns the single instance of |this|. |
| 38 static ExtensionsAPIClient* Get(); |
| 39 |
| 40 // Storage API support. |
| 41 |
| 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); |
| 49 |
| 50 // NOTE: If this interface gains too many methods (perhaps more than 20) it |
| 51 // should be split into one interface per API. |
| 52 }; |
| 53 |
| 54 } // namespace extensions |
| 55 |
| 56 #endif // EXTENSIONS_BROWSER_API_EXTENSIONS_API_CLIENT_H_ |
OLD | NEW |