| 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 "chrome/browser/chromeos/display/output_protection_controller_ash.h" | 7 #include "chrome/browser/chromeos/display/output_protection_controller_ash.h" |
| 8 #include "chrome/browser/chromeos/display/output_protection_controller_mus.h" | 8 #include "chrome/browser/chromeos/display/output_protection_controller_mus.h" |
| 9 #include "chrome/browser/ui/ash/ash_util.h" | 9 #include "chrome/browser/ui/ash/ash_util.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 11 #include "content/public/browser/render_frame_host.h" | 11 #include "content/public/browser/render_frame_host.h" |
| 12 #include "ui/display/display.h" | 12 #include "ui/display/display.h" |
| 13 #include "ui/display/screen.h" | 13 #include "ui/display/screen.h" |
| 14 #include "ui/display/types/display_constants.h" | 14 #include "ui/display/types/display_constants.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 bool GetCurrentDisplayId(content::RenderFrameHost* rfh, int64_t* display_id) { | 20 bool GetCurrentDisplayId(content::RenderFrameHost* rfh, int64_t* display_id) { |
| 21 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 21 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 22 DCHECK(rfh); | 22 DCHECK(rfh); |
| 23 DCHECK(display_id); | 23 DCHECK(display_id); |
| 24 | 24 |
| 25 display::Screen* screen = display::Screen::GetScreen(); | 25 display::Screen* screen = display::Screen::GetScreen(); |
| 26 if (!screen) | 26 if (!screen) |
| 27 return false; | 27 return false; |
| 28 display::Display display = | 28 display::Display display = |
| 29 screen->GetDisplayNearestWindow(rfh->GetNativeView()); | 29 screen->GetDisplayNearestView(rfh->GetNativeView()); |
| 30 *display_id = display.id(); | 30 *display_id = display.id(); |
| 31 return true; | 31 return true; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void DoNothing(bool status) { | 34 void DoNothing(bool status) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 OutputProtectionDelegate::Controller::Controller() {} | 39 OutputProtectionDelegate::Controller::Controller() {} |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 display_id_ = new_display_id; | 140 display_id_ = new_display_id; |
| 141 } | 141 } |
| 142 | 142 |
| 143 void OutputProtectionDelegate::OnWindowDestroying(aura::Window* window) { | 143 void OutputProtectionDelegate::OnWindowDestroying(aura::Window* window) { |
| 144 DCHECK_EQ(window, window_); | 144 DCHECK_EQ(window, window_); |
| 145 window_->RemoveObserver(this); | 145 window_->RemoveObserver(this); |
| 146 window_ = nullptr; | 146 window_ = nullptr; |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace chromeos | 149 } // namespace chromeos |
| OLD | NEW |