OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DISPLAY_SCREEN_ASH_H_ | 5 #ifndef ASH_DISPLAY_SCREEN_ASH_H_ |
6 #define ASH_DISPLAY_SCREEN_ASH_H_ | 6 #define ASH_DISPLAY_SCREEN_ASH_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "base/compiler_specific.h" | |
12 #include "base/macros.h" | 11 #include "base/macros.h" |
13 #include "base/observer_list.h" | |
14 #include "ui/display/display_observer.h" | |
15 #include "ui/display/screen.h" | 12 #include "ui/display/screen.h" |
16 | 13 |
| 14 namespace display { |
| 15 class DisplayObserver; |
| 16 } |
| 17 |
17 namespace gfx { | 18 namespace gfx { |
18 class Rect; | 19 class Rect; |
19 } | 20 } |
20 | 21 |
21 namespace ash { | 22 namespace ash { |
22 namespace internal { | |
23 class DisplayManager; | 23 class DisplayManager; |
24 } | |
25 | 24 |
26 // Aura implementation of display::Screen. Implemented here to avoid circular | 25 // Aura implementation of display::Screen. Implemented here to avoid circular |
27 // dependencies. | 26 // dependencies. |
28 class ASH_EXPORT ScreenAsh : public display::Screen { | 27 class ASH_EXPORT ScreenAsh : public display::Screen { |
29 public: | 28 public: |
30 ScreenAsh(); | 29 ScreenAsh(); |
31 ~ScreenAsh() override; | 30 ~ScreenAsh() override; |
32 | 31 |
33 // display::Screen overrides: | 32 // display::Screen overrides: |
34 gfx::Point GetCursorScreenPoint() override; | 33 gfx::Point GetCursorScreenPoint() override; |
35 bool IsWindowUnderCursor(gfx::NativeWindow window) override; | 34 bool IsWindowUnderCursor(gfx::NativeWindow window) override; |
36 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; | 35 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
37 int GetNumDisplays() const override; | 36 int GetNumDisplays() const override; |
38 std::vector<display::Display> GetAllDisplays() const override; | 37 std::vector<display::Display> GetAllDisplays() const override; |
39 display::Display GetDisplayNearestWindow(gfx::NativeView view) const override; | 38 display::Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
40 display::Display GetDisplayNearestPoint( | 39 display::Display GetDisplayNearestPoint( |
41 const gfx::Point& point) const override; | 40 const gfx::Point& point) const override; |
42 display::Display GetDisplayMatching( | 41 display::Display GetDisplayMatching( |
43 const gfx::Rect& match_rect) const override; | 42 const gfx::Rect& match_rect) const override; |
44 display::Display GetPrimaryDisplay() const override; | 43 display::Display GetPrimaryDisplay() const override; |
45 void AddObserver(display::DisplayObserver* observer) override; | 44 void AddObserver(display::DisplayObserver* observer) override; |
46 void RemoveObserver(display::DisplayObserver* observer) override; | 45 void RemoveObserver(display::DisplayObserver* observer) override; |
47 | 46 |
| 47 // CreateDisplayManager with a ScreenAsh instance. |
| 48 static DisplayManager* CreateDisplayManager(); |
| 49 |
| 50 // Create a screen instance to be used during shutdown. |
| 51 static void CreateScreenForShutdown(); |
| 52 |
48 private: | 53 private: |
49 friend class DisplayManager; | |
50 | |
51 // Notifies observers of display configuration changes. | |
52 void NotifyMetricsChanged(const display::Display& display, uint32_t metrics); | |
53 void NotifyDisplayAdded(const display::Display& display); | |
54 void NotifyDisplayRemoved(const display::Display& display); | |
55 | |
56 // Creates a screen that can be used during shutdown. | |
57 // It simply has a copy of the displays. | |
58 display::Screen* CloneForShutdown(); | |
59 | |
60 base::ObserverList<display::DisplayObserver> observers_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(ScreenAsh); | 54 DISALLOW_COPY_AND_ASSIGN(ScreenAsh); |
63 }; | 55 }; |
64 | 56 |
65 } // namespace ash | 57 } // namespace ash |
66 | 58 |
67 #endif // ASH_DISPLAY_SCREEN_ASH_H_ | 59 #endif // ASH_DISPLAY_SCREEN_ASH_H_ |
OLD | NEW |