OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 ASH_MUS_TEST_WM_TEST_SCREEN_H_ | 5 #ifndef UI_DISPLAY_SCREEN_BASE_H_ |
6 #define ASH_MUS_TEST_WM_TEST_SCREEN_H_ | 6 #define UI_DISPLAY_SCREEN_BASE_H_ |
7 | 7 |
| 8 #include "ui/display/display.h" |
| 9 #include "ui/display/display_export.h" |
| 10 #include "ui/display/display_list.h" |
8 #include "ui/display/screen.h" | 11 #include "ui/display/screen.h" |
9 #include "ui/views/mus/display_list.h" | |
10 | 12 |
11 namespace ash { | 13 namespace display { |
12 namespace mus { | |
13 | 14 |
14 // Screen implementation used by tests for the windowmanager. Does not talk | 15 // Simple screen implementation with a display list. |
15 // to mus. Tests must keep the list of Displays in sync manually. | 16 class DISPLAY_EXPORT ScreenBase : public display::Screen { |
16 class WmTestScreen : public display::Screen { | |
17 public: | 17 public: |
18 WmTestScreen(); | 18 ScreenBase(); |
19 ~WmTestScreen() override; | 19 ~ScreenBase() override; |
20 | 20 |
21 const views::DisplayList& display_list() const { return display_list_; } | 21 display::DisplayList* display_list() { return &display_list_; }; |
22 views::DisplayList* display_list() { return &display_list_; } | 22 |
| 23 protected: |
| 24 // Invoked when a display changed in some way, including being added. |
| 25 // If |is_primary| is true, |changed_display| is the primary display. |
| 26 void ProcessDisplayChanged(const display::Display& changed_display, |
| 27 bool is_primary); |
23 | 28 |
24 private: | 29 private: |
25 // display::Screen: | 30 // display::Screen: |
26 gfx::Point GetCursorScreenPoint() override; | 31 gfx::Point GetCursorScreenPoint() override; |
27 bool IsWindowUnderCursor(gfx::NativeWindow window) override; | 32 bool IsWindowUnderCursor(gfx::NativeWindow window) override; |
28 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; | 33 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
29 display::Display GetPrimaryDisplay() const override; | 34 display::Display GetPrimaryDisplay() const override; |
30 display::Display GetDisplayNearestWindow(gfx::NativeView view) const override; | 35 display::Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
31 display::Display GetDisplayNearestPoint( | 36 display::Display GetDisplayNearestPoint( |
32 const gfx::Point& point) const override; | 37 const gfx::Point& point) const override; |
33 int GetNumDisplays() const override; | 38 int GetNumDisplays() const override; |
34 std::vector<display::Display> GetAllDisplays() const override; | 39 std::vector<display::Display> GetAllDisplays() const override; |
35 display::Display GetDisplayMatching( | 40 display::Display GetDisplayMatching( |
36 const gfx::Rect& match_rect) const override; | 41 const gfx::Rect& match_rect) const override; |
37 void AddObserver(display::DisplayObserver* observer) override; | 42 void AddObserver(display::DisplayObserver* observer) override; |
38 void RemoveObserver(display::DisplayObserver* observer) override; | 43 void RemoveObserver(display::DisplayObserver* observer) override; |
39 | 44 |
40 views::DisplayList display_list_; | 45 display::DisplayList display_list_; |
41 | 46 |
42 DISALLOW_COPY_AND_ASSIGN(WmTestScreen); | 47 DISALLOW_COPY_AND_ASSIGN(ScreenBase); |
43 }; | 48 }; |
44 | 49 |
45 } // namespace mus | 50 } // namespace display |
46 } // namespace ash | |
47 | 51 |
48 #endif // ASH_MUS_TEST_WM_TEST_SCREEN_H_ | 52 #endif // UI_DISPLAY_SCREEN_BASE_H_ |
OLD | NEW |