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 #ifndef UI_AURA_TEST_TEST_SCREEN_H_ | 5 #ifndef UI_AURA_TEST_TEST_SCREEN_H_ |
6 #define UI_AURA_TEST_TEST_SCREEN_H_ | 6 #define UI_AURA_TEST_TEST_SCREEN_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "ui/aura/window_observer.h" |
| 10 #include "ui/gfx/display.h" |
9 #include "ui/gfx/screen.h" | 11 #include "ui/gfx/screen.h" |
10 | 12 |
| 13 namespace gfx { |
| 14 class Rect; |
| 15 } |
| 16 |
11 namespace aura { | 17 namespace aura { |
12 class RootWindow; | 18 class RootWindow; |
| 19 class Window; |
13 | 20 |
14 // A minimal, testing Aura implementation of gfx::Screen. | 21 // A minimal, testing Aura implementation of gfx::Screen. |
15 class TestScreen : public gfx::Screen { | 22 class TestScreen : public gfx::Screen, |
| 23 public WindowObserver { |
16 public: | 24 public: |
17 explicit TestScreen(aura::RootWindow* root_window); | 25 TestScreen(); |
18 virtual ~TestScreen(); | 26 virtual ~TestScreen(); |
19 | 27 |
| 28 RootWindow* CreateRootWindowForPrimaryDisplay(); |
| 29 |
20 protected: | 30 protected: |
| 31 // WindowObserver overrides: |
| 32 virtual void OnWindowBoundsChanged(Window* window, |
| 33 const gfx::Rect& old_bounds, |
| 34 const gfx::Rect& new_bounds) OVERRIDE; |
| 35 virtual void OnWindowDestroying(Window* window) OVERRIDE; |
| 36 |
21 // gfx::Screen overrides: | 37 // gfx::Screen overrides: |
22 virtual bool IsDIPEnabled() OVERRIDE; | 38 virtual bool IsDIPEnabled() OVERRIDE; |
23 virtual gfx::Point GetCursorScreenPoint() OVERRIDE; | 39 virtual gfx::Point GetCursorScreenPoint() OVERRIDE; |
24 virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE; | 40 virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE; |
25 virtual int GetNumDisplays() OVERRIDE; | 41 virtual int GetNumDisplays() OVERRIDE; |
26 virtual gfx::Display GetDisplayNearestWindow( | 42 virtual gfx::Display GetDisplayNearestWindow( |
27 gfx::NativeView view) const OVERRIDE; | 43 gfx::NativeView view) const OVERRIDE; |
28 virtual gfx::Display GetDisplayNearestPoint( | 44 virtual gfx::Display GetDisplayNearestPoint( |
29 const gfx::Point& point) const OVERRIDE; | 45 const gfx::Point& point) const OVERRIDE; |
30 virtual gfx::Display GetDisplayMatching( | 46 virtual gfx::Display GetDisplayMatching( |
31 const gfx::Rect& match_rect) const OVERRIDE; | 47 const gfx::Rect& match_rect) const OVERRIDE; |
32 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; | 48 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; |
| 49 virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE; |
| 50 virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE; |
33 | 51 |
34 private: | 52 private: |
35 gfx::Display GetMonitor() const; | 53 aura::RootWindow* root_window_; |
36 | 54 |
37 aura::RootWindow* root_window_; | 55 gfx::Display display_; |
38 | 56 |
39 DISALLOW_COPY_AND_ASSIGN(TestScreen); | 57 DISALLOW_COPY_AND_ASSIGN(TestScreen); |
40 }; | 58 }; |
41 | 59 |
42 } // namespace aura | 60 } // namespace aura |
43 | 61 |
44 #endif // UI_AURA_TEST_TEST_SCREEN_H_ | 62 #endif // UI_AURA_TEST_TEST_SCREEN_H_ |
OLD | NEW |