| 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/env.h" | 8 #include "ui/aura/env.h" |
| 9 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 12 #include "ui/gfx/screen.h" | 12 #include "ui/gfx/screen.h" |
| 13 | 13 |
| 14 namespace aura { | 14 namespace aura { |
| 15 | 15 |
| 16 TestScreen::TestScreen(aura::RootWindow* root_window) | 16 TestScreen::TestScreen(aura::RootWindow* root_window) |
| 17 : root_window_(root_window) { | 17 : root_window_(root_window) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 TestScreen::~TestScreen() { | 20 TestScreen::~TestScreen() { |
| 21 } | 21 } |
| 22 | 22 |
| 23 bool TestScreen::IsDIPEnabled() { |
| 24 return true; |
| 25 } |
| 26 |
| 23 gfx::Point TestScreen::GetCursorScreenPoint() { | 27 gfx::Point TestScreen::GetCursorScreenPoint() { |
| 24 return Env::GetInstance()->last_mouse_location(); | 28 return Env::GetInstance()->last_mouse_location(); |
| 25 } | 29 } |
| 26 | 30 |
| 27 gfx::NativeWindow TestScreen::GetWindowAtCursorScreenPoint() { | 31 gfx::NativeWindow TestScreen::GetWindowAtCursorScreenPoint() { |
| 28 const gfx::Point point = gfx::Screen::GetCursorScreenPoint(); | 32 const gfx::Point point = GetCursorScreenPoint(); |
| 29 return root_window_->GetTopWindowContainingPoint(point); | 33 return root_window_->GetTopWindowContainingPoint(point); |
| 30 } | 34 } |
| 31 | 35 |
| 32 int TestScreen::GetNumDisplays() { | 36 int TestScreen::GetNumDisplays() { |
| 33 return 1; | 37 return 1; |
| 34 } | 38 } |
| 35 | 39 |
| 36 gfx::Display TestScreen::GetDisplayNearestWindow( | 40 gfx::Display TestScreen::GetDisplayNearestWindow( |
| 37 gfx::NativeWindow window) const { | 41 gfx::NativeWindow window) const { |
| 38 return GetMonitor(); | 42 return GetMonitor(); |
| 39 } | 43 } |
| 40 | 44 |
| 41 gfx::Display TestScreen::GetDisplayNearestPoint(const gfx::Point& point) const { | 45 gfx::Display TestScreen::GetDisplayNearestPoint(const gfx::Point& point) const { |
| 42 return GetMonitor(); | 46 return GetMonitor(); |
| 43 } | 47 } |
| 44 | 48 |
| 45 gfx::Display TestScreen::GetDisplayMatching(const gfx::Rect& match_rect) const { | 49 gfx::Display TestScreen::GetDisplayMatching(const gfx::Rect& match_rect) const { |
| 46 return GetMonitor(); | 50 return GetMonitor(); |
| 47 } | 51 } |
| 48 | 52 |
| 49 gfx::Display TestScreen::GetPrimaryDisplay() const { | 53 gfx::Display TestScreen::GetPrimaryDisplay() const { |
| 50 return GetMonitor(); | 54 return GetMonitor(); |
| 51 } | 55 } |
| 52 | 56 |
| 53 gfx::Display TestScreen::GetMonitor() const { | 57 gfx::Display TestScreen::GetMonitor() const { |
| 54 return gfx::Display(0, root_window_->bounds()); | 58 return gfx::Display(0, root_window_->bounds()); |
| 55 } | 59 } |
| 56 | 60 |
| 57 } // namespace aura | 61 } // namespace aura |
| OLD | NEW |