Roll src/third_party/WebKit a3b4a2e:7441784 (svn 202551:202552)
[chromium-blink-merge.git] / extensions / browser / extension_host_delegate.h
blob86726ff0dc84e4f76b7f072a1bf4d8548d5aa18e
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_
8 #include <string>
10 #include "content/public/common/media_stream_request.h"
11 #include "ui/base/window_open_disposition.h"
13 namespace content {
14 class JavaScriptDialogManager;
15 class WebContents;
18 namespace gfx {
19 class Rect;
22 namespace extensions {
23 class Extension;
24 class ExtensionHost;
25 class ExtensionHostQueue;
27 // A delegate to support functionality that cannot exist in the extensions
28 // module. This is not an inner class of ExtensionHost to allow it to be forward
29 // declared.
30 class ExtensionHostDelegate {
31 public:
32 virtual ~ExtensionHostDelegate() {}
34 // Called after the hosting |web_contents| for an extension is created. The
35 // implementation may wish to add preference observers to |web_contents|.
36 virtual void OnExtensionHostCreated(content::WebContents* web_contents) = 0;
38 // Called after |host| creates a RenderView for an extension.
39 virtual void OnRenderViewCreatedForBackgroundPage(ExtensionHost* host) = 0;
41 // Returns the embedder's JavaScriptDialogManager or NULL if the embedder
42 // does not support JavaScript dialogs.
43 virtual content::JavaScriptDialogManager* GetJavaScriptDialogManager() = 0;
45 // Creates a new tab or popup window with |web_contents|. The embedder may
46 // choose to do nothing if tabs and popups are not supported.
47 virtual void CreateTab(content::WebContents* web_contents,
48 const std::string& extension_id,
49 WindowOpenDisposition disposition,
50 const gfx::Rect& initial_rect,
51 bool user_gesture) = 0;
53 // Requests access to an audio or video media stream. Invokes |callback|
54 // with the response.
55 virtual void ProcessMediaAccessRequest(
56 content::WebContents* web_contents,
57 const content::MediaStreamRequest& request,
58 const content::MediaResponseCallback& callback,
59 const Extension* extension) = 0;
61 // Checks if we have permission to access the microphone or camera. Note that
62 // this does not query the user. |type| must be MEDIA_DEVICE_AUDIO_CAPTURE
63 // or MEDIA_DEVICE_VIDEO_CAPTURE.
64 virtual bool CheckMediaAccessPermission(content::WebContents* web_contents,
65 const GURL& security_origin,
66 content::MediaStreamType type,
67 const Extension* extension) = 0;
69 // Returns the ExtensionHostQueue implementation to use for creating
70 // ExtensionHost renderers.
71 virtual ExtensionHostQueue* GetExtensionHostQueue() const = 0;
74 } // namespace extensions
76 #endif // EXTENSIONS_BROWSER_EXTENSION_HOST_DELEGATE_H_