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

Unified Diff: ui/display/manager/chromeos/display_configurator.cc

Issue 2675743002: PPAPI: Make output protection API work with mus+ash (Closed)
Patch Set: Addressed review issues Created 3 years, 10 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: ui/display/manager/chromeos/display_configurator.cc
diff --git a/ui/display/manager/chromeos/display_configurator.cc b/ui/display/manager/chromeos/display_configurator.cc
index d718eb8f02b969562b4f8194f5cbd649fa4666c6..b2ffc053d6483cdd40df4571dea5f9d94575a772 100644
--- a/ui/display/manager/chromeos/display_configurator.cc
+++ b/ui/display/manager/chromeos/display_configurator.cc
@@ -490,13 +490,13 @@ DisplayConfigurator::~DisplayConfigurator() {
CallAndClearQueuedCallbacks(false);
while (!query_protection_callbacks_.empty()) {
- query_protection_callbacks_.front().Run(QueryProtectionResponse());
+ query_protection_callbacks_.front().Run(false, 0, 0);
query_protection_callbacks_.pop();
}
- while (!enable_protection_callbacks_.empty()) {
- enable_protection_callbacks_.front().Run(false);
- enable_protection_callbacks_.pop();
+ while (!set_protection_callbacks_.empty()) {
+ set_protection_callbacks_.front().Run(false);
+ set_protection_callbacks_.pop();
}
}
@@ -641,16 +641,15 @@ void DisplayConfigurator::ForceInitialConfigure(
configuration_task_->Run();
}
-DisplayConfigurator::ContentProtectionClientId
-DisplayConfigurator::RegisterContentProtectionClient() {
+uint64_t DisplayConfigurator::RegisterContentProtectionClient() {
if (!configure_display_ || display_externally_controlled_)
- return kInvalidClientId;
+ return INVALID_CLIENT_ID;
return next_display_protection_client_id_++;
}
void DisplayConfigurator::UnregisterContentProtectionClient(
- ContentProtectionClientId client_id) {
+ uint64_t client_id) {
client_protection_requests_.erase(client_id);
ContentProtections protections;
@@ -660,7 +659,7 @@ void DisplayConfigurator::UnregisterContentProtectionClient(
}
}
- enable_protection_callbacks_.push(base::Bind(&DoNothing));
+ set_protection_callbacks_.push(base::Bind(&DoNothing));
ApplyContentProtectionTask* task = new ApplyContentProtectionTask(
layout_manager_.get(), native_display_delegate_.get(), protections,
base::Bind(&DisplayConfigurator::OnContentProtectionClientUnregistered,
@@ -676,16 +675,16 @@ void DisplayConfigurator::OnContentProtectionClientUnregistered(bool success) {
DCHECK(!content_protection_tasks_.empty());
content_protection_tasks_.pop();
- DCHECK(!enable_protection_callbacks_.empty());
- EnableProtectionCallback callback = enable_protection_callbacks_.front();
- enable_protection_callbacks_.pop();
+ DCHECK(!set_protection_callbacks_.empty());
+ SetProtectionCallback callback = set_protection_callbacks_.front();
+ set_protection_callbacks_.pop();
if (!content_protection_tasks_.empty())
content_protection_tasks_.front().Run();
}
void DisplayConfigurator::QueryContentProtectionStatus(
- ContentProtectionClientId client_id,
+ uint64_t client_id,
int64_t display_id,
const QueryProtectionCallback& callback) {
// Exclude virtual displays so that protected content will not be recaptured
@@ -693,13 +692,13 @@ void DisplayConfigurator::QueryContentProtectionStatus(
for (const DisplaySnapshot* display : cached_displays_) {
if (display->display_id() == display_id &&
!IsPhysicalDisplayType(display->type())) {
- callback.Run(QueryProtectionResponse());
+ callback.Run(false, 0, 0);
return;
}
}
if (!configure_display_ || display_externally_controlled_) {
- callback.Run(QueryProtectionResponse());
+ callback.Run(false, 0, 0);
return;
}
@@ -715,20 +714,20 @@ void DisplayConfigurator::QueryContentProtectionStatus(
}
void DisplayConfigurator::OnContentProtectionQueried(
- ContentProtectionClientId client_id,
+ uint64_t client_id,
int64_t display_id,
QueryContentProtectionTask::Response task_response) {
- QueryProtectionResponse response;
- response.success = task_response.success;
- response.link_mask = task_response.link_mask;
+ bool success = task_response.success;
+ uint32_t link_mask = task_response.link_mask;
+ uint32_t protection_mask = 0;
// Don't reveal protections requested by other clients.
ProtectionRequests::iterator it = client_protection_requests_.find(client_id);
- if (response.success && it != client_protection_requests_.end()) {
+ if (success && it != client_protection_requests_.end()) {
uint32_t requested_mask = 0;
if (it->second.find(display_id) != it->second.end())
requested_mask = it->second[display_id];
- response.protection_mask =
+ protection_mask =
task_response.enabled & ~task_response.unfulfilled & requested_mask;
}
@@ -738,17 +737,17 @@ void DisplayConfigurator::OnContentProtectionQueried(
DCHECK(!query_protection_callbacks_.empty());
QueryProtectionCallback callback = query_protection_callbacks_.front();
query_protection_callbacks_.pop();
- callback.Run(response);
+ callback.Run(success, link_mask, protection_mask);
if (!content_protection_tasks_.empty())
content_protection_tasks_.front().Run();
}
-void DisplayConfigurator::EnableContentProtection(
- ContentProtectionClientId client_id,
+void DisplayConfigurator::SetContentProtection(
+ uint64_t client_id,
int64_t display_id,
uint32_t desired_method_mask,
- const EnableProtectionCallback& callback) {
+ const SetProtectionCallback& callback) {
if (!configure_display_ || display_externally_controlled_) {
callback.Run(false);
return;
@@ -766,10 +765,10 @@ void DisplayConfigurator::EnableContentProtection(
}
protections[display_id] |= desired_method_mask;
- enable_protection_callbacks_.push(callback);
+ set_protection_callbacks_.push(callback);
ApplyContentProtectionTask* task = new ApplyContentProtectionTask(
layout_manager_.get(), native_display_delegate_.get(), protections,
- base::Bind(&DisplayConfigurator::OnContentProtectionEnabled,
+ base::Bind(&DisplayConfigurator::OnSetContentProtectionCompleted,
weak_ptr_factory_.GetWeakPtr(), client_id, display_id,
desired_method_mask));
content_protection_tasks_.push(
@@ -778,17 +777,17 @@ void DisplayConfigurator::EnableContentProtection(
content_protection_tasks_.front().Run();
}
-void DisplayConfigurator::OnContentProtectionEnabled(
- ContentProtectionClientId client_id,
+void DisplayConfigurator::OnSetContentProtectionCompleted(
+ uint64_t client_id,
int64_t display_id,
uint32_t desired_method_mask,
bool success) {
DCHECK(!content_protection_tasks_.empty());
content_protection_tasks_.pop();
- DCHECK(!enable_protection_callbacks_.empty());
- EnableProtectionCallback callback = enable_protection_callbacks_.front();
- enable_protection_callbacks_.pop();
+ DCHECK(!set_protection_callbacks_.empty());
+ SetProtectionCallback callback = set_protection_callbacks_.front();
+ set_protection_callbacks_.pop();
if (!success) {
callback.Run(false);
« no previous file with comments | « ui/display/manager/chromeos/display_configurator.h ('k') | ui/display/manager/chromeos/display_configurator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698