Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: ui/display/manager/forwarding_display_delegate.h

Issue 2805633004: Add Mojo NativeDisplayDelegate / NativeDisplayObserver. (Closed)
Patch Set: s/InterfaceRegistry/BinderRegistry Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/display/manager/BUILD.gn ('k') | ui/display/manager/forwarding_display_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/compiler_specific.h"
12 #include "base/macros.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 NON_EXPORTED_BASE(mojom::NativeDisplayObserver) {
30 public:
31 explicit ForwardingDisplayDelegate(mojom::NativeDisplayDelegatePtr delegate);
32 ~ForwardingDisplayDelegate() override;
33
34 // display::NativeDisplayDelegate:
35 void Initialize() override;
36 void GrabServer() override;
37 void UngrabServer() override;
38 void TakeDisplayControl(const DisplayControlCallback& callback) override;
39 void RelinquishDisplayControl(
40 const DisplayControlCallback& callback) override;
41 void SyncWithServer() override;
42 void SetBackgroundColor(uint32_t color_argb) override;
43 void ForceDPMSOn() override;
44 void GetDisplays(const GetDisplaysCallback& callback) override;
45 void AddMode(const DisplaySnapshot& output, const DisplayMode* mode) override;
46 void Configure(const DisplaySnapshot& output,
47 const DisplayMode* mode,
48 const gfx::Point& origin,
49 const ConfigureCallback& callback) override;
50 void CreateFrameBuffer(const gfx::Size& size) override;
51 void GetHDCPState(const DisplaySnapshot& output,
52 const GetHDCPStateCallback& callback) override;
53 void SetHDCPState(const DisplaySnapshot& output,
54 HDCPState state,
55 const SetHDCPStateCallback& callback) override;
56 std::vector<ColorCalibrationProfile> GetAvailableColorCalibrationProfiles(
57 const DisplaySnapshot& output) override;
58 bool SetColorCalibrationProfile(const DisplaySnapshot& output,
59 ColorCalibrationProfile new_profile) override;
60 bool SetColorCorrection(const DisplaySnapshot& output,
61 const std::vector<GammaRampRGBEntry>& degamma_lut,
62 const std::vector<GammaRampRGBEntry>& gamma_lut,
63 const std::vector<float>& correction_matrix) override;
64 void AddObserver(display::NativeDisplayObserver* observer) override;
65 void RemoveObserver(display::NativeDisplayObserver* observer) override;
66 FakeDisplayController* GetFakeDisplayController() override;
67
68 // display::mojom::NativeDisplayObserver:
69 void OnConfigurationChanged() override;
70
71 private:
72 // Stores display snapshots and forards them to |callback|.
73 void StoreAndForwardDisplays(
74 const GetDisplaysCallback& callback,
75 std::vector<std::unique_ptr<DisplaySnapshotMojo>> snapshots);
76
77 mojom::NativeDisplayDelegatePtr delegate_;
78 mojo::Binding<mojom::NativeDisplayObserver> binding_;
79
80 // Display snapshots are owned here but accessed via raw pointers elsewhere.
81 // Call OnDisplaySnapshotsInvalidated() on observers before invalidating them.
82 std::vector<std::unique_ptr<DisplaySnapshotMojo>> snapshots_;
83
84 base::ObserverList<display::NativeDisplayObserver> observers_;
85
86 DISALLOW_COPY_AND_ASSIGN(ForwardingDisplayDelegate);
87 };
88
89 } // namespace display
90
91 #endif // UI_DISPLAY_MANAGER_FORWARDING_DISPLAY_DELEGATE_H_
OLDNEW
« no previous file with comments | « ui/display/manager/BUILD.gn ('k') | ui/display/manager/forwarding_display_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698