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 #ifndef CHROME_BROWSER_MEDIA_CAPTURE_ACCESS_HANDLER_BASE_H_ | |
miu
2016/04/26 01:25:13
nit: need one blank line above this line
xjz
2016/04/29 00:11:42
Done.
| |
5 #define CHROME_BROWSER_MEDIA_CAPTURE_ACCESS_HANDLER_BASE_H_ | |
6 | |
7 #include <list> | |
8 | |
9 #include "base/callback.h" | |
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 // TODO(xjz): To be removed after | |
30 // MediaCaptureDevicesDispatcher::IsDesktopCaptureInProgress() is removed. | |
31 bool IsCaptureInProgress(); | |
32 | |
33 // Return true if there is any ongoing insecured capturing. The capturing is | |
34 // deemed secure if all connected video sinks are reported secure and the | |
35 // extension is trusted. | |
miu
2016/04/26 01:25:13
s/and the extensions is trusted/and the connection
xjz
2016/04/29 00:11:42
Done.
| |
36 bool IsInsecureCapturingInProgress(int render_process_id, | |
37 int render_frame_id); | |
38 | |
39 void UpdateCapturingLinkSecured(int render_process_id, | |
40 int render_frame_id, | |
41 int page_request_id, | |
42 bool is_secure); | |
43 | |
44 protected: | |
45 void UpdateExtensionTrusted(int render_process_id, | |
46 int render_frame_id, | |
47 int page_request_id, | |
48 bool is_extension_trusted); | |
49 | |
50 void AddCaptureSession(int render_process_id, | |
miu
2016/04/26 01:25:13
It seems that subclasses don't call Add/RemoveCapt
xjz
2016/04/29 00:11:42
Done.
| |
51 int render_frame_id, | |
52 int page_request_id, | |
53 bool is_extension_trusted, | |
54 bool is_link_secure); | |
55 | |
56 void RemoveCaptureSession(int render_process_id, | |
57 int render_frame_id, | |
58 int page_request_id); | |
59 | |
60 private: | |
61 // Tracks MEDIA_DESKTOP/TAB_VIDEO_CAPTURE sessions. Sessions are removed when | |
62 // MEDIA_REQUEST_STATE_CLOSING is encountered. | |
63 struct Session { | |
64 int render_process_id; | |
65 int render_frame_id; | |
66 int page_request_id; | |
67 // Extensions control the routing of the captured MediaStream content. | |
miu
2016/04/26 01:25:13
Sometimes normal web pages can capture/route conte
xjz
2016/04/29 00:11:42
Done.
| |
68 // Therefore, links can be deemed secure only when built-in extensions (and | |
69 // certain whitelisted ones) are in control of the routing. | |
70 bool is_extension_trusted; | |
71 | |
72 // This is true only if all connected video sinks are reported secure. | |
73 bool is_capturing_link_secure; | |
74 }; | |
75 | |
76 std::list<Session>::iterator FindSession(int render_process_id, | |
77 int render_frame_id, | |
78 int page_request_id); | |
79 | |
80 std::list<Session> sessions_; | |
81 }; | |
82 | |
83 #endif // CHROME_BROWSER_MEDIA_CAPTURE_ACCESS_HANDLER_BASE_H_ | |
OLD | NEW |