Add ENABLE_MEDIA_ROUTER define to builds other than Android and iOS.
[chromium-blink-merge.git] / chrome / browser / extensions / api / chrome_extensions_api_client.cc
blob25299a27572182be021de78305e20345ca7a3302
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 #include "chrome/browser/extensions/api/chrome_extensions_api_client.h"
7 #include "base/files/file_path.h"
8 #include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h"
9 #include "chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h"
10 #include "chrome/browser/extensions/api/management/chrome_management_api_delegate.h"
11 #include "chrome/browser/extensions/api/storage/sync_value_store_cache.h"
12 #include "chrome/browser/extensions/api/web_request/chrome_extension_web_request_event_router_delegate.h"
13 #include "chrome/browser/guest_view/app_view/chrome_app_view_guest_delegate.h"
14 #include "chrome/browser/guest_view/extension_options/chrome_extension_options_guest_delegate.h"
15 #include "chrome/browser/guest_view/extension_view/chrome_extension_view_guest_delegate.h"
16 #include "chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_guest_delegate.h"
17 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h"
18 #include "chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.h"
19 #include "content/public/browser/browser_context.h"
20 #include "content/public/browser/browser_thread.h"
21 #include "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_delegate.h"
22 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
23 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
25 #if defined(ENABLE_CONFIGURATION_POLICY)
26 #include "chrome/browser/extensions/api/storage/managed_value_store_cache.h"
27 #endif
29 #if defined(OS_CHROMEOS)
30 #include "chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_keyboard_delegate.h"
31 #endif
33 namespace extensions {
35 ChromeExtensionsAPIClient::ChromeExtensionsAPIClient() {}
37 ChromeExtensionsAPIClient::~ChromeExtensionsAPIClient() {}
39 void ChromeExtensionsAPIClient::AddAdditionalValueStoreCaches(
40 content::BrowserContext* context,
41 const scoped_refptr<SettingsStorageFactory>& factory,
42 const scoped_refptr<ObserverListThreadSafe<SettingsObserver> >& observers,
43 std::map<settings_namespace::Namespace, ValueStoreCache*>* caches) {
44 // Add support for chrome.storage.sync.
45 (*caches)[settings_namespace::SYNC] =
46 new SyncValueStoreCache(factory, observers, context->GetPath());
48 #if defined(ENABLE_CONFIGURATION_POLICY)
49 // Add support for chrome.storage.managed.
50 (*caches)[settings_namespace::MANAGED] =
51 new ManagedValueStoreCache(context, factory, observers);
52 #endif
55 AppViewGuestDelegate* ChromeExtensionsAPIClient::CreateAppViewGuestDelegate()
56 const {
57 return new ChromeAppViewGuestDelegate();
60 ExtensionOptionsGuestDelegate*
61 ChromeExtensionsAPIClient::CreateExtensionOptionsGuestDelegate(
62 ExtensionOptionsGuest* guest) const {
63 return new ChromeExtensionOptionsGuestDelegate(guest);
66 ExtensionViewGuestDelegate*
67 ChromeExtensionsAPIClient::CreateExtensionViewGuestDelegate(
68 ExtensionViewGuest* guest) const {
69 return new ChromeExtensionViewGuestDelegate(guest);
72 scoped_ptr<MimeHandlerViewGuestDelegate>
73 ChromeExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
74 MimeHandlerViewGuest* guest) const {
75 return make_scoped_ptr(new ChromeMimeHandlerViewGuestDelegate(guest));
78 WebViewGuestDelegate* ChromeExtensionsAPIClient::CreateWebViewGuestDelegate(
79 WebViewGuest* web_view_guest) const {
80 return new ChromeWebViewGuestDelegate(web_view_guest);
83 WebViewPermissionHelperDelegate* ChromeExtensionsAPIClient::
84 CreateWebViewPermissionHelperDelegate(
85 WebViewPermissionHelper* web_view_permission_helper) const {
86 return new ChromeWebViewPermissionHelperDelegate(web_view_permission_helper);
89 WebRequestEventRouterDelegate*
90 ChromeExtensionsAPIClient::CreateWebRequestEventRouterDelegate() const {
91 return new ChromeExtensionWebRequestEventRouterDelegate();
94 scoped_refptr<ContentRulesRegistry>
95 ChromeExtensionsAPIClient::CreateContentRulesRegistry(
96 content::BrowserContext* browser_context,
97 RulesCacheDelegate* cache_delegate) const {
98 return scoped_refptr<ContentRulesRegistry>(
99 new ChromeContentRulesRegistry(browser_context, cache_delegate));
102 scoped_ptr<DevicePermissionsPrompt>
103 ChromeExtensionsAPIClient::CreateDevicePermissionsPrompt(
104 content::WebContents* web_contents) const {
105 return make_scoped_ptr(new ChromeDevicePermissionsPrompt(web_contents));
108 scoped_ptr<VirtualKeyboardDelegate>
109 ChromeExtensionsAPIClient::CreateVirtualKeyboardDelegate() const {
110 #if defined(OS_CHROMEOS)
111 return make_scoped_ptr(new ChromeVirtualKeyboardDelegate());
112 #else
113 return nullptr;
114 #endif
117 ManagementAPIDelegate* ChromeExtensionsAPIClient::CreateManagementAPIDelegate()
118 const {
119 return new ChromeManagementAPIDelegate;
122 } // namespace extensions