Chromium Code Reviews| 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/observer_list.h" | |
| 13 #include "mojo/public/cpp/bindings/binding.h" | |
| 14 #include "ui/display/manager/display_manager_export.h" | |
| 15 #include "ui/display/mojo/native_display_delegate.mojom.h" | |
| 16 #include "ui/display/types/native_display_delegate.h" | |
| 17 #include "ui/display/types/native_display_observer.h" | |
| 18 | |
| 19 namespace display { | |
| 20 | |
| 21 class DisplaySnapshotMojo; | |
| 22 | |
| 23 // NativeDisplayDelegate implementation that forwards calls to a real | |
| 24 // NativeDisplayDelegate in another process. Only forwards the methods | |
| 25 // implemented by Ozone DRM, other method won't do anything. | |
| 26 class DISPLAY_MANAGER_EXPORT ForwardingDisplayDelegate | |
| 27 : public NativeDisplayDelegate, | |
| 28 public mojom::NativeDisplayObserver { | |
| 29 public: | |
| 30 ForwardingDisplayDelegate(mojom::NativeDisplayDelegatePtr delegate); | |
|
sky
2017/04/07 14:45:54
explicit
kylechar
2017/04/07 14:49:51
Done.
| |
| 31 ~ForwardingDisplayDelegate() override; | |
| 32 | |
| 33 // display::NativeDisplayDelegate: | |
| 34 void Initialize() override; | |
| 35 void GrabServer() override; | |
| 36 void UngrabServer() override; | |
| 37 void TakeDisplayControl(const DisplayControlCallback& callback) override; | |
| 38 void RelinquishDisplayControl( | |
| 39 const DisplayControlCallback& callback) override; | |
| 40 void SyncWithServer() override; | |
| 41 void SetBackgroundColor(uint32_t color_argb) override; | |
| 42 void ForceDPMSOn() override; | |
| 43 void GetDisplays(const GetDisplaysCallback& callback) override; | |
| 44 void AddMode(const DisplaySnapshot& output, const DisplayMode* mode) override; | |
| 45 void Configure(const DisplaySnapshot& output, | |
| 46 const DisplayMode* mode, | |
| 47 const gfx::Point& origin, | |
| 48 const ConfigureCallback& callback) override; | |
| 49 void CreateFrameBuffer(const gfx::Size& size) override; | |
| 50 void GetHDCPState(const DisplaySnapshot& output, | |
| 51 const GetHDCPStateCallback& callback) override; | |
| 52 void SetHDCPState(const DisplaySnapshot& output, | |
| 53 HDCPState state, | |
| 54 const SetHDCPStateCallback& callback) override; | |
| 55 std::vector<ColorCalibrationProfile> GetAvailableColorCalibrationProfiles( | |
| 56 const DisplaySnapshot& output) override; | |
| 57 bool SetColorCalibrationProfile(const DisplaySnapshot& output, | |
| 58 ColorCalibrationProfile new_profile) override; | |
| 59 bool SetColorCorrection(const DisplaySnapshot& output, | |
| 60 const std::vector<GammaRampRGBEntry>& degamma_lut, | |
| 61 const std::vector<GammaRampRGBEntry>& gamma_lut, | |
| 62 const std::vector<float>& correction_matrix) override; | |
| 63 void AddObserver(display::NativeDisplayObserver* observer) override; | |
| 64 void RemoveObserver(display::NativeDisplayObserver* observer) override; | |
| 65 FakeDisplayController* GetFakeDisplayController() override; | |
| 66 | |
| 67 // display::mojom::NativeDisplayObserver: | |
| 68 void OnConfigurationChanged() override; | |
| 69 | |
| 70 private: | |
| 71 // Stores display snapshots and forards them to |callback|. | |
| 72 void StoreAndForwardDisplays( | |
| 73 const GetDisplaysCallback& callback, | |
| 74 std::vector<std::unique_ptr<DisplaySnapshotMojo>> snapshots); | |
| 75 | |
| 76 mojom::NativeDisplayDelegatePtr delegate_; | |
| 77 mojo::Binding<mojom::NativeDisplayObserver> binding_; | |
| 78 | |
| 79 // Display snapshots are owned here but accessed via raw pointers elsewhere. | |
| 80 // Call OnDisplaySnapshotsInvalidated() on observers before invalidating them. | |
| 81 std::vector<std::unique_ptr<DisplaySnapshotMojo>> snapshots_; | |
| 82 | |
| 83 base::ObserverList<display::NativeDisplayObserver> observers_; | |
| 84 | |
| 85 DISALLOW_COPY_AND_ASSIGN(ForwardingDisplayDelegate); | |
| 86 }; | |
| 87 | |
| 88 } // namespace display | |
| 89 | |
| 90 #endif // UI_DISPLAY_MANAGER_FORWARDING_DISPLAY_DELEGATE_H_ | |
| OLD | NEW |