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

Unified Diff: ui/aura/test/test_screen.cc

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix command line Created 8 years, 8 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
Index: ui/aura/test/test_screen.cc
diff --git a/ui/aura/test/test_screen.cc b/ui/aura/test/test_screen.cc
index e61db9fdcdc5ea8eb19f88072e052de29baa6297..07324870f37d4f4d2a4110ea1891cd53b9bdf242 100644
--- a/ui/aura/test/test_screen.cc
+++ b/ui/aura/test/test_screen.cc
@@ -5,6 +5,7 @@
#include "ui/aura/test/test_screen.h"
#include "base/logging.h"
+#include "ui/aura/monitor_aura.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/gfx/native_widget_types.h"
@@ -12,50 +13,51 @@
namespace aura {
TestScreen::TestScreen(aura::RootWindow* root_window)
- : root_window_(root_window) {
+ : root_window_(root_window),
+ monitor_(new MonitorAura()) {
}
TestScreen::~TestScreen() {
}
-gfx::Point TestScreen::GetCursorScreenPointImpl() {
+gfx::Point TestScreen::GetCursorScreenPoint() {
return root_window_->last_mouse_location();
}
-gfx::Rect TestScreen::GetMonitorWorkAreaNearestWindowImpl(
- gfx::NativeWindow window) {
- return GetBounds();
+gfx::NativeWindow TestScreen::GetWindowAtCursorScreenPoint() {
+ const gfx::Point point = gfx::Screen::GetCursorScreenPoint();
+ return root_window_->GetTopWindowContainingPoint(point);
}
-gfx::Rect TestScreen::GetMonitorAreaNearestWindowImpl(
- gfx::NativeWindow window) {
- return GetBounds();
+int TestScreen::GetNumMonitors() {
+ return 1;
}
-gfx::Rect TestScreen::GetMonitorWorkAreaNearestPointImpl(
- const gfx::Point& point) {
- return GetBounds();
+const gfx::Monitor* TestScreen::GetMonitorNearestWindow(
+ gfx::NativeWindow window) {
+ Update();
+ return monitor_.get();
}
-gfx::Rect TestScreen::GetMonitorAreaNearestPointImpl(const gfx::Point& point) {
- return GetBounds();
+const gfx::Monitor* TestScreen::GetMonitorNearestPoint(
+ const gfx::Point& point) {
+ Update();
+ return monitor_.get();
}
-gfx::NativeWindow TestScreen::GetWindowAtCursorScreenPointImpl() {
- const gfx::Point point = GetCursorScreenPoint();
- return root_window_->GetTopWindowContainingPoint(point);
+const gfx::Monitor* TestScreen::GetPrimaryMonitor() {
+ Update();
+ return monitor_.get();
}
-gfx::Rect TestScreen::GetBounds() {
- return gfx::Rect(root_window_->bounds().size());
+void TestScreen::AddMonitorObserver(gfx::MonitorObserver* observer) {
}
-gfx::Size TestScreen::GetPrimaryMonitorSizeImpl() {
- return GetBounds().size();
+void TestScreen::RemoveMonitorObserver(gfx::MonitorObserver* observer) {
}
-int TestScreen::GetNumMonitorsImpl() {
- return 1;
+void TestScreen::Update() {
+ monitor_->set_bounds(root_window_->bounds());
}
} // namespace aura

Powered by Google App Engine
This is Rietveld 408576698