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_SCREEN_MANAGER_OZONE_H_ |
6 #define SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ | 6 #define SERVICES_UI_DISPLAY_SCREEN_MANAGER_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" | 15 #include "mojo/public/cpp/bindings/binding_set.h" |
16 #include "services/service_manager/public/cpp/connection.h" | 16 #include "services/service_manager/public/cpp/connection.h" |
17 #include "services/service_manager/public/cpp/interface_factory.h" | 17 #include "services/service_manager/public/cpp/interface_factory.h" |
18 #include "services/ui/display/platform_screen.h" | 18 #include "services/ui/display/screen_manager.h" |
19 #include "services/ui/display/viewport_metrics.h" | 19 #include "services/ui/display/viewport_metrics.h" |
20 #include "services/ui/public/interfaces/display/display_controller.mojom.h" | 20 #include "services/ui/public/interfaces/display/display_controller.mojom.h" |
21 #include "services/ui/public/interfaces/display/test_display_controller.mojom.h" | 21 #include "services/ui/public/interfaces/display/test_display_controller.mojom.h" |
22 #include "ui/display/display.h" | 22 #include "ui/display/display.h" |
23 #include "ui/display/manager/chromeos/display_configurator.h" | 23 #include "ui/display/manager/chromeos/display_configurator.h" |
24 #include "ui/display/types/display_constants.h" | 24 #include "ui/display/types/display_constants.h" |
25 #include "ui/display/types/fake_display_controller.h" | 25 #include "ui/display/types/fake_display_controller.h" |
26 | 26 |
27 namespace display { | 27 namespace display { |
28 | 28 |
29 // PlatformScreenOzone provides the necessary functionality to configure all | 29 // ScreenManagerOzone provides the necessary functionality to configure all |
30 // attached physical displays on the ozone platform. | 30 // attached physical displays on the ozone platform. |
31 class PlatformScreenOzone | 31 class ScreenManagerOzone |
32 : public PlatformScreen, | 32 : public ScreenManager, |
33 public ui::DisplayConfigurator::Observer, | 33 public ui::DisplayConfigurator::Observer, |
34 public ui::DisplayConfigurator::StateController, | 34 public ui::DisplayConfigurator::StateController, |
35 public service_manager::InterfaceFactory<mojom::DisplayController>, | 35 public service_manager::InterfaceFactory<mojom::DisplayController>, |
36 public service_manager::InterfaceFactory<mojom::TestDisplayController>, | 36 public service_manager::InterfaceFactory<mojom::TestDisplayController>, |
37 public mojom::DisplayController, | 37 public mojom::DisplayController, |
38 public mojom::TestDisplayController { | 38 public mojom::TestDisplayController { |
39 public: | 39 public: |
40 PlatformScreenOzone(); | 40 ScreenManagerOzone(); |
41 ~PlatformScreenOzone() override; | 41 ~ScreenManagerOzone() override; |
42 | 42 |
43 // PlatformScreen: | 43 // ScreenManager: |
44 void AddInterfaces(service_manager::InterfaceRegistry* registry) override; | 44 void AddInterfaces(service_manager::InterfaceRegistry* registry) override; |
45 void Init(PlatformScreenDelegate* delegate) override; | 45 void Init(ScreenManagerDelegate* delegate) override; |
46 void RequestCloseDisplay(int64_t display_id) override; | 46 void RequestCloseDisplay(int64_t display_id) override; |
47 int64_t GetPrimaryDisplayId() const override; | 47 int64_t GetPrimaryDisplayId() const override; |
48 | 48 |
49 // mojom::TestDisplayController: | 49 // mojom::TestDisplayController: |
50 void ToggleAddRemoveDisplay() override; | 50 void ToggleAddRemoveDisplay() override; |
51 void ToggleDisplayResolution() override; | 51 void ToggleDisplayResolution() override; |
52 | 52 |
53 // mojom::DisplayController: | 53 // mojom::DisplayController: |
54 void SwapPrimaryDisplay() override; | 54 void SwapPrimaryDisplay() override; |
55 void SetDisplayWorkArea(int64_t display_id, | 55 void SetDisplayWorkArea(int64_t display_id, |
56 const gfx::Size& size, | 56 const gfx::Size& size, |
57 const gfx::Insets& insets) override; | 57 const gfx::Insets& insets) override; |
58 | 58 |
59 private: | 59 private: |
60 friend class PlatformScreenOzoneTest; | 60 friend class ScreenManagerOzoneTest; |
61 | 61 |
62 // TODO(kylechar): This struct is just temporary until we migrate | 62 // TODO(kylechar): This struct is just temporary until we migrate |
63 // DisplayManager code out of ash so it can be used here. | 63 // DisplayManager code out of ash so it can be used here. |
64 struct DisplayInfo { | 64 struct DisplayInfo { |
65 DisplayInfo(); | 65 DisplayInfo(); |
66 DisplayInfo(const DisplayInfo& other); | 66 DisplayInfo(const DisplayInfo& other); |
67 ~DisplayInfo(); | 67 ~DisplayInfo(); |
68 | 68 |
69 int64_t id = kInvalidDisplayId; | 69 int64_t id = kInvalidDisplayId; |
70 // Information about display viewport. | 70 // Information about display viewport. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 // mojo::InterfaceFactory<mojom::DisplayController>: | 134 // mojo::InterfaceFactory<mojom::DisplayController>: |
135 void Create(const service_manager::Identity& remote_identity, | 135 void Create(const service_manager::Identity& remote_identity, |
136 mojom::DisplayControllerRequest request) override; | 136 mojom::DisplayControllerRequest request) override; |
137 | 137 |
138 // mojo::InterfaceFactory<mojom::TestDisplayController>: | 138 // mojo::InterfaceFactory<mojom::TestDisplayController>: |
139 void Create(const service_manager::Identity& remote_identity, | 139 void Create(const service_manager::Identity& remote_identity, |
140 mojom::TestDisplayControllerRequest request) override; | 140 mojom::TestDisplayControllerRequest request) override; |
141 | 141 |
142 ui::DisplayConfigurator display_configurator_; | 142 ui::DisplayConfigurator display_configurator_; |
143 PlatformScreenDelegate* delegate_ = nullptr; | 143 ScreenManagerDelegate* delegate_ = nullptr; |
144 | 144 |
145 // If not null it provides a way to modify the display state when running off | 145 // If not null it provides a way to modify the display state when running off |
146 // device (eg. running mustash on Linux). | 146 // device (eg. running mustash on Linux). |
147 FakeDisplayController* fake_display_controller_ = nullptr; | 147 FakeDisplayController* fake_display_controller_ = nullptr; |
148 | 148 |
149 // Tracks if we've made a display configuration change and want to wait for | 149 // Tracks if we've made a display configuration change and want to wait for |
150 // the display configuration to update before making further changes. | 150 // the display configuration to update before making further changes. |
151 bool wait_for_display_config_update_ = false; | 151 bool wait_for_display_config_update_ = false; |
152 | 152 |
153 // TODO(kylechar): These values can/should be replaced by DisplayLayout. | 153 // TODO(kylechar): These values can/should be replaced by DisplayLayout. |
154 int64_t primary_display_id_ = display::kInvalidDisplayId; | 154 int64_t primary_display_id_ = display::kInvalidDisplayId; |
155 std::vector<DisplayInfo> cached_displays_; | 155 std::vector<DisplayInfo> cached_displays_; |
156 gfx::Point next_display_origin_; | 156 gfx::Point next_display_origin_; |
157 | 157 |
158 mojo::BindingSet<mojom::DisplayController> controller_bindings_; | 158 mojo::BindingSet<mojom::DisplayController> controller_bindings_; |
159 mojo::BindingSet<mojom::TestDisplayController> test_bindings_; | 159 mojo::BindingSet<mojom::TestDisplayController> test_bindings_; |
160 | 160 |
161 DISALLOW_COPY_AND_ASSIGN(PlatformScreenOzone); | 161 DISALLOW_COPY_AND_ASSIGN(ScreenManagerOzone); |
162 }; | 162 }; |
163 | 163 |
164 } // namespace display | 164 } // namespace display |
165 | 165 |
166 #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ | 166 #endif // SERVICES_UI_DISPLAY_SCREEN_MANAGER_OZONE_H_ |
OLD | NEW |