Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / media / media_access_handler.h
blobbc7b8556380abbca69baa61a9b6ccb60b423bb22
1 // Copyright 2015 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 CHROME_BROWSER_MEDIA_MEDIA_ACCESS_HANDLER_H_
6 #define CHROME_BROWSER_MEDIA_MEDIA_ACCESS_HANDLER_H_
8 #include "base/callback.h"
9 #include "content/public/browser/media_request_state.h"
10 #include "content/public/common/media_stream_request.h"
12 namespace content {
13 class WebContents;
16 namespace extensions {
17 class Extension;
20 // Interface for handling media access requests that are propagated from
21 // MediaCaptureDevicesDispatcher.
22 class MediaAccessHandler {
23 public:
24 MediaAccessHandler() {}
25 virtual ~MediaAccessHandler() {}
27 // Check if the media stream type is supported by MediaAccessHandler.
28 virtual bool SupportsStreamType(const content::MediaStreamType type,
29 const extensions::Extension* extension) = 0;
30 // Check media access permission. |extension| is set to NULL if request was
31 // made from a drive-by page.
32 virtual bool CheckMediaAccessPermission(
33 content::WebContents* web_contents,
34 const GURL& security_origin,
35 content::MediaStreamType type,
36 const extensions::Extension* extension) = 0;
37 // Process media access requests. |extension| is set to NULL if request was
38 // made from a drive-by page.
39 virtual void HandleRequest(content::WebContents* web_contents,
40 const content::MediaStreamRequest& request,
41 const content::MediaResponseCallback& callback,
42 const extensions::Extension* extension) = 0;
43 // Update media request state. Called on UI thread.
44 virtual void UpdateMediaRequestState(int render_process_id,
45 int render_frame_id,
46 int page_request_id,
47 content::MediaStreamType stream_type,
48 content::MediaRequestState state) {}
51 #endif // CHROME_BROWSER_MEDIA_MEDIA_ACCESS_HANDLER_H_