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 "base/macros.h" | 9 #include "base/macros.h" |
10 #include "ui/aura/window_observer.h" | 10 #include "ui/aura/window_observer.h" |
11 #include "ui/display/display.h" | 11 #include "ui/display/display.h" |
12 #include "ui/display/screen.h" | 12 #include "ui/display/screen.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 class Insets; | 15 class Insets; |
16 class Rect; | 16 class Rect; |
17 class Transform; | 17 class Transform; |
18 } | 18 } |
19 | 19 |
20 namespace aura { | 20 namespace aura { |
21 class Window; | 21 class Window; |
| 22 class WindowTreeClient; |
22 class WindowTreeHost; | 23 class WindowTreeHost; |
23 | 24 |
24 // A minimal, testing Aura implementation of display::Screen. | 25 // A minimal, testing Aura implementation of display::Screen. |
25 // TODO(bruthig): Consider extending gfx::test::TestScreen. | 26 // TODO(bruthig): Consider extending gfx::test::TestScreen. |
26 class TestScreen : public display::Screen, public WindowObserver { | 27 class TestScreen : public display::Screen, public WindowObserver { |
27 public: | 28 public: |
28 // Creates a display::Screen of the specified size. If no size is specified, | 29 // Creates a display::Screen of the specified size. If no size is specified, |
29 // then creates a 800x600 screen. |size| is in physical pixels. | 30 // then creates a 800x600 screen. |size| is in physical pixels. |
30 static TestScreen* Create(const gfx::Size& size); | 31 static TestScreen* Create(const gfx::Size& size, |
| 32 WindowTreeClient* window_tree_client = nullptr); |
31 ~TestScreen() override; | 33 ~TestScreen() override; |
32 | 34 |
33 WindowTreeHost* CreateHostForPrimaryDisplay(); | 35 WindowTreeHost* CreateHostForPrimaryDisplay(); |
34 | 36 |
35 void SetDeviceScaleFactor(float device_scale_fator); | 37 void SetDeviceScaleFactor(float device_scale_fator); |
36 void SetDisplayRotation(display::Display::Rotation rotation); | 38 void SetDisplayRotation(display::Display::Rotation rotation); |
37 void SetUIScale(float ui_scale); | 39 void SetUIScale(float ui_scale); |
38 void SetWorkAreaInsets(const gfx::Insets& insets); | 40 void SetWorkAreaInsets(const gfx::Insets& insets); |
39 | 41 |
40 // display::Screen overrides: | 42 // display::Screen overrides: |
(...skipping 17 matching lines...) Expand all Loading... |
58 std::vector<display::Display> GetAllDisplays() const override; | 60 std::vector<display::Display> GetAllDisplays() const override; |
59 display::Display GetDisplayNearestWindow(gfx::NativeView view) const override; | 61 display::Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
60 display::Display GetDisplayNearestPoint( | 62 display::Display GetDisplayNearestPoint( |
61 const gfx::Point& point) const override; | 63 const gfx::Point& point) const override; |
62 display::Display GetDisplayMatching( | 64 display::Display GetDisplayMatching( |
63 const gfx::Rect& match_rect) const override; | 65 const gfx::Rect& match_rect) const override; |
64 void AddObserver(display::DisplayObserver* observer) override; | 66 void AddObserver(display::DisplayObserver* observer) override; |
65 void RemoveObserver(display::DisplayObserver* observer) override; | 67 void RemoveObserver(display::DisplayObserver* observer) override; |
66 | 68 |
67 private: | 69 private: |
68 explicit TestScreen(const gfx::Rect& screen_bounds); | 70 TestScreen(const gfx::Rect& screen_bounds, |
| 71 WindowTreeClient* window_tree_client); |
69 | 72 |
70 aura::WindowTreeHost* host_; | 73 aura::WindowTreeHost* host_; |
71 | 74 |
72 display::Display display_; | 75 display::Display display_; |
73 | 76 |
74 float ui_scale_; | 77 float ui_scale_; |
75 | 78 |
| 79 WindowTreeClient* window_tree_client_; |
| 80 |
76 DISALLOW_COPY_AND_ASSIGN(TestScreen); | 81 DISALLOW_COPY_AND_ASSIGN(TestScreen); |
77 }; | 82 }; |
78 | 83 |
79 } // namespace aura | 84 } // namespace aura |
80 | 85 |
81 #endif // UI_AURA_TEST_TEST_SCREEN_H_ | 86 #endif // UI_AURA_TEST_TEST_SCREEN_H_ |
OLD | NEW |