| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_DESKTOP_CAPTURE_ACCESS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_DESKTOP_CAPTURE_ACCESS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_DESKTOP_CAPTURE_ACCESS_HANDLER_H_ | 6 #define CHROME_BROWSER_MEDIA_DESKTOP_CAPTURE_ACCESS_HANDLER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "chrome/browser/media/capture_access_handler_base.h" |
| 10 #include "chrome/browser/media/media_access_handler.h" | 11 #include "chrome/browser/media/media_access_handler.h" |
| 11 | 12 |
| 12 class DesktopStreamsRegistry; | |
| 13 | |
| 14 // MediaAccessHandler for DesktopCapture API. | 13 // MediaAccessHandler for DesktopCapture API. |
| 15 class DesktopCaptureAccessHandler : public MediaAccessHandler { | 14 class DesktopCaptureAccessHandler : public CaptureAccessHandlerBase { |
| 16 public: | 15 public: |
| 17 DesktopCaptureAccessHandler(); | 16 DesktopCaptureAccessHandler(); |
| 18 ~DesktopCaptureAccessHandler() override; | 17 ~DesktopCaptureAccessHandler() override; |
| 19 | 18 |
| 20 // MediaAccessHandler implementation. | 19 // MediaAccessHandler implementation. |
| 21 bool SupportsStreamType(const content::MediaStreamType type, | 20 bool SupportsStreamType(const content::MediaStreamType type, |
| 22 const extensions::Extension* extension) override; | 21 const extensions::Extension* extension) override; |
| 23 bool CheckMediaAccessPermission( | 22 bool CheckMediaAccessPermission( |
| 24 content::WebContents* web_contents, | 23 content::WebContents* web_contents, |
| 25 const GURL& security_origin, | 24 const GURL& security_origin, |
| 26 content::MediaStreamType type, | 25 content::MediaStreamType type, |
| 27 const extensions::Extension* extension) override; | 26 const extensions::Extension* extension) override; |
| 28 void HandleRequest(content::WebContents* web_contents, | 27 void HandleRequest(content::WebContents* web_contents, |
| 29 const content::MediaStreamRequest& request, | 28 const content::MediaStreamRequest& request, |
| 30 const content::MediaResponseCallback& callback, | 29 const content::MediaResponseCallback& callback, |
| 31 const extensions::Extension* extension) override; | 30 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 | 31 |
| 40 private: | 32 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( | 33 void ProcessScreenCaptureAccessRequest( |
| 52 content::WebContents* web_contents, | 34 content::WebContents* web_contents, |
| 53 const content::MediaStreamRequest& request, | 35 const content::MediaStreamRequest& request, |
| 54 const content::MediaResponseCallback& callback, | 36 const content::MediaResponseCallback& callback, |
| 55 const extensions::Extension* extension); | 37 const extensions::Extension* extension); |
| 56 | 38 |
| 57 DesktopCaptureSessions desktop_capture_sessions_; | |
| 58 }; | 39 }; |
| 59 | 40 |
| 60 #endif // CHROME_BROWSER_MEDIA_DESKTOP_CAPTURE_ACCESS_HANDLER_H_ | 41 #endif // CHROME_BROWSER_MEDIA_DESKTOP_CAPTURE_ACCESS_HANDLER_H_ |
| OLD | NEW |