Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / chrome / browser / media / desktop_capture_access_handler.h
blobc0ab0ec3ac6dbcea3852a9a4d95fca7596964865
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_
8 #include <list>
10 #include "chrome/browser/media/media_access_handler.h"
12 class DesktopStreamsRegistry;
14 // MediaAccessHandler for DesktopCapture API.
15 class DesktopCaptureAccessHandler : public MediaAccessHandler {
16 public:
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,
33 int render_frame_id,
34 int page_request_id,
35 content::MediaStreamType stream_type,
36 content::MediaRequestState state) override;
38 bool IsCaptureInProgress();
40 private:
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;
46 int render_frame_id;
47 int page_request_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_