| 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 "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | |
| 10 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 11 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
| 12 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 13 #include "ui/display/display.h" | 12 #include "ui/display/display.h" |
| 14 #include "ui/display/screen.h" | 13 #include "ui/display/screen.h" |
| 15 | 14 |
| 16 namespace chromeos { | 15 namespace chromeos { |
| 17 | 16 |
| 18 namespace { | 17 namespace { |
| 19 | 18 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 content::RenderFrameHost* rfh = | 124 content::RenderFrameHost* rfh = |
| 126 content::RenderFrameHost::FromID(render_process_id_, render_frame_id_); | 125 content::RenderFrameHost::FromID(render_process_id_, render_frame_id_); |
| 127 // TODO(xjz): Investigate whether this check (and the other one above) should | 126 // TODO(xjz): Investigate whether this check (and the other one above) should |
| 128 // be removed. | 127 // be removed. |
| 129 if (!rfh) { | 128 if (!rfh) { |
| 130 LOG(WARNING) << "RenderFrameHost is not alive."; | 129 LOG(WARNING) << "RenderFrameHost is not alive."; |
| 131 callback.Run(false, 0, 0); | 130 callback.Run(false, 0, 0); |
| 132 return; | 131 return; |
| 133 } | 132 } |
| 134 | 133 |
| 135 uint32_t link_mask = response.link_mask; | 134 callback.Run(response.success, response.link_mask, response.protection_mask); |
| 136 // If we successfully retrieved the device level status, check for capturers. | |
| 137 if (response.success) { | |
| 138 const bool insecure_capture_detected = | |
| 139 MediaCaptureDevicesDispatcher::GetInstance() | |
| 140 ->IsInsecureCapturingInProgress(render_process_id_, | |
| 141 render_frame_id_); | |
| 142 if (insecure_capture_detected) | |
| 143 link_mask |= ui::DISPLAY_CONNECTION_TYPE_NETWORK; | |
| 144 } | |
| 145 | |
| 146 callback.Run(response.success, link_mask, response.protection_mask); | |
| 147 } | 135 } |
| 148 | 136 |
| 149 void OutputProtectionDelegate::EnableProtectionComplete( | 137 void OutputProtectionDelegate::EnableProtectionComplete( |
| 150 const EnableProtectionCallback& callback, | 138 const EnableProtectionCallback& callback, |
| 151 bool success) { | 139 bool success) { |
| 152 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 140 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 153 | 141 |
| 154 callback.Run(success); | 142 callback.Run(success); |
| 155 } | 143 } |
| 156 | 144 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 183 display_id_ = new_display_id; | 171 display_id_ = new_display_id; |
| 184 } | 172 } |
| 185 | 173 |
| 186 void OutputProtectionDelegate::OnWindowDestroying(aura::Window* window) { | 174 void OutputProtectionDelegate::OnWindowDestroying(aura::Window* window) { |
| 187 DCHECK_EQ(window, window_); | 175 DCHECK_EQ(window, window_); |
| 188 window_->RemoveObserver(this); | 176 window_->RemoveObserver(this); |
| 189 window_ = nullptr; | 177 window_ = nullptr; |
| 190 } | 178 } |
| 191 | 179 |
| 192 } // namespace chromeos | 180 } // namespace chromeos |
| OLD | NEW |