Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Unified Diff: mash/wm/test/wm_test_screen.cc

Issue 1984393002: Refactors std::vector<Display> out of ScreenMus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix deps and DEPS Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mash/wm/test/wm_test_screen.h ('k') | ui/views/mus/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mash/wm/test/wm_test_screen.cc
diff --git a/mash/wm/test/wm_test_screen.cc b/mash/wm/test/wm_test_screen.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e4dce60f22b118f830352e7a1771feeff700dd54
--- /dev/null
+++ b/mash/wm/test/wm_test_screen.cc
@@ -0,0 +1,84 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mash/wm/test/wm_test_screen.h"
+
+#include "ui/aura/window.h"
+#include "ui/display/display_finder.h"
+
+#undef NOTIMPLEMENTED
+#define NOTIMPLEMENTED() DVLOG(1) << "notimplemented"
Nico 2016/05/27 13:38:07 …what? If NOTIMPLEMENTED doesn't do what you want,
+
+namespace mash {
+namespace wm {
+
+WmTestScreen::WmTestScreen() {
+ display::Screen::SetScreenInstance(this);
+}
+
+WmTestScreen::~WmTestScreen() {
+ if (display::Screen::GetScreen() == this)
+ display::Screen::SetScreenInstance(nullptr);
+}
+
+gfx::Point WmTestScreen::GetCursorScreenPoint() {
+ // TODO(sky): use the implementation from WindowManagerConnection.
+ NOTIMPLEMENTED();
+ return gfx::Point();
+}
+
+bool WmTestScreen::IsWindowUnderCursor(gfx::NativeWindow window) {
+ if (!window)
+ return false;
+
+ return window->IsVisible() &&
+ window->GetBoundsInScreen().Contains(GetCursorScreenPoint());
+}
+
+gfx::NativeWindow WmTestScreen::GetWindowAtScreenPoint(
+ const gfx::Point& point) {
+ NOTREACHED();
+ return nullptr;
+}
+
+display::Display WmTestScreen::GetPrimaryDisplay() const {
+ return *display_list_.GetPrimaryDisplayIterator();
+}
+
+display::Display WmTestScreen::GetDisplayNearestWindow(
+ gfx::NativeView view) const {
+ NOTIMPLEMENTED();
+ return *display_list_.GetPrimaryDisplayIterator();
+}
+
+display::Display WmTestScreen::GetDisplayNearestPoint(
+ const gfx::Point& point) const {
+ return *display::FindDisplayNearestPoint(display_list_.displays(), point);
+}
+
+int WmTestScreen::GetNumDisplays() const {
+ return static_cast<int>(display_list_.displays().size());
+}
+
+std::vector<display::Display> WmTestScreen::GetAllDisplays() const {
+ return display_list_.displays();
+}
+
+display::Display WmTestScreen::GetDisplayMatching(
+ const gfx::Rect& match_rect) const {
+ const display::Display* match = display::FindDisplayWithBiggestIntersection(
+ display_list_.displays(), match_rect);
+ return match ? *match : GetPrimaryDisplay();
+}
+
+void WmTestScreen::AddObserver(display::DisplayObserver* observer) {
+ display_list_.AddObserver(observer);
+}
+
+void WmTestScreen::RemoveObserver(display::DisplayObserver* observer) {
+ display_list_.RemoveObserver(observer);
+}
+
+} // namespace wm
+} // namespace mash
« no previous file with comments | « mash/wm/test/wm_test_screen.h ('k') | ui/views/mus/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698