Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "mash/wm/test/wm_test_screen.h" | |
| 6 | |
| 7 #include "ui/aura/window.h" | |
| 8 #include "ui/display/display_finder.h" | |
| 9 | |
| 10 #undef NOTIMPLEMENTED | |
| 11 #define NOTIMPLEMENTED() DVLOG(1) << "notimplemented" | |
|
Nico
2016/05/27 13:38:07
…what? If NOTIMPLEMENTED doesn't do what you want,
| |
| 12 | |
| 13 namespace mash { | |
| 14 namespace wm { | |
| 15 | |
| 16 WmTestScreen::WmTestScreen() { | |
| 17 display::Screen::SetScreenInstance(this); | |
| 18 } | |
| 19 | |
| 20 WmTestScreen::~WmTestScreen() { | |
| 21 if (display::Screen::GetScreen() == this) | |
| 22 display::Screen::SetScreenInstance(nullptr); | |
| 23 } | |
| 24 | |
| 25 gfx::Point WmTestScreen::GetCursorScreenPoint() { | |
| 26 // TODO(sky): use the implementation from WindowManagerConnection. | |
| 27 NOTIMPLEMENTED(); | |
| 28 return gfx::Point(); | |
| 29 } | |
| 30 | |
| 31 bool WmTestScreen::IsWindowUnderCursor(gfx::NativeWindow window) { | |
| 32 if (!window) | |
| 33 return false; | |
| 34 | |
| 35 return window->IsVisible() && | |
| 36 window->GetBoundsInScreen().Contains(GetCursorScreenPoint()); | |
| 37 } | |
| 38 | |
| 39 gfx::NativeWindow WmTestScreen::GetWindowAtScreenPoint( | |
| 40 const gfx::Point& point) { | |
| 41 NOTREACHED(); | |
| 42 return nullptr; | |
| 43 } | |
| 44 | |
| 45 display::Display WmTestScreen::GetPrimaryDisplay() const { | |
| 46 return *display_list_.GetPrimaryDisplayIterator(); | |
| 47 } | |
| 48 | |
| 49 display::Display WmTestScreen::GetDisplayNearestWindow( | |
| 50 gfx::NativeView view) const { | |
| 51 NOTIMPLEMENTED(); | |
| 52 return *display_list_.GetPrimaryDisplayIterator(); | |
| 53 } | |
| 54 | |
| 55 display::Display WmTestScreen::GetDisplayNearestPoint( | |
| 56 const gfx::Point& point) const { | |
| 57 return *display::FindDisplayNearestPoint(display_list_.displays(), point); | |
| 58 } | |
| 59 | |
| 60 int WmTestScreen::GetNumDisplays() const { | |
| 61 return static_cast<int>(display_list_.displays().size()); | |
| 62 } | |
| 63 | |
| 64 std::vector<display::Display> WmTestScreen::GetAllDisplays() const { | |
| 65 return display_list_.displays(); | |
| 66 } | |
| 67 | |
| 68 display::Display WmTestScreen::GetDisplayMatching( | |
| 69 const gfx::Rect& match_rect) const { | |
| 70 const display::Display* match = display::FindDisplayWithBiggestIntersection( | |
| 71 display_list_.displays(), match_rect); | |
| 72 return match ? *match : GetPrimaryDisplay(); | |
| 73 } | |
| 74 | |
| 75 void WmTestScreen::AddObserver(display::DisplayObserver* observer) { | |
| 76 display_list_.AddObserver(observer); | |
| 77 } | |
| 78 | |
| 79 void WmTestScreen::RemoveObserver(display::DisplayObserver* observer) { | |
| 80 display_list_.RemoveObserver(observer); | |
| 81 } | |
| 82 | |
| 83 } // namespace wm | |
| 84 } // namespace mash | |
| OLD | NEW |