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_DESKTOP_CAPTURE_ACCESS_HANDLER_H_
6 #define CHROME_BROWSER_MEDIA_DESKTOP_CAPTURE_ACCESS_HANDLER_H_
10 #include "chrome/browser/media/media_access_handler.h"
12 class DesktopStreamsRegistry
;
14 // MediaAccessHandler for DesktopCapture API.
15 class DesktopCaptureAccessHandler
: public MediaAccessHandler
{
17 DesktopCaptureAccessHandler();
18 ~DesktopCaptureAccessHandler() override
;
20 // MediaAccessHandler implementation.
21 bool SupportsStreamType(const content::MediaStreamType type
,
22 const extensions::Extension
* extension
) override
;
23 bool CheckMediaAccessPermission(
24 content::WebContents
* web_contents
,
25 const GURL
& security_origin
,
26 content::MediaStreamType type
,
27 const extensions::Extension
* extension
) override
;
28 void HandleRequest(content::WebContents
* web_contents
,
29 const content::MediaStreamRequest
& request
,
30 const content::MediaResponseCallback
& callback
,
31 const extensions::Extension
* extension
) override
;
32 void UpdateMediaRequestState(int render_process_id
,
35 content::MediaStreamType stream_type
,
36 content::MediaRequestState state
) override
;
38 bool IsCaptureInProgress();
41 // Tracks MEDIA_DESKTOP_VIDEO_CAPTURE sessions which reach the
42 // MEDIA_REQUEST_STATE_DONE state. Sessions are remove when
43 // MEDIA_REQUEST_STATE_CLOSING is encountered.
44 struct DesktopCaptureSession
{
45 int render_process_id
;
49 typedef std::list
<DesktopCaptureSession
> DesktopCaptureSessions
;
51 void ProcessScreenCaptureAccessRequest(
52 content::WebContents
* web_contents
,
53 const content::MediaStreamRequest
& request
,
54 const content::MediaResponseCallback
& callback
,
55 const extensions::Extension
* extension
);
57 DesktopCaptureSessions desktop_capture_sessions_
;
60 #endif // CHROME_BROWSER_MEDIA_DESKTOP_CAPTURE_ACCESS_HANDLER_H_