| 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" | 9 #include "ui/aura/window_observer.h" |
| 10 #include "ui/gfx/display.h" | 10 #include "ui/gfx/display.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // A minimal, testing Aura implementation of gfx::Screen. | 23 // A minimal, testing Aura implementation of gfx::Screen. |
| 24 class TestScreen : public gfx::Screen, | 24 class TestScreen : public gfx::Screen, |
| 25 public WindowObserver { | 25 public WindowObserver { |
| 26 public: | 26 public: |
| 27 // Creates a gfx::Screen of the specified size. If no size is specified, then | 27 // Creates a gfx::Screen of the specified size. If no size is specified, then |
| 28 // creates a 800x600 screen. |size| is in physical pixels. | 28 // creates a 800x600 screen. |size| is in physical pixels. |
| 29 static TestScreen* Create(const gfx::Size& size); | 29 static TestScreen* Create(const gfx::Size& size); |
| 30 // Creates a TestScreen that uses fullscreen for the display. | 30 // Creates a TestScreen that uses fullscreen for the display. |
| 31 static TestScreen* CreateFullscreen(); | 31 static TestScreen* CreateFullscreen(); |
| 32 virtual ~TestScreen(); | 32 ~TestScreen() override; |
| 33 | 33 |
| 34 WindowTreeHost* CreateHostForPrimaryDisplay(); | 34 WindowTreeHost* CreateHostForPrimaryDisplay(); |
| 35 | 35 |
| 36 void SetDeviceScaleFactor(float device_scale_fator); | 36 void SetDeviceScaleFactor(float device_scale_fator); |
| 37 void SetDisplayRotation(gfx::Display::Rotation rotation); | 37 void SetDisplayRotation(gfx::Display::Rotation rotation); |
| 38 void SetUIScale(float ui_scale); | 38 void SetUIScale(float ui_scale); |
| 39 void SetWorkAreaInsets(const gfx::Insets& insets); | 39 void SetWorkAreaInsets(const gfx::Insets& insets); |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 gfx::Transform GetRotationTransform() const; | 42 gfx::Transform GetRotationTransform() const; |
| 43 gfx::Transform GetUIScaleTransform() const; | 43 gfx::Transform GetUIScaleTransform() const; |
| 44 | 44 |
| 45 // WindowObserver overrides: | 45 // WindowObserver overrides: |
| 46 virtual void OnWindowBoundsChanged(Window* window, | 46 void OnWindowBoundsChanged(Window* window, |
| 47 const gfx::Rect& old_bounds, | 47 const gfx::Rect& old_bounds, |
| 48 const gfx::Rect& new_bounds) override; | 48 const gfx::Rect& new_bounds) override; |
| 49 virtual void OnWindowDestroying(Window* window) override; | 49 void OnWindowDestroying(Window* window) override; |
| 50 | 50 |
| 51 // gfx::Screen overrides: | 51 // gfx::Screen overrides: |
| 52 virtual gfx::Point GetCursorScreenPoint() override; | 52 gfx::Point GetCursorScreenPoint() override; |
| 53 virtual gfx::NativeWindow GetWindowUnderCursor() override; | 53 gfx::NativeWindow GetWindowUnderCursor() override; |
| 54 virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) | 54 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| 55 override; | 55 int GetNumDisplays() const override; |
| 56 virtual int GetNumDisplays() const override; | 56 std::vector<gfx::Display> GetAllDisplays() const override; |
| 57 virtual std::vector<gfx::Display> GetAllDisplays() const override; | 57 gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
| 58 virtual gfx::Display GetDisplayNearestWindow( | 58 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; |
| 59 gfx::NativeView view) const override; | 59 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; |
| 60 virtual gfx::Display GetDisplayNearestPoint( | 60 gfx::Display GetPrimaryDisplay() const override; |
| 61 const gfx::Point& point) const override; | 61 void AddObserver(gfx::DisplayObserver* observer) override; |
| 62 virtual gfx::Display GetDisplayMatching( | 62 void RemoveObserver(gfx::DisplayObserver* observer) override; |
| 63 const gfx::Rect& match_rect) const override; | |
| 64 virtual gfx::Display GetPrimaryDisplay() const override; | |
| 65 virtual void AddObserver(gfx::DisplayObserver* observer) override; | |
| 66 virtual void RemoveObserver(gfx::DisplayObserver* observer) override; | |
| 67 | 63 |
| 68 private: | 64 private: |
| 69 explicit TestScreen(const gfx::Rect& screen_bounds); | 65 explicit TestScreen(const gfx::Rect& screen_bounds); |
| 70 | 66 |
| 71 aura::WindowTreeHost* host_; | 67 aura::WindowTreeHost* host_; |
| 72 | 68 |
| 73 gfx::Display display_; | 69 gfx::Display display_; |
| 74 | 70 |
| 75 float ui_scale_; | 71 float ui_scale_; |
| 76 | 72 |
| 77 DISALLOW_COPY_AND_ASSIGN(TestScreen); | 73 DISALLOW_COPY_AND_ASSIGN(TestScreen); |
| 78 }; | 74 }; |
| 79 | 75 |
| 80 } // namespace aura | 76 } // namespace aura |
| 81 | 77 |
| 82 #endif // UI_AURA_TEST_TEST_SCREEN_H_ | 78 #endif // UI_AURA_TEST_TEST_SCREEN_H_ |
| OLD | NEW |