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

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

Issue 11363124: Move DisplayManager and DisplayChangeObserverX11 from aura to ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix rebase Created 8 years, 1 month 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 | « ui/aura/test/test_screen.h ('k') | ui/gfx/display_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/test_screen.cc
diff --git a/ui/aura/test/test_screen.cc b/ui/aura/test/test_screen.cc
index 8aa41663fc2429c90dedd324e47ed496a7baf8e2..b80b73f19df64a7f5d3683bcb022d0f4912b184e 100644
--- a/ui/aura/test/test_screen.cc
+++ b/ui/aura/test/test_screen.cc
@@ -4,7 +4,10 @@
#include "ui/aura/test/test_screen.h"
+#include "base/command_line.h"
#include "base/logging.h"
+#include "ui/aura/aura_switches.h"
+#include "ui/aura/display_util.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
@@ -13,17 +16,43 @@
namespace aura {
-TestScreen::TestScreen(aura::RootWindow* root_window)
- : root_window_(root_window) {
+TestScreen::TestScreen() : root_window_(NULL) {
+ const std::string size_str =
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kAuraHostWindowSize);
+ display_ = aura::CreateDisplayFromSpec(size_str);
}
TestScreen::~TestScreen() {
}
+RootWindow* TestScreen::CreateRootWindowForPrimaryDisplay() {
+ DCHECK(!root_window_);
+ root_window_ = new RootWindow(RootWindow::CreateParams(display_.bounds()));
+ root_window_->AddObserver(this);
+ root_window_->Init();
+ if (UseFullscreenHostWindow())
+ root_window_->ConfineCursorToWindow();
+ return root_window_;
+}
+
bool TestScreen::IsDIPEnabled() {
return true;
}
+void TestScreen::OnWindowBoundsChanged(
+ Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) {
+ if (!UseFullscreenHostWindow()) {
+ DCHECK_EQ(root_window_, window);
+ display_.SetSize(new_bounds.size());
+ }
+}
+
+void TestScreen::OnWindowDestroying(Window* window) {
+ if (root_window_ == window)
+ root_window_ = NULL;
+}
+
gfx::Point TestScreen::GetCursorScreenPoint() {
return Env::GetInstance()->last_mouse_location();
}
@@ -39,23 +68,25 @@ int TestScreen::GetNumDisplays() {
gfx::Display TestScreen::GetDisplayNearestWindow(
gfx::NativeWindow window) const {
- return GetMonitor();
+ return display_;
}
gfx::Display TestScreen::GetDisplayNearestPoint(const gfx::Point& point) const {
- return GetMonitor();
+ return display_;
}
gfx::Display TestScreen::GetDisplayMatching(const gfx::Rect& match_rect) const {
- return GetMonitor();
+ return display_;
}
gfx::Display TestScreen::GetPrimaryDisplay() const {
- return GetMonitor();
+ return display_;
+}
+
+void TestScreen::AddObserver(gfx::DisplayObserver* observer) {
}
-gfx::Display TestScreen::GetMonitor() const {
- return gfx::Display(0, root_window_->bounds());
+void TestScreen::RemoveObserver(gfx::DisplayObserver* observer) {
}
} // namespace aura
« no previous file with comments | « ui/aura/test/test_screen.h ('k') | ui/gfx/display_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698