| 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_WS_PLATFORM_SCREEN_IMPL_OZONE_H_ | 5 #ifndef SERVICES_UI_WS_PLATFORM_SCREEN_IMPL_OZONE_H_ |
| 6 #define SERVICES_UI_WS_PLATFORM_SCREEN_IMPL_OZONE_H_ | 6 #define SERVICES_UI_WS_PLATFORM_SCREEN_IMPL_OZONE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/macros.h" |
| 14 #include "services/ui/ws/platform_screen.h" | 14 #include "services/ui/ws/platform_screen.h" |
| 15 #include "ui/display/types/native_display_observer.h" | 15 #include "ui/display/chromeos/display_configurator.h" |
| 16 #include "ui/gfx/geometry/rect.h" | |
| 17 | |
| 18 namespace gfx { | |
| 19 class Rect; | |
| 20 } | |
| 21 | |
| 22 namespace ui { | |
| 23 class NativeDisplayDelegate; | |
| 24 class DisplaySnapshot; | |
| 25 } | |
| 26 | 16 |
| 27 namespace ui { | 17 namespace ui { |
| 28 namespace ws { | 18 namespace ws { |
| 29 | 19 |
| 30 // PlatformScreenImplOzone provides the necessary functionality to configure all | 20 // PlatformScreenImplOzone provides the necessary functionality to configure all |
| 31 // attached physical displays on the ozone platform. | 21 // attached physical displays on the ozone platform. |
| 32 class PlatformScreenImplOzone : public PlatformScreen, | 22 class PlatformScreenImplOzone : public PlatformScreen, |
| 33 public ui::NativeDisplayObserver { | 23 public ui::DisplayConfigurator::Observer { |
| 34 public: | 24 public: |
| 35 PlatformScreenImplOzone(); | 25 PlatformScreenImplOzone(); |
| 36 ~PlatformScreenImplOzone() override; | 26 ~PlatformScreenImplOzone() override; |
| 37 | 27 |
| 38 private: | 28 private: |
| 39 // PlatformScreen | 29 // PlatformScreen: |
| 40 void Init() override; // Must not be called until after the ozone platform is | 30 void Init() override; // Must not be called until after the ozone platform is |
| 41 // initialized. | 31 // initialized. |
| 42 void ConfigurePhysicalDisplay( | 32 void ConfigurePhysicalDisplay( |
| 43 const ConfiguredDisplayCallback& callback) override; | 33 const ConfiguredDisplayCallback& callback) override; |
| 44 | 34 |
| 45 // TODO(rjkroege): NativeDisplayObserver is misnamed as it tracks changes in | 35 // ui::DisplayConfigurator::Observer: |
| 46 // the physical "Screen". Consider renaming it to NativeScreenObserver. | 36 void OnDisplayModeChanged( |
| 47 // ui::NativeDisplayObserver: | 37 const ui::DisplayConfigurator::DisplayStateList& displays) override; |
| 48 void OnConfigurationChanged() override; | 38 void OnDisplayModeChangeFailed( |
| 39 const ui::DisplayConfigurator::DisplayStateList& displays, |
| 40 MultipleDisplayState failed_new_state) override; |
| 49 | 41 |
| 50 // Display management callback. | 42 ui::DisplayConfigurator display_configurator_; |
| 51 void OnDisplaysAquired(const ConfiguredDisplayCallback& callback, | |
| 52 const std::vector<ui::DisplaySnapshot*>& displays); | |
| 53 | 43 |
| 54 // The display subsystem calls |OnDisplayConfigured| for each display that has | 44 // Callback to called when new displays are configured. |
| 55 // been successfully configured. This in turn calls |callback_| with the | 45 ConfiguredDisplayCallback callback_; |
| 56 // identity and bounds of each physical display. | |
| 57 void OnDisplayConfigured(const ConfiguredDisplayCallback& callback, | |
| 58 int64_t id, | |
| 59 const gfx::Rect& bounds, | |
| 60 bool success); | |
| 61 | |
| 62 std::unique_ptr<ui::NativeDisplayDelegate> native_display_delegate_; | |
| 63 | |
| 64 base::WeakPtrFactory<PlatformScreenImplOzone> weak_ptr_factory_; | |
| 65 | 46 |
| 66 DISALLOW_COPY_AND_ASSIGN(PlatformScreenImplOzone); | 47 DISALLOW_COPY_AND_ASSIGN(PlatformScreenImplOzone); |
| 67 }; | 48 }; |
| 68 | 49 |
| 69 } // namespace ws | 50 } // namespace ws |
| 70 } // namespace ui | 51 } // namespace ui |
| 71 | 52 |
| 72 #endif // SERVICES_UI_WS_PLATFORM_SCREEN_IMPL_OZONE_H_ | 53 #endif // SERVICES_UI_WS_PLATFORM_SCREEN_IMPL_OZONE_H_ |
| OLD | NEW |