OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_CAPTURE_ACCESS_HANDLER_BASE_H_ |
| 6 #define CHROME_BROWSER_MEDIA_CAPTURE_ACCESS_HANDLER_BASE_H_ |
| 7 |
| 8 #include <list> |
| 9 |
| 10 #include "chrome/browser/media/media_access_handler.h" |
| 11 #include "content/public/browser/media_request_state.h" |
| 12 #include "content/public/common/media_stream_request.h" |
| 13 |
| 14 // Base class for DesktopCaptureAccessHandler and TabCaptureAccessHandler. This |
| 15 // class tracks active capturing sessions, and provides API to check if there is |
| 16 // ongoing insecure video capturing. |
| 17 class CaptureAccessHandlerBase : public MediaAccessHandler { |
| 18 public: |
| 19 CaptureAccessHandlerBase(); |
| 20 ~CaptureAccessHandlerBase() override; |
| 21 |
| 22 // MediaAccessHandler implementation. |
| 23 void UpdateMediaRequestState(int render_process_id, |
| 24 int render_frame_id, |
| 25 int page_request_id, |
| 26 content::MediaStreamType stream_type, |
| 27 content::MediaRequestState state) override; |
| 28 |
| 29 // Return true if there is any ongoing insecured capturing. The capturing is |
| 30 // deemed secure if all connected video sinks are reported secure and the |
| 31 // connections to the sinks are being managed by a trusted extension. |
| 32 bool IsInsecureCapturingInProgress(int render_process_id, |
| 33 int render_frame_id); |
| 34 |
| 35 void UpdateCapturingLinkSecured(int render_process_id, |
| 36 int render_frame_id, |
| 37 int page_request_id, |
| 38 bool is_secure); |
| 39 |
| 40 protected: |
| 41 static bool IsExtensionWhitelistedForScreenCapture( |
| 42 const extensions::Extension* extension); |
| 43 |
| 44 static bool IsBuiltInExtension(const GURL& origin); |
| 45 |
| 46 void UpdateExtensionTrusted(const content::MediaStreamRequest& request, |
| 47 const extensions::Extension* extension); |
| 48 |
| 49 private: |
| 50 struct Session; |
| 51 |
| 52 void AddCaptureSession(int render_process_id, |
| 53 int render_frame_id, |
| 54 int page_request_id, |
| 55 bool is_extension_trusted); |
| 56 |
| 57 void RemoveCaptureSession(int render_process_id, |
| 58 int render_frame_id, |
| 59 int page_request_id); |
| 60 |
| 61 std::list<Session>::iterator FindSession(int render_process_id, |
| 62 int render_frame_id, |
| 63 int page_request_id); |
| 64 |
| 65 std::list<Session> sessions_; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(CaptureAccessHandlerBase); |
| 68 }; |
| 69 |
| 70 #endif // CHROME_BROWSER_MEDIA_CAPTURE_ACCESS_HANDLER_BASE_H_ |
OLD | NEW |