OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_DESKTOP_CAPTURE_ACCESS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_DESKTOP_CAPTURE_ACCESS_HANDLER_H_ |
| 7 |
| 8 #include <list> |
| 9 |
| 10 #include "chrome/browser/media/media_access_handler.h" |
| 11 |
| 12 class DesktopStreamsRegistry; |
| 13 |
| 14 // MediaAccessHandler for DesktopCapture API. |
| 15 class DesktopCaptureAccessHandler : public MediaAccessHandler { |
| 16 public: |
| 17 DesktopCaptureAccessHandler(); |
| 18 ~DesktopCaptureAccessHandler() override; |
| 19 |
| 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; |
| 37 |
| 38 bool IsCaptureInProgress(); |
| 39 |
| 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; |
| 48 }; |
| 49 typedef std::list<DesktopCaptureSession> DesktopCaptureSessions; |
| 50 |
| 51 void ProcessScreenCaptureAccessRequest( |
| 52 content::WebContents* web_contents, |
| 53 const content::MediaStreamRequest& request, |
| 54 const content::MediaResponseCallback& callback, |
| 55 const extensions::Extension* extension); |
| 56 |
| 57 DesktopCaptureSessions desktop_capture_sessions_; |
| 58 }; |
| 59 |
| 60 #endif // CHROME_BROWSER_MEDIA_DESKTOP_CAPTURE_ACCESS_HANDLER_H_ |
OLD | NEW |