| 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" | 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/platform_screen.h" |
| 19 #include "services/ui/public/interfaces/display/display_controller.mojom.h" | 19 #include "services/ui/public/interfaces/display/display_controller.mojom.h" |
| 20 #include "services/ui/public/interfaces/display/test_display_controller.mojom.h" |
| 20 #include "ui/display/chromeos/display_configurator.h" | 21 #include "ui/display/chromeos/display_configurator.h" |
| 21 #include "ui/display/display.h" | 22 #include "ui/display/display.h" |
| 22 #include "ui/display/types/fake_display_controller.h" | 23 #include "ui/display/types/fake_display_controller.h" |
| 23 | 24 |
| 24 namespace display { | 25 namespace display { |
| 25 | 26 |
| 26 // PlatformScreenOzone provides the necessary functionality to configure all | 27 // PlatformScreenOzone provides the necessary functionality to configure all |
| 27 // attached physical displays on the ozone platform. | 28 // attached physical displays on the ozone platform. |
| 28 class PlatformScreenOzone | 29 class PlatformScreenOzone |
| 29 : public PlatformScreen, | 30 : public PlatformScreen, |
| 30 public ui::DisplayConfigurator::Observer, | 31 public ui::DisplayConfigurator::Observer, |
| 31 public service_manager::InterfaceFactory<mojom::DisplayController>, | 32 public service_manager::InterfaceFactory<mojom::DisplayController>, |
| 32 public mojom::DisplayController { | 33 public service_manager::InterfaceFactory<mojom::TestDisplayController>, |
| 34 public mojom::DisplayController, |
| 35 public mojom::TestDisplayController { |
| 33 public: | 36 public: |
| 34 PlatformScreenOzone(); | 37 PlatformScreenOzone(); |
| 35 ~PlatformScreenOzone() override; | 38 ~PlatformScreenOzone() override; |
| 36 | 39 |
| 37 // PlatformScreen: | 40 // PlatformScreen: |
| 38 void AddInterfaces(service_manager::InterfaceRegistry* registry) override; | 41 void AddInterfaces(service_manager::InterfaceRegistry* registry) override; |
| 39 void Init(PlatformScreenDelegate* delegate) override; | 42 void Init(PlatformScreenDelegate* delegate) override; |
| 40 void RequestCloseDisplay(int64_t display_id) override; | 43 void RequestCloseDisplay(int64_t display_id) override; |
| 41 int64_t GetPrimaryDisplayId() const override; | 44 int64_t GetPrimaryDisplayId() const override; |
| 42 | 45 |
| 46 // mojom::TestDisplayController: |
| 47 void ToggleAddRemoveDisplay() override; |
| 48 |
| 43 // mojom::DisplayController: | 49 // mojom::DisplayController: |
| 44 void ToggleVirtualDisplay() override; | 50 void SwapPrimaryDisplay() override; |
| 51 void SetDisplayWorkArea(int64_t display_id, |
| 52 const gfx::Size& size, |
| 53 const gfx::Insets& insets) override; |
| 45 | 54 |
| 46 private: | 55 private: |
| 47 // TODO(kylechar): This struct is just temporary until we migrate | 56 // TODO(kylechar): This struct is just temporary until we migrate |
| 48 // DisplayManager code out of ash so it can be used here. | 57 // DisplayManager code out of ash so it can be used here. |
| 49 struct DisplayInfo { | 58 struct DisplayInfo { |
| 50 int64_t id = Display::kInvalidDisplayID; | 59 int64_t id = Display::kInvalidDisplayID; |
| 51 // The display bounds in DIP. | 60 // The display bounds in DIP. |
| 52 gfx::Rect bounds; | 61 gfx::Rect bounds; |
| 53 // Display size in DDP. | 62 // Display size in DDP. |
| 54 gfx::Size pixel_size; | 63 gfx::Size pixel_size; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void OnDisplayModeChanged( | 107 void OnDisplayModeChanged( |
| 99 const ui::DisplayConfigurator::DisplayStateList& displays) override; | 108 const ui::DisplayConfigurator::DisplayStateList& displays) override; |
| 100 void OnDisplayModeChangeFailed( | 109 void OnDisplayModeChangeFailed( |
| 101 const ui::DisplayConfigurator::DisplayStateList& displays, | 110 const ui::DisplayConfigurator::DisplayStateList& displays, |
| 102 ui::MultipleDisplayState failed_new_state) override; | 111 ui::MultipleDisplayState failed_new_state) override; |
| 103 | 112 |
| 104 // mojo::InterfaceFactory<mojom::DisplayController>: | 113 // mojo::InterfaceFactory<mojom::DisplayController>: |
| 105 void Create(const service_manager::Identity& remote_identity, | 114 void Create(const service_manager::Identity& remote_identity, |
| 106 mojom::DisplayControllerRequest request) override; | 115 mojom::DisplayControllerRequest request) override; |
| 107 | 116 |
| 117 // mojo::InterfaceFactory<mojom::TestDisplayController>: |
| 118 void Create(const service_manager::Identity& remote_identity, |
| 119 mojom::TestDisplayControllerRequest request) override; |
| 120 |
| 108 ui::DisplayConfigurator display_configurator_; | 121 ui::DisplayConfigurator display_configurator_; |
| 109 PlatformScreenDelegate* delegate_ = nullptr; | 122 PlatformScreenDelegate* delegate_ = nullptr; |
| 110 | 123 |
| 111 // If not null it provides a way to modify the display state when running off | 124 // If not null it provides a way to modify the display state when running off |
| 112 // device (eg. running mustash on Linux). | 125 // device (eg. running mustash on Linux). |
| 113 FakeDisplayController* fake_display_controller_ = nullptr; | 126 FakeDisplayController* fake_display_controller_ = nullptr; |
| 114 | 127 |
| 115 // Tracks if we've made a display configuration change and want to wait for | 128 // Tracks if we've made a display configuration change and want to wait for |
| 116 // the display configuration to update before making further changes. | 129 // the display configuration to update before making further changes. |
| 117 bool wait_for_display_config_update_ = false; | 130 bool wait_for_display_config_update_ = false; |
| 118 | 131 |
| 119 // TODO(kylechar): These values can/should be replaced by DisplayLayout. | 132 // TODO(kylechar): These values can/should be replaced by DisplayLayout. |
| 120 int64_t primary_display_id_ = display::Display::kInvalidDisplayID; | 133 int64_t primary_display_id_ = display::Display::kInvalidDisplayID; |
| 121 std::vector<DisplayInfo> cached_displays_; | 134 std::vector<DisplayInfo> cached_displays_; |
| 122 gfx::Point next_display_origin_; | 135 gfx::Point next_display_origin_; |
| 123 | 136 |
| 124 mojo::BindingSet<mojom::DisplayController> bindings_; | 137 mojo::BindingSet<mojom::DisplayController> controller_bindings_; |
| 138 mojo::BindingSet<mojom::TestDisplayController> test_bindings_; |
| 125 | 139 |
| 126 DISALLOW_COPY_AND_ASSIGN(PlatformScreenOzone); | 140 DISALLOW_COPY_AND_ASSIGN(PlatformScreenOzone); |
| 127 }; | 141 }; |
| 128 | 142 |
| 129 } // namespace display | 143 } // namespace display |
| 130 | 144 |
| 131 #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ | 145 #endif // SERVICES_UI_DISPLAY_PLATFORM_SCREEN_OZONE_H_ |
| OLD | NEW |