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 SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ | 5 #ifndef SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ |
6 #define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ | 6 #define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "mojo/public/cpp/bindings/binding_set.h" |
| 16 #include "services/shell/public/cpp/connection.h" |
| 17 #include "services/shell/public/cpp/interface_factory.h" |
15 #include "services/ui/display/platform_screen.h" | 18 #include "services/ui/display/platform_screen.h" |
16 #include "services/ui/public/interfaces/display/display_controller.mojom.h" | 19 #include "services/ui/public/interfaces/display/display_controller.mojom.h" |
17 #include "ui/display/chromeos/display_configurator.h" | 20 #include "ui/display/chromeos/display_configurator.h" |
18 #include "ui/display/display.h" | 21 #include "ui/display/display.h" |
19 | 22 |
20 namespace display { | 23 namespace display { |
21 | 24 |
22 // PlatformScreenOzone provides the necessary functionality to configure all | 25 // PlatformScreenOzone provides the necessary functionality to configure all |
23 // attached physical displays on the ozone platform. | 26 // attached physical displays on the ozone platform. |
24 class PlatformScreenOzone : public PlatformScreen, | 27 class PlatformScreenOzone |
25 public ui::DisplayConfigurator::Observer, | 28 : public PlatformScreen, |
26 public mojom::DisplayController { | 29 public ui::DisplayConfigurator::Observer, |
| 30 public shell::InterfaceFactory<mojom::DisplayController>, |
| 31 public mojom::DisplayController { |
27 public: | 32 public: |
28 PlatformScreenOzone(); | 33 PlatformScreenOzone(); |
29 ~PlatformScreenOzone() override; | 34 ~PlatformScreenOzone() override; |
30 | 35 |
31 // PlatformScreen: | 36 // PlatformScreen: |
| 37 void AddInterfaces(shell::InterfaceRegistry* registry) override; |
32 void Init(PlatformScreenDelegate* delegate) override; | 38 void Init(PlatformScreenDelegate* delegate) override; |
33 int64_t GetPrimaryDisplayId() const override; | 39 int64_t GetPrimaryDisplayId() const override; |
34 | 40 |
35 // mojom::DisplayController: | 41 // mojom::DisplayController: |
36 void ToggleVirtualDisplay( | 42 void ToggleVirtualDisplay() override; |
37 const ToggleVirtualDisplayCallback& callback) override; | |
38 | 43 |
39 private: | 44 private: |
40 // TODO(kylechar): This struct is just temporary until we migrate | 45 // TODO(kylechar): This struct is just temporary until we migrate |
41 // DisplayManager code out of ash so it can be used here. | 46 // DisplayManager code out of ash so it can be used here. |
42 struct DisplayInfo { | 47 struct DisplayInfo { |
43 DisplayInfo(int64_t new_id, const gfx::Rect& new_bounds) | 48 DisplayInfo(int64_t new_id, const gfx::Rect& new_bounds) |
44 : id(new_id), bounds(new_bounds) {} | 49 : id(new_id), bounds(new_bounds) {} |
45 | 50 |
46 int64_t id; | 51 int64_t id; |
47 // The display bounds. | 52 // The display bounds. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // iterator if there is no display with that id. | 88 // iterator if there is no display with that id. |
84 CachedDisplayIterator GetCachedDisplayIterator(int64_t display_id); | 89 CachedDisplayIterator GetCachedDisplayIterator(int64_t display_id); |
85 | 90 |
86 // ui::DisplayConfigurator::Observer: | 91 // ui::DisplayConfigurator::Observer: |
87 void OnDisplayModeChanged( | 92 void OnDisplayModeChanged( |
88 const ui::DisplayConfigurator::DisplayStateList& displays) override; | 93 const ui::DisplayConfigurator::DisplayStateList& displays) override; |
89 void OnDisplayModeChangeFailed( | 94 void OnDisplayModeChangeFailed( |
90 const ui::DisplayConfigurator::DisplayStateList& displays, | 95 const ui::DisplayConfigurator::DisplayStateList& displays, |
91 ui::MultipleDisplayState failed_new_state) override; | 96 ui::MultipleDisplayState failed_new_state) override; |
92 | 97 |
| 98 // mojo::InterfaceFactory<mojom::DisplayController>: |
| 99 void Create(const shell::Identity& remote_identity, |
| 100 mojom::DisplayControllerRequest request) override; |
| 101 |
| 102 ui::DisplayConfigurator display_configurator_; |
93 PlatformScreenDelegate* delegate_ = nullptr; | 103 PlatformScreenDelegate* delegate_ = nullptr; |
94 ui::DisplayConfigurator display_configurator_; | |
95 | 104 |
96 // TODO(kylechar): These values can/should be replaced by DisplayLayout. | 105 // TODO(kylechar): These values can/should be replaced by DisplayLayout. |
97 int64_t primary_display_id_ = display::Display::kInvalidDisplayID; | 106 int64_t primary_display_id_ = display::Display::kInvalidDisplayID; |
98 std::vector<DisplayInfo> cached_displays_; | 107 std::vector<DisplayInfo> cached_displays_; |
99 gfx::Point next_display_origin_; | 108 gfx::Point next_display_origin_; |
100 | 109 |
| 110 mojo::BindingSet<mojom::DisplayController> bindings_; |
| 111 |
101 DISALLOW_COPY_AND_ASSIGN(PlatformScreenOzone); | 112 DISALLOW_COPY_AND_ASSIGN(PlatformScreenOzone); |
102 }; | 113 }; |
103 | 114 |
104 } // namespace display | 115 } // namespace display |
105 | 116 |
106 #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ | 117 #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ |
OLD | NEW |