Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / extensions / browser / api / extensions_api_client.h
blob4a60df57da21d79a77d40aab1570674b6177214c
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_
8 #include <map>
10 #include "base/memory/ref_counted.h"
11 #include "extensions/browser/api/storage/settings_namespace.h"
13 class GURL;
15 template <class T>
16 class ObserverListThreadSafe;
18 namespace content {
19 class BrowserContext;
22 namespace device {
23 class HidService;
26 namespace extensions {
28 class AppViewGuestDelegate;
29 class WebViewGuest;
30 class WebViewGuestDelegate;
31 class WebViewPermissionHelper;
32 class WebViewPermissionHelperDelegate;
33 class SettingsObserver;
34 class SettingsStorageFactory;
35 class ValueStoreCache;
37 // Allows the embedder of the extensions module to customize its support for
38 // API features. The embedder must create a single instance in the browser
39 // process. Provides a default implementation that does nothing.
40 class ExtensionsAPIClient {
41 public:
42 // Construction sets the single instance.
43 ExtensionsAPIClient();
45 // Destruction clears the single instance.
46 virtual ~ExtensionsAPIClient();
48 // Returns the single instance of |this|.
49 static ExtensionsAPIClient* Get();
51 // Storage API support.
53 // Add any additional value store caches (e.g. for chrome.storage.managed)
54 // to |caches|. By default adds nothing.
55 virtual void AddAdditionalValueStoreCaches(
56 content::BrowserContext* context,
57 const scoped_refptr<SettingsStorageFactory>& factory,
58 const scoped_refptr<ObserverListThreadSafe<SettingsObserver> >& observers,
59 std::map<settings_namespace::Namespace, ValueStoreCache*>* caches);
61 // Attaches a frame |url| inside the <appview> specified by
62 // |guest_instance_id|. Returns true if the operation completes succcessfully.
63 virtual bool AppViewInternalAttachFrame(
64 content::BrowserContext* browser_context,
65 const GURL& url,
66 int guest_instance_id,
67 const std::string& guest_extension_id);
69 // Denies the embedding requested by the <appview> specified by
70 // |guest_instance_id|. Returns true if the operation completes successfully.
71 virtual bool AppViewInternalDenyRequest(
72 content::BrowserContext* browser_context,
73 int guest_instance_id,
74 const std::string& guest_extension_id);
76 // Creates the AppViewGuestDelegate.
77 virtual AppViewGuestDelegate* CreateAppViewGuestDelegate() const;
79 // Returns the HidService instance for this embedder.
80 virtual device::HidService* GetHidService();
82 // Returns a delegate for some of WebViewGuest's behavior. The caller owns the
83 // returned WebViewGuestDelegate.
84 virtual WebViewGuestDelegate* CreateWebViewGuestDelegate (
85 WebViewGuest* web_view_guest) const;
87 // Returns a delegate for some of WebViewPermissionHelper's behavior. The
88 // caller owns the returned WebViewPermissionHelperDelegate.
89 virtual WebViewPermissionHelperDelegate*
90 CreateWebViewPermissionHelperDelegate (
91 WebViewPermissionHelper* web_view_permission_helper) const;
93 virtual void RegisterGuestViewTypes() {}
95 // NOTE: If this interface gains too many methods (perhaps more than 20) it
96 // should be split into one interface per API.
99 } // namespace extensions
101 #endif // EXTENSIONS_BROWSER_API_EXTENSIONS_API_CLIENT_H_