summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc2
-rw-r--r--chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.cc25
-rw-r--r--chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.h21
-rw-r--r--chromeos/display/output_configurator.cc18
-rw-r--r--chromeos/display/output_configurator.h1
-rw-r--r--ppapi/api/private/ppb_output_protection_private.idl3
-rw-r--r--ppapi/c/private/ppb_output_protection_private.h5
7 files changed, 55 insertions, 20 deletions
diff --git a/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc b/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc
index f634338..dcfb013 100644
--- a/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc
+++ b/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc
@@ -87,7 +87,7 @@ scoped_ptr<ResourceHost> ChromeBrowserPepperHostFactory::CreateResourceHost(
#if defined(OS_CHROMEOS)
case PpapiHostMsg_OutputProtection_Create::ID: {
scoped_refptr<ResourceMessageFilter> output_protection_filter(
- new PepperOutputProtectionMessageFilter());
+ new PepperOutputProtectionMessageFilter(host_, instance));
return scoped_ptr<ResourceHost>(new MessageFilterHost(
host_->GetPpapiHost(), instance, params.pp_resource(),
output_protection_filter));
diff --git a/chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.cc
index 5c1a9d4..10dc050 100644
--- a/chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.cc
+++ b/chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.cc
@@ -5,7 +5,10 @@
#include "chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.h"
#include "build/build_config.h"
+#include "content/public/browser/browser_ppapi_host.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/web_contents.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_output_protection_private.h"
#include "ppapi/host/dispatch_host_message.h"
@@ -53,6 +56,10 @@ COMPILE_ASSERT(
static_cast<int>(chromeos::OUTPUT_TYPE_DISPLAYPORT),
PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT);
COMPILE_ASSERT(
+ static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK) ==
+ static_cast<int>(chromeos::OUTPUT_TYPE_NETWORK),
+ PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK);
+COMPILE_ASSERT(
static_cast<int>(PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE) ==
static_cast<int>(chromeos::OUTPUT_PROTECTION_METHOD_NONE),
PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE);
@@ -74,9 +81,13 @@ void UnregisterClientOnUIThread(
} // namespace
-PepperOutputProtectionMessageFilter::PepperOutputProtectionMessageFilter() {
+PepperOutputProtectionMessageFilter::PepperOutputProtectionMessageFilter(
+ content::BrowserPpapiHost* host,
+ PP_Instance instance) {
#if defined(OS_CHROMEOS) && defined(USE_ASH) && defined(USE_X11)
client_id_ = 0;
+ host->GetRenderViewIDsForInstance(
+ instance, &render_process_id_, &render_view_id_);
#else
NOTIMPLEMENTED();
#endif
@@ -141,6 +152,18 @@ int32_t PepperOutputProtectionMessageFilter::OnQueryStatus(
ash::Shell::GetInstance()->output_configurator();
bool result = configurator->QueryOutputProtectionStatus(
GetClientId(), &link_mask, &protection_mask);
+
+ // If we successfully retrieved the device level status, check for capturers.
+ if (result) {
+ // Ensure the RenderViewHost is still alive.
+ content::RenderViewHost* rvh =
+ content::RenderViewHost::FromID(render_process_id_, render_view_id_);
+ if (rvh) {
+ if (content::WebContents::FromRenderViewHost(rvh)->GetCapturerCount() > 0)
+ link_mask |= chromeos::OUTPUT_TYPE_NETWORK;
+ }
+ }
+
reply_context.params.set_result(result ? PP_OK : PP_ERROR_FAILED);
SendReply(
reply_context,
diff --git a/chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.h b/chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.h
index d64260f..be5ef16 100644
--- a/chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.h
+++ b/chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.h
@@ -2,30 +2,33 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_OUTPUT_PROTECTION_MESSAGE_FILTER_H_
#define CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_OUTPUT_PROTECTION_MESSAGE_FILTER_H_
-#include "content/public/browser/browser_thread.h"
-#include "ppapi/host/host_message_context.h"
+#include "ppapi/c/pp_instance.h"
#include "ppapi/host/resource_message_filter.h"
#if defined(OS_CHROMEOS)
#include "chromeos/display/output_configurator.h"
#endif
+namespace content {
+class BrowserPpapiHost;
+} // namespace content
+
namespace ppapi {
namespace host {
-class PpapiHost;
-}
-}
+struct HostMessageContext;
+} // namespace host
+} // namespace ppapi
namespace chrome {
class PepperOutputProtectionMessageFilter
: public ppapi::host::ResourceMessageFilter {
public:
- PepperOutputProtectionMessageFilter();
+ PepperOutputProtectionMessageFilter(content::BrowserPpapiHost* host,
+ PP_Instance instance);
private:
// ppapi::host::ResourceMessageFilter overrides.
@@ -46,6 +49,10 @@ class PepperOutputProtectionMessageFilter
#if defined(OS_CHROMEOS)
chromeos::OutputConfigurator::OutputProtectionClientId client_id_;
+
+ // Used to lookup the WebContents associated with this PP_Instance.
+ int render_process_id_;
+ int render_view_id_;
#endif
DISALLOW_COPY_AND_ASSIGN(PepperOutputProtectionMessageFilter);
diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc
index 44cf4d9..c4d0242 100644
--- a/chromeos/display/output_configurator.cc
+++ b/chromeos/display/output_configurator.cc
@@ -305,9 +305,10 @@ bool OutputConfigurator::QueryOutputProtectionStatus(
switch (it->type) {
case OUTPUT_TYPE_UNKNOWN:
return false;
- // HDMI and DisplayPort both support HDCP.
- case OUTPUT_TYPE_HDMI:
- case OUTPUT_TYPE_DISPLAYPORT: {
+ // DisplayPort, DVI, and HDMI all support HDCP.
+ case OUTPUT_TYPE_DISPLAYPORT:
+ case OUTPUT_TYPE_DVI:
+ case OUTPUT_TYPE_HDMI: {
HDCPState state;
if (!delegate_->GetHDCPState(this_id, &state))
return false;
@@ -319,7 +320,7 @@ bool OutputConfigurator::QueryOutputProtectionStatus(
}
case OUTPUT_TYPE_INTERNAL:
case OUTPUT_TYPE_VGA:
- case OUTPUT_TYPE_DVI:
+ case OUTPUT_TYPE_NETWORK:
// No protections for these types. Do nothing.
break;
case OUTPUT_TYPE_NONE:
@@ -360,9 +361,10 @@ bool OutputConfigurator::EnableOutputProtection(
switch (it->type) {
case OUTPUT_TYPE_UNKNOWN:
return false;
- // HDMI and DisplayPort both support HDCP.
- case OUTPUT_TYPE_HDMI:
- case OUTPUT_TYPE_DISPLAYPORT: {
+ // DisplayPort, DVI, and HDMI all support HDCP.
+ case OUTPUT_TYPE_DISPLAYPORT:
+ case OUTPUT_TYPE_DVI:
+ case OUTPUT_TYPE_HDMI: {
HDCPState new_desired_state =
(all_desired & OUTPUT_PROTECTION_METHOD_HDCP) ?
HDCP_STATE_DESIRED : HDCP_STATE_UNDESIRED;
@@ -372,7 +374,7 @@ bool OutputConfigurator::EnableOutputProtection(
}
case OUTPUT_TYPE_INTERNAL:
case OUTPUT_TYPE_VGA:
- case OUTPUT_TYPE_DVI:
+ case OUTPUT_TYPE_NETWORK:
// No protections for these types. Do nothing.
break;
case OUTPUT_TYPE_NONE:
diff --git a/chromeos/display/output_configurator.h b/chromeos/display/output_configurator.h
index 87071c1..3491344 100644
--- a/chromeos/display/output_configurator.h
+++ b/chromeos/display/output_configurator.h
@@ -45,6 +45,7 @@ enum OutputType {
OUTPUT_TYPE_HDMI = 1 << 3,
OUTPUT_TYPE_DVI = 1 << 4,
OUTPUT_TYPE_DISPLAYPORT = 1 << 5,
+ OUTPUT_TYPE_NETWORK = 1 << 6,
};
// Content protection methods applied on video output.
diff --git a/ppapi/api/private/ppb_output_protection_private.idl b/ppapi/api/private/ppb_output_protection_private.idl
index 1caa000..44a2585 100644
--- a/ppapi/api/private/ppb_output_protection_private.idl
+++ b/ppapi/api/private/ppb_output_protection_private.idl
@@ -32,7 +32,8 @@ label Chrome {
PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA = 1 << 2,
PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI = 1 << 3,
PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI = 1 << 4,
- PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5
+ PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5,
+ PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK = 1 << 6
};
/**
diff --git a/ppapi/c/private/ppb_output_protection_private.h b/ppapi/c/private/ppb_output_protection_private.h
index 2cf8fc9..d489c00 100644
--- a/ppapi/c/private/ppb_output_protection_private.h
+++ b/ppapi/c/private/ppb_output_protection_private.h
@@ -4,7 +4,7 @@
*/
/* From private/ppb_output_protection_private.idl,
- * modified Mon Sep 30 18:24:12 2013.
+ * modified Tue Oct 8 13:22:13 2013.
*/
#ifndef PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_
@@ -52,7 +52,8 @@ typedef enum {
PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA = 1 << 2,
PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI = 1 << 3,
PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI = 1 << 4,
- PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5
+ PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5,
+ PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK = 1 << 6
} PP_OutputProtectionLinkType_Private;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_OutputProtectionLinkType_Private, 4);
/**