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

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 oshima and nasko's comments, and rebased. 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() const { return insecure_links_.empty(); }
22
23 private:
24 // Record every insecure links.
25 std::vector<T*> insecure_links_;
26
27 DISALLOW_COPY_AND_ASSIGN(SecureDisplayLinkTracker);
28 };
29
30 template <typename T>
31 void SecureDisplayLinkTracker<T>::Add(T* link, bool is_link_secure) {
32 DCHECK(std::find(insecure_links_.begin(), insecure_links_.end(), link) ==
33 insecure_links_.end());
34
35 if (!is_link_secure)
36 insecure_links_.push_back(link);
37 }
38
39 template <typename T>
40 void SecureDisplayLinkTracker<T>::Remove(T* link) {
41 auto it = std::find(insecure_links_.begin(), insecure_links_.end(), link);
42 if (it != insecure_links_.end())
43 insecure_links_.erase(it);
44 }
45
46 template <typename T>
47 void SecureDisplayLinkTracker<T>::Update(T* link, bool is_link_secure) {
48 auto it = std::find(insecure_links_.begin(), insecure_links_.end(), link);
49 if (it != insecure_links_.end()) {
50 if (is_link_secure)
51 insecure_links_.erase(it);
52 return;
53 }
54 Add(link, is_link_secure);
55 }
56
57 #endif // CONTENT_RENDERER_MEDIA_SECURE_DISPLAY_LINK_TRACKER_H_
OLDNEW
« no previous file with comments | « content/renderer/media/pepper_to_video_track_adapter_unittest.cc ('k') | content/renderer/media/user_media_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698