| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/display/chromeos/query_content_protection_task.h" | 5 #include "ui/display/manager/chromeos/query_content_protection_task.h" |
| 6 | 6 |
| 7 #include "ui/display/chromeos/display_layout_manager.h" | 7 #include "ui/display/manager/chromeos/display_layout_manager.h" |
| 8 #include "ui/display/types/display_snapshot.h" | 8 #include "ui/display/types/display_snapshot.h" |
| 9 #include "ui/display/types/native_display_delegate.h" | 9 #include "ui/display/types/native_display_delegate.h" |
| 10 | 10 |
| 11 namespace ui { | 11 namespace ui { |
| 12 | 12 |
| 13 QueryContentProtectionTask::QueryContentProtectionTask( | 13 QueryContentProtectionTask::QueryContentProtectionTask( |
| 14 DisplayLayoutManager* layout_manager, | 14 DisplayLayoutManager* layout_manager, |
| 15 NativeDisplayDelegate* native_display_delegate, | 15 NativeDisplayDelegate* native_display_delegate, |
| 16 int64_t display_id, | 16 int64_t display_id, |
| 17 const ResponseCallback& callback) | 17 const ResponseCallback& callback) |
| 18 : layout_manager_(layout_manager), | 18 : layout_manager_(layout_manager), |
| 19 native_display_delegate_(native_display_delegate), | 19 native_display_delegate_(native_display_delegate), |
| 20 display_id_(display_id), | 20 display_id_(display_id), |
| 21 callback_(callback), | 21 callback_(callback), |
| 22 pending_requests_(0), | 22 pending_requests_(0), |
| 23 weak_ptr_factory_(this) { | 23 weak_ptr_factory_(this) {} |
| 24 } | |
| 25 | 24 |
| 26 QueryContentProtectionTask::~QueryContentProtectionTask() { | 25 QueryContentProtectionTask::~QueryContentProtectionTask() {} |
| 27 } | |
| 28 | 26 |
| 29 void QueryContentProtectionTask::Run() { | 27 void QueryContentProtectionTask::Run() { |
| 30 std::vector<DisplaySnapshot*> hdcp_capable_displays; | 28 std::vector<DisplaySnapshot*> hdcp_capable_displays; |
| 31 for (DisplaySnapshot* display : layout_manager_->GetDisplayStates()) { | 29 for (DisplaySnapshot* display : layout_manager_->GetDisplayStates()) { |
| 32 // Query display if it is in mirror mode or client on the same display. | 30 // Query display if it is in mirror mode or client on the same display. |
| 33 if (!layout_manager_->IsMirroring() && display->display_id() != display_id_) | 31 if (!layout_manager_->IsMirroring() && display->display_id() != display_id_) |
| 34 continue; | 32 continue; |
| 35 | 33 |
| 36 response_.link_mask |= display->type(); | 34 response_.link_mask |= display->type(); |
| 37 | 35 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 77 |
| 80 pending_requests_--; | 78 pending_requests_--; |
| 81 // Wait for all the requests to finish before invoking the callback. | 79 // Wait for all the requests to finish before invoking the callback. |
| 82 if (pending_requests_ != 0) | 80 if (pending_requests_ != 0) |
| 83 return; | 81 return; |
| 84 | 82 |
| 85 callback_.Run(response_); | 83 callback_.Run(response_); |
| 86 } | 84 } |
| 87 | 85 |
| 88 } // namespace ui | 86 } // namespace ui |
| OLD | NEW |