Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: chrome/browser/media/capture_access_handler_base.h

Issue 1873293002: Report if video capturing meets output protection requirement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "base/callback.h"
oshima 2016/05/07 14:41:49 you do need this?
xjz 2016/05/10 00:28:25 Removed.
11 #include "chrome/browser/media/media_access_handler.h"
12 #include "content/public/browser/media_request_state.h"
13 #include "content/public/common/media_stream_request.h"
14
15 // Base class for DesktopCaptureAccessHandler and TabCaptureAccessHandler. This
16 // class tracks active capturing sessions, and provides API to check if there is
17 // ongoing insecure video capturing.
18 class CaptureAccessHandlerBase : public MediaAccessHandler {
19 public:
20 CaptureAccessHandlerBase();
21 ~CaptureAccessHandlerBase() override;
22
23 // MediaAccessHandler implementation.
24 void UpdateMediaRequestState(int render_process_id,
25 int render_frame_id,
26 int page_request_id,
27 content::MediaStreamType stream_type,
28 content::MediaRequestState state) override;
29
30 // Return true if there is any ongoing insecured capturing. The capturing is
31 // deemed secure if all connected video sinks are reported secure and the
32 // connections to the sinks are being managed by a trusted extension.
33 bool IsInsecureCapturingInProgress(int render_process_id,
34 int render_frame_id);
35
36 void UpdateCapturingLinkSecured(int render_process_id,
37 int render_frame_id,
38 int page_request_id,
39 bool is_secure);
40
41 protected:
42 static bool IsExtensionWhitelistedForScreenCapture(
43 const extensions::Extension* extension);
44
45 static bool IsBuiltInExtension(const GURL& origin);
46
47 void UpdateExtensionTrusted(const content::MediaStreamRequest& request,
48 const extensions::Extension* extension);
49
50 private:
51 // Tracks MEDIA_DESKTOP/TAB_VIDEO_CAPTURE sessions. Sessions are removed when
52 // MEDIA_REQUEST_STATE_CLOSING is encountered.
53 struct Session {
54 int render_process_id;
55 int render_frame_id;
56 int page_request_id;
57 // Extensions control the routing of the captured MediaStream content.
58 // Therefore, only built-in extensions (and certain whitelisted ones) can be
59 // trusted to set-up secure links.
60 bool is_extension_trusted;
61
62 // This is true only if all connected video sinks are reported secure.
63 bool is_capturing_link_secure;
64 };
oshima 2016/05/07 14:41:49 move the definition to .cc file.
miu 2016/05/09 20:30:50 This can't be done: struct Session is needed for t
oshima 2016/05/09 22:24:48 But you need it only in .cc right? you should be
miu 2016/05/09 23:10:52 Ah, yes! It would work because the template instan
xjz 2016/05/10 00:28:25 Done.
65
66 void AddCaptureSession(int render_process_id,
67 int render_frame_id,
68 int page_request_id,
69 bool is_extension_trusted);
70
71 void RemoveCaptureSession(int render_process_id,
72 int render_frame_id,
73 int page_request_id);
74
75 std::list<Session>::iterator FindSession(int render_process_id,
76 int render_frame_id,
77 int page_request_id);
78
79 std::list<Session> sessions_;
oshima 2016/05/07 14:41:49 DISALLOW_COPY_AND_ASSIGN
xjz 2016/05/10 00:28:25 Done.
80 };
81
82 #endif // CHROME_BROWSER_MEDIA_CAPTURE_ACCESS_HANDLER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698