OLD | NEW |
1 // Copyright 2015 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 UI_DISPLAY_TEST_TEST_SCREEN_H_ | 5 #ifndef UI_DISPLAY_ANDROID_SCREEN_ANDROID_H_ |
6 #define UI_DISPLAY_TEST_TEST_SCREEN_H_ | 6 #define UI_DISPLAY_ANDROID_SCREEN_ANDROID_H_ |
7 | 7 |
8 #include <vector> | 8 #include <map> |
9 | 9 |
| 10 #include "base/logging.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/synchronization/lock.h" |
11 #include "ui/display/display.h" | 13 #include "ui/display/display.h" |
12 #include "ui/display/screen.h" | 14 #include "ui/display/screen.h" |
| 15 #include "ui/gfx/native_widget_types.h" |
13 | 16 |
14 namespace display { | 17 namespace display { |
15 namespace test { | |
16 | 18 |
17 // A dummy implementation of display::Screen that contains a single | 19 class DISPLAY_EXPORT ScreenAndroid : public Screen { |
18 // display::Display only. The contained Display can be accessed and modified via | |
19 // TestScreen::display(). | |
20 // | |
21 // NOTE: Adding and removing display::DisplayOberver's are no-ops and observers | |
22 // will NOT be notified ever. | |
23 class TestScreen : public Screen { | |
24 public: | 20 public: |
25 TestScreen(); | 21 ScreenAndroid(); |
26 ~TestScreen() override; | 22 ~ScreenAndroid() override; |
27 | 23 |
28 Display* display() { return &display_; } | 24 gfx::Point GetCursorScreenPoint() override; |
29 | 25 |
30 // display::Screen: | |
31 gfx::Point GetCursorScreenPoint() override; | |
32 bool IsWindowUnderCursor(gfx::NativeWindow window) override; | 26 bool IsWindowUnderCursor(gfx::NativeWindow window) override; |
| 27 |
33 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; | 28 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| 29 |
| 30 Display GetPrimaryDisplay() const override; |
| 31 |
| 32 // Used to control the display properties for a specific window. |
| 33 void SetDisplayForWindow(gfx::NativeView view, const Display& display); |
| 34 |
| 35 void ClearDisplayForWindow(gfx::NativeView view); |
| 36 |
| 37 Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
| 38 |
| 39 Display GetDisplayNearestPoint(const gfx::Point& point) const override; |
| 40 |
34 int GetNumDisplays() const override; | 41 int GetNumDisplays() const override; |
| 42 |
35 std::vector<Display> GetAllDisplays() const override; | 43 std::vector<Display> GetAllDisplays() const override; |
36 Display GetDisplayNearestWindow(gfx::NativeView view) const override; | 44 |
37 Display GetDisplayNearestPoint(const gfx::Point& point) const override; | |
38 Display GetDisplayMatching(const gfx::Rect& match_rect) const override; | 45 Display GetDisplayMatching(const gfx::Rect& match_rect) const override; |
39 Display GetPrimaryDisplay() const override; | 46 |
40 void AddObserver(DisplayObserver* observer) override; | 47 void AddObserver(DisplayObserver* observer) override; |
| 48 |
41 void RemoveObserver(DisplayObserver* observer) override; | 49 void RemoveObserver(DisplayObserver* observer) override; |
42 | 50 |
43 private: | 51 private: |
44 // The only display. | 52 Display dislpay_; |
45 Display display_; | 53 std::map<gfx::NativeView, Display> vr_display_map_; |
| 54 mutable base::Lock vr_display_lock_; |
46 | 55 |
47 DISALLOW_COPY_AND_ASSIGN(TestScreen); | 56 DISALLOW_COPY_AND_ASSIGN(ScreenAndroid); |
48 }; | 57 }; |
49 | 58 |
50 } // namespace test | |
51 } // namespace display | 59 } // namespace display |
52 | 60 |
53 #endif // UI_DISPLAY_TEST_TEST_SCREEN_H_ | 61 #endif // UI_DISPLAY_ANDROID_SCREEN_ANDROID_H_ |
| 62 |
OLD | NEW |