OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_DISPLAY_MANAGER_FORWARDING_DISPLAY_DELEGATE_H_ |
| 6 #define UI_DISPLAY_MANAGER_FORWARDING_DISPLAY_DELEGATE_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/observer_list.h" |
| 14 #include "mojo/public/cpp/bindings/binding.h" |
| 15 #include "ui/display/manager/display_manager_export.h" |
| 16 #include "ui/display/mojo/native_display_delegate.mojom.h" |
| 17 #include "ui/display/types/native_display_delegate.h" |
| 18 #include "ui/display/types/native_display_observer.h" |
| 19 |
| 20 namespace display { |
| 21 |
| 22 class DisplaySnapshotMojo; |
| 23 |
| 24 // NativeDisplayDelegate implementation that forwards calls to a real |
| 25 // NativeDisplayDelegate in another process. Only forwards the methods |
| 26 // implemented by Ozone DRM, other method won't do anything. |
| 27 class DISPLAY_MANAGER_EXPORT ForwardingDisplayDelegate |
| 28 : public NativeDisplayDelegate, |
| 29 public mojom::NativeDisplayObserver { |
| 30 public: |
| 31 ForwardingDisplayDelegate(); |
| 32 ~ForwardingDisplayDelegate() override; |
| 33 |
| 34 // Starts connection to |delegate|. |
| 35 void Connect(mojom::NativeDisplayDelegatePtr delegate); |
| 36 |
| 37 // display::NativeDisplayDelegate: |
| 38 void Initialize() override; |
| 39 void GrabServer() override; |
| 40 void UngrabServer() override; |
| 41 void TakeDisplayControl(const DisplayControlCallback& callback) override; |
| 42 void RelinquishDisplayControl( |
| 43 const DisplayControlCallback& callback) override; |
| 44 void SyncWithServer() override; |
| 45 void SetBackgroundColor(uint32_t color_argb) override; |
| 46 void ForceDPMSOn() override; |
| 47 void GetDisplays(const GetDisplaysCallback& callback) override; |
| 48 void AddMode(const DisplaySnapshot& output, const DisplayMode* mode) override; |
| 49 void Configure(const DisplaySnapshot& output, |
| 50 const DisplayMode* mode, |
| 51 const gfx::Point& origin, |
| 52 const ConfigureCallback& callback) override; |
| 53 void CreateFrameBuffer(const gfx::Size& size) override; |
| 54 void GetHDCPState(const DisplaySnapshot& output, |
| 55 const GetHDCPStateCallback& callback) override; |
| 56 void SetHDCPState(const DisplaySnapshot& output, |
| 57 HDCPState state, |
| 58 const SetHDCPStateCallback& callback) override; |
| 59 std::vector<ColorCalibrationProfile> GetAvailableColorCalibrationProfiles( |
| 60 const DisplaySnapshot& output) override; |
| 61 bool SetColorCalibrationProfile(const DisplaySnapshot& output, |
| 62 ColorCalibrationProfile new_profile) override; |
| 63 bool SetColorCorrection(const DisplaySnapshot& output, |
| 64 const std::vector<GammaRampRGBEntry>& degamma_lut, |
| 65 const std::vector<GammaRampRGBEntry>& gamma_lut, |
| 66 const std::vector<float>& correction_matrix) override; |
| 67 void AddObserver(display::NativeDisplayObserver* observer) override; |
| 68 void RemoveObserver(display::NativeDisplayObserver* observer) override; |
| 69 FakeDisplayController* GetFakeDisplayController() override; |
| 70 |
| 71 // display::mojom::NativeDisplayObserver: |
| 72 void OnConfigurationChanged() override; |
| 73 |
| 74 private: |
| 75 // Stores display snapshots and forards them to |callback|. |
| 76 void StoreAndForwardDisplays( |
| 77 const GetDisplaysCallback& callback, |
| 78 std::vector<std::unique_ptr<DisplaySnapshotMojo>> snapshots); |
| 79 |
| 80 mojom::NativeDisplayDelegatePtr delegate_; |
| 81 mojo::Binding<mojom::NativeDisplayObserver> binding_; |
| 82 |
| 83 // Display snapshots are owned here. |
| 84 std::vector<std::unique_ptr<DisplaySnapshotMojo>> snapshots_; |
| 85 |
| 86 base::ObserverList<display::NativeDisplayObserver> observers_; |
| 87 |
| 88 base::WeakPtrFactory<ForwardingDisplayDelegate> weak_ptr_factory_; |
| 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(ForwardingDisplayDelegate); |
| 91 }; |
| 92 |
| 93 } // namespace display |
| 94 |
| 95 #endif // UI_DISPLAY_MANAGER_FORWARDING_DISPLAY_DELEGATE_H_ |
OLD | NEW |