| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_MOJO_INIT_SCREEN_MOJO_H_ | 5 #include <vector> |
| 6 #define UI_MOJO_INIT_SCREEN_MOJO_H_ | |
| 7 | 6 |
| 7 #include "base/macros.h" |
| 8 #include "ui/gfx/display.h" | 8 #include "ui/gfx/display.h" |
| 9 #include "ui/gfx/geometry/size.h" | |
| 10 #include "ui/gfx/screen.h" | 9 #include "ui/gfx/screen.h" |
| 11 | 10 |
| 12 namespace ui { | 11 namespace gfx { |
| 13 namespace mojo { | 12 namespace test { |
| 14 | 13 |
| 15 class ScreenMojo : public gfx::Screen { | 14 // A dummy implementation of gfx::Screen that contains a single gfx::Display |
| 15 // only. The contained gfx::Display can be accessed and modified via |
| 16 // TestScreen::display(). |
| 17 // |
| 18 // NOTE: Adding and removing gfx::DisplayOberver's are no-ops and observers will |
| 19 // NOT be notified ever. |
| 20 class TestScreen : public gfx::Screen { |
| 16 public: | 21 public: |
| 17 ScreenMojo(const gfx::Size& screen_size_in_pixels, float device_pixel_ratio); | 22 TestScreen(); |
| 23 ~TestScreen() override; |
| 24 |
| 25 gfx::Display* display() { return &display_; } |
| 18 | 26 |
| 19 // gfx::Screen: | 27 // gfx::Screen: |
| 20 gfx::Point GetCursorScreenPoint() override; | 28 gfx::Point GetCursorScreenPoint() override; |
| 21 gfx::NativeWindow GetWindowUnderCursor() override; | 29 gfx::NativeWindow GetWindowUnderCursor() override; |
| 22 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; | 30 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| 23 gfx::Display GetPrimaryDisplay() const override; | 31 int GetNumDisplays() const override; |
| 32 std::vector<gfx::Display> GetAllDisplays() const override; |
| 24 gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override; | 33 gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
| 25 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; | 34 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; |
| 26 int GetNumDisplays() const override; | |
| 27 std::vector<gfx::Display> GetAllDisplays() const override; | |
| 28 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; | 35 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; |
| 36 gfx::Display GetPrimaryDisplay() const override; |
| 29 void AddObserver(gfx::DisplayObserver* observer) override; | 37 void AddObserver(gfx::DisplayObserver* observer) override; |
| 30 void RemoveObserver(gfx::DisplayObserver* observer) override; | 38 void RemoveObserver(gfx::DisplayObserver* observer) override; |
| 31 | 39 |
| 32 private: | 40 private: |
| 33 const gfx::Size screen_size_in_pixels_; | 41 // The only display. |
| 34 const float device_pixel_ratio_; | |
| 35 | |
| 36 gfx::Display display_; | 42 gfx::Display display_; |
| 37 | 43 |
| 38 DISALLOW_COPY_AND_ASSIGN(ScreenMojo); | 44 DISALLOW_COPY_AND_ASSIGN(TestScreen); |
| 39 }; | 45 }; |
| 40 | 46 |
| 41 } // namespace mojo | 47 } // namespace test |
| 42 } // namespace ui | 48 } // namespace gfx |
| 43 | |
| 44 #endif // UI_MOJO_INIT_SCREEN_MOJO_H_ | |
| OLD | NEW |