| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/aura/test/test_screen.h" | 5 #include "ui/aura/test/test_screen.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/aura/monitor_aura.h" |
| 8 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
| 9 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 10 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 12 #include "ui/gfx/monitor.h" |
| 13 #include "ui/gfx/screen.h" |
| 11 | 14 |
| 12 namespace aura { | 15 namespace aura { |
| 13 | 16 |
| 14 TestScreen::TestScreen(aura::RootWindow* root_window) | 17 TestScreen::TestScreen(aura::RootWindow* root_window) |
| 15 : root_window_(root_window) { | 18 : root_window_(root_window), |
| 19 monitor_(new MonitorAura()) { |
| 16 } | 20 } |
| 17 | 21 |
| 18 TestScreen::~TestScreen() { | 22 TestScreen::~TestScreen() { |
| 19 } | 23 } |
| 20 | 24 |
| 21 gfx::Point TestScreen::GetCursorScreenPointImpl() { | 25 gfx::Point TestScreen::GetCursorScreenPoint() { |
| 22 return root_window_->last_mouse_location(); | 26 return root_window_->last_mouse_location(); |
| 23 } | 27 } |
| 24 | 28 |
| 25 gfx::Rect TestScreen::GetMonitorWorkAreaNearestWindowImpl( | 29 gfx::NativeWindow TestScreen::GetWindowAtCursorScreenPoint() { |
| 26 gfx::NativeWindow window) { | 30 const gfx::Point point = gfx::Screen::GetCursorScreenPoint(); |
| 27 return GetBounds(); | |
| 28 } | |
| 29 | |
| 30 gfx::Rect TestScreen::GetMonitorAreaNearestWindowImpl( | |
| 31 gfx::NativeWindow window) { | |
| 32 return GetBounds(); | |
| 33 } | |
| 34 | |
| 35 gfx::Rect TestScreen::GetMonitorWorkAreaNearestPointImpl( | |
| 36 const gfx::Point& point) { | |
| 37 return GetBounds(); | |
| 38 } | |
| 39 | |
| 40 gfx::Rect TestScreen::GetMonitorAreaNearestPointImpl(const gfx::Point& point) { | |
| 41 return GetBounds(); | |
| 42 } | |
| 43 | |
| 44 gfx::NativeWindow TestScreen::GetWindowAtCursorScreenPointImpl() { | |
| 45 const gfx::Point point = GetCursorScreenPoint(); | |
| 46 return root_window_->GetTopWindowContainingPoint(point); | 31 return root_window_->GetTopWindowContainingPoint(point); |
| 47 } | 32 } |
| 48 | 33 |
| 49 gfx::Rect TestScreen::GetBounds() { | 34 int TestScreen::GetNumMonitors() { |
| 50 return gfx::Rect(root_window_->bounds().size()); | |
| 51 } | |
| 52 | |
| 53 gfx::Size TestScreen::GetPrimaryMonitorSizeImpl() { | |
| 54 return GetBounds().size(); | |
| 55 } | |
| 56 | |
| 57 int TestScreen::GetNumMonitorsImpl() { | |
| 58 return 1; | 35 return 1; |
| 59 } | 36 } |
| 60 | 37 |
| 38 void TestScreen::GetMonitorNearestWindow( |
| 39 gfx::NativeWindow window, gfx::Monitor* monitor_out) const { |
| 40 CopyTo(monitor_out); |
| 41 } |
| 42 |
| 43 void TestScreen::GetMonitorNearestPoint( |
| 44 const gfx::Point& point, gfx::Monitor* monitor_out) const { |
| 45 CopyTo(monitor_out); |
| 46 } |
| 47 |
| 48 void TestScreen::GetPrimaryMonitor(gfx::Monitor* monitor_out) const { |
| 49 CopyTo(monitor_out); |
| 50 } |
| 51 |
| 52 void TestScreen::CopyTo(gfx::Monitor* monitor_out) const { |
| 53 monitor_out->set_bounds(root_window_->bounds()); |
| 54 monitor_out->set_work_area(root_window_->bounds()); |
| 55 monitor_out->set_device_scale_factor(1.0); |
| 56 } |
| 57 |
| 61 } // namespace aura | 58 } // namespace aura |
| OLD | NEW |