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

Side by Side Diff: content/renderer/media/secure_display_link_tracker.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 CONTENT_RENDERER_MEDIA_SECURE_DISPLAY_LINK_TRACKER_H_
6 #define CONTENT_RENDERER_MEDIA_SECURE_DISPLAY_LINK_TRACKER_H_
7
8 #include <vector>
9
10 // Tracks all connected links (video sinks / tracks), and reports if they are
11 // all secure for video capturing.
12 template <typename T>
13 class SecureDisplayLinkTracker {
14 public:
15 SecureDisplayLinkTracker() {}
16 ~SecureDisplayLinkTracker() {}
17
18 void Add(T* link, bool is_link_secure);
19 void Remove(T* link);
20 void Update(T* link, bool is_link_secure);
21 bool is_capturing_secure() { return insecure_links_.empty(); }
oshima 2016/05/07 14:41:50 const
xjz 2016/05/10 00:28:25 Done.
22
23 private:
24 // Record every insecure links.
25 std::vector<T*> insecure_links_;
oshima 2016/05/07 14:41:50 DISALLOW_COPY_AND_ASSIGN
xjz 2016/05/10 00:28:25 Done.
26 };
27
28 template <typename T>
29 void SecureDisplayLinkTracker<T>::Add(T* link, bool is_link_secure) {
30 if (!is_link_secure)
31 insecure_links_.push_back(link);
32 }
33
34 template <typename T>
35 void SecureDisplayLinkTracker<T>::Remove(T* link) {
36 for (auto it = insecure_links_.begin(); it != insecure_links_.end(); ++it) {
oshima 2016/05/07 14:41:50 std::find ?
xjz 2016/05/10 00:28:25 Done.
37 if (*it == link) {
38 insecure_links_.erase(it);
39 break;
40 }
41 }
42 }
43
44 template <typename T>
45 void SecureDisplayLinkTracker<T>::Update(T* link, bool is_link_secure) {
46 for (auto it = insecure_links_.begin(); it != insecure_links_.end(); ++it) {
47 if (*it == link) {
48 if (is_link_secure)
49 insecure_links_.erase(it);
50 return;
51 }
52 }
53 if (!is_link_secure)
54 insecure_links_.push_back(link);
55 }
56
57 #endif // CONTENT_RENDERER_MEDIA_SECURE_DISPLAY_LINK_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698