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_EXTENSION_HOST_DELEGATE_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_HOST_DELEGATE_H_
10 #include "content/public/common/media_stream_request.h"
11 #include "ui/base/window_open_disposition.h"
14 class JavaScriptDialogManager
;
22 namespace extensions
{
26 // A delegate to support functionality that cannot exist in the extensions
27 // module. This is not an inner class of ExtensionHost to allow it to be forward
29 class ExtensionHostDelegate
{
31 virtual ~ExtensionHostDelegate() {}
33 // Called after the hosting |web_contents| for an extension is created. The
34 // implementation may wish to add preference observers to |web_contents|.
35 virtual void OnExtensionHostCreated(content::WebContents
* web_contents
) = 0;
37 // Called after |host| creates a RenderView for an extension.
38 virtual void OnRenderViewCreatedForBackgroundPage(ExtensionHost
* host
) = 0;
40 // Returns the embedder's JavaScriptDialogManager or NULL if the embedder
41 // does not support JavaScript dialogs.
42 virtual content::JavaScriptDialogManager
* GetJavaScriptDialogManager() = 0;
44 // Creates a new tab or popup window with |web_contents|. The embedder may
45 // choose to do nothing if tabs and popups are not supported.
46 virtual void CreateTab(content::WebContents
* web_contents
,
47 const std::string
& extension_id
,
48 WindowOpenDisposition disposition
,
49 const gfx::Rect
& initial_rect
,
50 bool user_gesture
) = 0;
52 // Requests access to an audio or video media stream. Invokes |callback|
54 virtual void ProcessMediaAccessRequest(
55 content::WebContents
* web_contents
,
56 const content::MediaStreamRequest
& request
,
57 const content::MediaResponseCallback
& callback
,
58 const Extension
* extension
) = 0;
60 // Checks if we have permission to access the microphone or camera. Note that
61 // this does not query the user. |type| must be MEDIA_DEVICE_AUDIO_CAPTURE
62 // or MEDIA_DEVICE_VIDEO_CAPTURE.
63 virtual bool CheckMediaAccessPermission(content::WebContents
* web_contents
,
64 const GURL
& security_origin
,
65 content::MediaStreamType type
,
66 const Extension
* extension
) = 0;
69 } // namespace extensions
71 #endif // EXTENSIONS_BROWSER_EXTENSION_HOST_DELEGATE_H_