Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/display/output_protection_delegate.h" | 5 #include "chrome/browser/chromeos/display/output_protection_delegate.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 10 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 weak_ptr_factory_.GetWeakPtr(), callback)); | 116 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 117 desired_method_mask_ = desired_method_mask; | 117 desired_method_mask_ = desired_method_mask; |
| 118 } | 118 } |
| 119 | 119 |
| 120 void OutputProtectionDelegate::QueryStatusComplete( | 120 void OutputProtectionDelegate::QueryStatusComplete( |
| 121 const QueryStatusCallback& callback, | 121 const QueryStatusCallback& callback, |
| 122 const ui::DisplayConfigurator::QueryProtectionResponse& response) { | 122 const ui::DisplayConfigurator::QueryProtectionResponse& response) { |
| 123 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 123 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 124 | 124 |
| 125 content::RenderFrameHost* rfh = | 125 content::RenderFrameHost* rfh = |
| 126 content::RenderFrameHost::FromID(render_process_id_, render_frame_id_); | 126 content::RenderFrameHost::FromID(render_process_id_, render_frame_id_); |
|
oshima
2016/05/07 14:41:49
do you still need this?
xhwang
2016/05/09 18:29:48
I don't really know when this could happen. But we
xjz
2016/05/10 00:28:24
It is not needed for this purpose. Added a TODO co
| |
| 127 if (!rfh) { | 127 if (!rfh) { |
| 128 LOG(WARNING) << "RenderFrameHost is not alive."; | 128 LOG(WARNING) << "RenderFrameHost is not alive."; |
| 129 callback.Run(false, 0, 0); | 129 callback.Run(false, 0, 0); |
| 130 return; | 130 return; |
| 131 } | 131 } |
| 132 | 132 |
| 133 uint32_t link_mask = response.link_mask; | 133 uint32_t link_mask = response.link_mask; |
| 134 // If we successfully retrieved the device level status, check for capturers. | 134 // If we successfully retrieved the device level status, check for capturers. |
| 135 if (response.success) { | 135 if (response.success) { |
| 136 const bool capture_detected = | 136 const bool insecure_capture_detected = |
| 137 // Check for tab capture on the current tab. | |
| 138 content::WebContents::FromRenderFrameHost(rfh)->GetCapturerCount() > | |
| 139 0 || | |
| 140 // Check for desktop capture. | |
| 141 MediaCaptureDevicesDispatcher::GetInstance() | 137 MediaCaptureDevicesDispatcher::GetInstance() |
| 142 ->IsDesktopCaptureInProgress(); | 138 ->IsInsecureCapturingInProgress(render_process_id_, |
| 143 if (capture_detected) | 139 render_frame_id_); |
| 140 if (insecure_capture_detected) | |
| 144 link_mask |= ui::DISPLAY_CONNECTION_TYPE_NETWORK; | 141 link_mask |= ui::DISPLAY_CONNECTION_TYPE_NETWORK; |
| 145 } | 142 } |
| 146 | 143 |
| 147 callback.Run(response.success, link_mask, response.protection_mask); | 144 callback.Run(response.success, link_mask, response.protection_mask); |
| 148 } | 145 } |
| 149 | 146 |
| 150 void OutputProtectionDelegate::EnableProtectionComplete( | 147 void OutputProtectionDelegate::EnableProtectionComplete( |
| 151 const EnableProtectionCallback& callback, | 148 const EnableProtectionCallback& callback, |
| 152 bool success) { | 149 bool success) { |
| 153 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 150 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 184 display_id_ = new_display_id; | 181 display_id_ = new_display_id; |
| 185 } | 182 } |
| 186 | 183 |
| 187 void OutputProtectionDelegate::OnWindowDestroying(aura::Window* window) { | 184 void OutputProtectionDelegate::OnWindowDestroying(aura::Window* window) { |
| 188 DCHECK_EQ(window, window_); | 185 DCHECK_EQ(window, window_); |
| 189 window_->RemoveObserver(this); | 186 window_->RemoveObserver(this); |
| 190 window_ = nullptr; | 187 window_ = nullptr; |
| 191 } | 188 } |
| 192 | 189 |
| 193 } // namespace chromeos | 190 } // namespace chromeos |
| OLD | NEW |