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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/secure_display_link_tracker.h
diff --git a/content/renderer/media/secure_display_link_tracker.h b/content/renderer/media/secure_display_link_tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..8cc3c558fe06f7fdcb0cb0fff6ff7881a23e07dc
--- /dev/null
+++ b/content/renderer/media/secure_display_link_tracker.h
@@ -0,0 +1,57 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_MEDIA_SECURE_DISPLAY_LINK_TRACKER_H_
+#define CONTENT_RENDERER_MEDIA_SECURE_DISPLAY_LINK_TRACKER_H_
+
+#include <vector>
+
+// Tracks all connected links (video sinks / tracks), and reports if they are
+// all secure for video capturing.
+template <typename T>
+class SecureDisplayLinkTracker {
+ public:
+ SecureDisplayLinkTracker() {}
+ ~SecureDisplayLinkTracker() {}
+
+ void Add(T* link, bool is_link_secure);
+ void Remove(T* link);
+ void Update(T* link, bool is_link_secure);
+ bool is_capturing_secure() { return insecure_links_.empty(); }
oshima 2016/05/07 14:41:50 const
xjz 2016/05/10 00:28:25 Done.
+
+ private:
+ // Record every insecure links.
+ std::vector<T*> insecure_links_;
oshima 2016/05/07 14:41:50 DISALLOW_COPY_AND_ASSIGN
xjz 2016/05/10 00:28:25 Done.
+};
+
+template <typename T>
+void SecureDisplayLinkTracker<T>::Add(T* link, bool is_link_secure) {
+ if (!is_link_secure)
+ insecure_links_.push_back(link);
+}
+
+template <typename T>
+void SecureDisplayLinkTracker<T>::Remove(T* link) {
+ 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.
+ if (*it == link) {
+ insecure_links_.erase(it);
+ break;
+ }
+ }
+}
+
+template <typename T>
+void SecureDisplayLinkTracker<T>::Update(T* link, bool is_link_secure) {
+ for (auto it = insecure_links_.begin(); it != insecure_links_.end(); ++it) {
+ if (*it == link) {
+ if (is_link_secure)
+ insecure_links_.erase(it);
+ return;
+ }
+ }
+ if (!is_link_secure)
+ insecure_links_.push_back(link);
+}
+
+#endif // CONTENT_RENDERER_MEDIA_SECURE_DISPLAY_LINK_TRACKER_H_

Powered by Google App Engine
This is Rietveld 408576698