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

Unified Diff: chrome/browser/media/output_protection_proxy.h

Issue 2085063002: media: Add OutputProtectionProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 6 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: chrome/browser/media/output_protection_proxy.h
diff --git a/chrome/browser/media/output_protection_proxy.h b/chrome/browser/media/output_protection_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..662737804da23e96a81733a6acb295ca35c96c73
--- /dev/null
+++ b/chrome/browser/media/output_protection_proxy.h
@@ -0,0 +1,70 @@
+// 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 CHROME_BROWSER_MEDIA_OUTPUT_PROTECTION_PROXY_H_
+#define CHROME_BROWSER_MEDIA_OUTPUT_PROTECTION_PROXY_H_
+
+#include <stdint.h>
+
+#include "base/memory/weak_ptr.h"
+#include "content/public/browser/browser_thread.h"
+
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/display/output_protection_delegate.h"
+#endif
+
+namespace chrome {
+
+// A class to query output protection status and/or enable output protection.
+//
+// On Chrome OS, operations on the physical displays are delegated to
+// OutputProtectionDelegate. On other platforms, physical displays are not
+// checked.
+//
+// On all platforms, in ProcessQueryStatusResult(), this class checks the
+// network link and adds it to the existing link mask.
+//
+// All methods except constructor should be invoked in UI thread.
+class OutputProtectionProxy {
+ public:
+ typedef base::Callback<void(bool /* success */,
+ uint32_t /* link_mask */,
+ uint32_t /* protection_mask*/)>
+ QueryStatusCallback;
+ typedef base::Callback<void(bool /* success */)> EnableProtectionCallback;
+
+ OutputProtectionProxy(int render_process_id, int render_frame_id);
+
+ void QueryStatus(const QueryStatusCallback& callback);
+ void EnableProtection(uint32_t desired_method_mask,
+ const EnableProtectionCallback& callback);
+
+ private:
+ // Makes sure this class can only be deleted on the UI thread.
+ friend class base::DeleteHelper<OutputProtectionProxy>;
+ friend struct content::BrowserThread::DeleteOnThread<
+ content::BrowserThread::UI>;
+ ~OutputProtectionProxy();
+
+ // Callbacks for QueryStatus(). It also checks the network link and adds it
+ // to the |link_mask|.
+ void ProcessQueryStatusResult(const QueryStatusCallback& callback,
+ bool success,
+ uint32_t link_mask,
+ uint32_t protection_mask);
+
+ // Used to lookup the WebContents associated with the render frame.
+ int render_process_id_;
+ int render_frame_id_;
+
+#if defined(OS_CHROMEOS)
+ chromeos::OutputProtectionDelegate output_protection_delegate_;
+#endif
+
+ base::WeakPtrFactory<OutputProtectionProxy> weak_ptr_factory_;
+};
+
+} // namespace chrome
+
+#endif // CHROME_BROWSER_MEDIA_OUTPUT_PROTECTION_PROXY_H_

Powered by Google App Engine
This is Rietveld 408576698