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

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

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/forwarding_display_delegate.h ('k') | ui/display/mojo/BUILD.gn » ('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 #include "ui/display/manager/forwarding_display_delegate.h"
6
7 #include <utility>
8
9 #include "base/bind.h"
10 #include "ui/display/types/display_snapshot_mojo.h"
11
12 namespace display {
13
14 ForwardingDisplayDelegate::ForwardingDisplayDelegate(
15 mojom::NativeDisplayDelegatePtr delegate)
16 : delegate_(std::move(delegate)), binding_(this) {}
17
18 ForwardingDisplayDelegate::~ForwardingDisplayDelegate() {}
19
20 void ForwardingDisplayDelegate::Initialize() {
21 delegate_->Initialize(binding_.CreateInterfacePtrAndBind());
22 }
23
24 void ForwardingDisplayDelegate::GrabServer() {}
25
26 void ForwardingDisplayDelegate::UngrabServer() {}
27
28 void ForwardingDisplayDelegate::TakeDisplayControl(
29 const DisplayControlCallback& callback) {
30 delegate_->TakeDisplayControl(callback);
31 }
32
33 void ForwardingDisplayDelegate::RelinquishDisplayControl(
34 const DisplayControlCallback& callback) {
35 delegate_->TakeDisplayControl(callback);
36 }
37
38 void ForwardingDisplayDelegate::SyncWithServer() {}
39
40 void ForwardingDisplayDelegate::SetBackgroundColor(uint32_t color_argb) {}
41
42 void ForwardingDisplayDelegate::ForceDPMSOn() {}
43
44 void ForwardingDisplayDelegate::GetDisplays(
45 const GetDisplaysCallback& callback) {
46 delegate_->GetDisplays(
47 base::Bind(&ForwardingDisplayDelegate::StoreAndForwardDisplays,
48 base::Unretained(this), callback));
49 }
50
51 void ForwardingDisplayDelegate::AddMode(const DisplaySnapshot& snapshot,
52 const DisplayMode* mode) {}
53
54 void ForwardingDisplayDelegate::Configure(const DisplaySnapshot& snapshot,
55 const DisplayMode* mode,
56 const gfx::Point& origin,
57 const ConfigureCallback& callback) {
58 delegate_->Configure(snapshot.display_id(), mode->Clone(), origin, callback);
59 }
60
61 void ForwardingDisplayDelegate::CreateFrameBuffer(const gfx::Size& size) {}
62
63 void ForwardingDisplayDelegate::GetHDCPState(
64 const DisplaySnapshot& snapshot,
65 const GetHDCPStateCallback& callback) {
66 delegate_->GetHDCPState(snapshot.display_id(), callback);
67 }
68
69 void ForwardingDisplayDelegate::SetHDCPState(
70 const DisplaySnapshot& snapshot,
71 HDCPState state,
72 const SetHDCPStateCallback& callback) {
73 delegate_->SetHDCPState(snapshot.display_id(), state, callback);
74 }
75
76 std::vector<ColorCalibrationProfile>
77 ForwardingDisplayDelegate::GetAvailableColorCalibrationProfiles(
78 const DisplaySnapshot& output) {
79 return std::vector<ColorCalibrationProfile>();
80 }
81
82 bool ForwardingDisplayDelegate::SetColorCalibrationProfile(
83 const DisplaySnapshot& output,
84 ColorCalibrationProfile new_profile) {
85 return false;
86 }
87
88 bool ForwardingDisplayDelegate::SetColorCorrection(
89 const DisplaySnapshot& output,
90 const std::vector<GammaRampRGBEntry>& degamma_lut,
91 const std::vector<GammaRampRGBEntry>& gamma_lut,
92 const std::vector<float>& correction_matrix) {
93 delegate_->SetColorCorrection(output.display_id(), degamma_lut, gamma_lut,
94 correction_matrix);
95 // DrmNativeDisplayDelegate always returns true so this will too.
96 return true;
97 }
98
99 void ForwardingDisplayDelegate::AddObserver(
100 display::NativeDisplayObserver* observer) {
101 observers_.AddObserver(observer);
102 }
103
104 void ForwardingDisplayDelegate::RemoveObserver(
105 display::NativeDisplayObserver* observer) {
106 observers_.RemoveObserver(observer);
107 }
108
109 FakeDisplayController* ForwardingDisplayDelegate::GetFakeDisplayController() {
110 return nullptr;
111 }
112
113 void ForwardingDisplayDelegate::OnConfigurationChanged() {
114 // Forward OnConfigurationChanged received over Mojo to local observers.
115 for (auto& observer : observers_)
116 observer.OnConfigurationChanged();
117 }
118
119 void ForwardingDisplayDelegate::StoreAndForwardDisplays(
120 const GetDisplaysCallback& callback,
121 std::vector<std::unique_ptr<DisplaySnapshotMojo>> snapshots) {
122 for (auto& observer : observers_)
123 observer.OnDisplaySnapshotsInvalidated();
124 snapshots_ = std::move(snapshots);
125
126 std::vector<DisplaySnapshot*> snapshot_ptrs;
127 for (auto& snapshot : snapshots_)
128 snapshot_ptrs.push_back(snapshot.get());
129 callback.Run(snapshot_ptrs);
130 }
131
132 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/manager/forwarding_display_delegate.h ('k') | ui/display/mojo/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698