Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / extensions / browser / extension_host_delegate.h
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_EXTENSION_HOST_DELEGATE_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_HOST_DELEGATE_H_
7
8 #include <string>
9
10 #include "content/public/common/media_stream_request.h"
11 #include "ui/base/window_open_disposition.h"
12
13 namespace content {
14 class JavaScriptDialogManager;
15 class WebContents;
16 }
17
18 namespace gfx {
19 class Rect;
20 }
21
22 namespace extensions {
23 class Extension;
24 class ExtensionHost;
25
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
28 // declared.
29 class ExtensionHostDelegate {
30  public:
31   virtual ~ExtensionHostDelegate() {}
32
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;
36
37   // Called after |host| creates a RenderView for an extension.
38   virtual void OnRenderViewCreatedForBackgroundPage(ExtensionHost* host) = 0;
39
40   // Returns the embedder's JavaScriptDialogManager or NULL if the embedder
41   // does not support JavaScript dialogs.
42   virtual content::JavaScriptDialogManager* GetJavaScriptDialogManager() = 0;
43
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_pos,
50                          bool user_gesture) = 0;
51
52   // Requests access to an audio or video media stream. Invokes |callback|
53   // with the response.
54   virtual void ProcessMediaAccessRequest(
55       content::WebContents* web_contents,
56       const content::MediaStreamRequest& request,
57       const content::MediaResponseCallback& callback,
58       const Extension* extension) = 0;
59
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;
67 };
68
69 }  // namespace extensions
70
71 #endif  // EXTENSIONS_BROWSER_EXTENSION_HOST_DELEGATE_H_