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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/manager/forwarding_display_delegate.cc
diff --git a/ui/display/manager/forwarding_display_delegate.cc b/ui/display/manager/forwarding_display_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0a0813da8cab588c8d5d20957927bf6d4123447e
--- /dev/null
+++ b/ui/display/manager/forwarding_display_delegate.cc
@@ -0,0 +1,132 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/display/manager/forwarding_display_delegate.h"
+
+#include <utility>
+
+#include "base/bind.h"
+#include "ui/display/types/display_snapshot_mojo.h"
+
+namespace display {
+
+ForwardingDisplayDelegate::ForwardingDisplayDelegate(
+ mojom::NativeDisplayDelegatePtr delegate)
+ : delegate_(std::move(delegate)), binding_(this) {}
+
+ForwardingDisplayDelegate::~ForwardingDisplayDelegate() {}
+
+void ForwardingDisplayDelegate::Initialize() {
+ delegate_->Initialize(binding_.CreateInterfacePtrAndBind());
+}
+
+void ForwardingDisplayDelegate::GrabServer() {}
+
+void ForwardingDisplayDelegate::UngrabServer() {}
+
+void ForwardingDisplayDelegate::TakeDisplayControl(
+ const DisplayControlCallback& callback) {
+ delegate_->TakeDisplayControl(callback);
+}
+
+void ForwardingDisplayDelegate::RelinquishDisplayControl(
+ const DisplayControlCallback& callback) {
+ delegate_->TakeDisplayControl(callback);
+}
+
+void ForwardingDisplayDelegate::SyncWithServer() {}
+
+void ForwardingDisplayDelegate::SetBackgroundColor(uint32_t color_argb) {}
+
+void ForwardingDisplayDelegate::ForceDPMSOn() {}
+
+void ForwardingDisplayDelegate::GetDisplays(
+ const GetDisplaysCallback& callback) {
+ delegate_->GetDisplays(
+ base::Bind(&ForwardingDisplayDelegate::StoreAndForwardDisplays,
+ base::Unretained(this), callback));
+}
+
+void ForwardingDisplayDelegate::AddMode(const DisplaySnapshot& snapshot,
+ const DisplayMode* mode) {}
+
+void ForwardingDisplayDelegate::Configure(const DisplaySnapshot& snapshot,
+ const DisplayMode* mode,
+ const gfx::Point& origin,
+ const ConfigureCallback& callback) {
+ delegate_->Configure(snapshot.display_id(), mode->Clone(), origin, callback);
+}
+
+void ForwardingDisplayDelegate::CreateFrameBuffer(const gfx::Size& size) {}
+
+void ForwardingDisplayDelegate::GetHDCPState(
+ const DisplaySnapshot& snapshot,
+ const GetHDCPStateCallback& callback) {
+ delegate_->GetHDCPState(snapshot.display_id(), callback);
+}
+
+void ForwardingDisplayDelegate::SetHDCPState(
+ const DisplaySnapshot& snapshot,
+ HDCPState state,
+ const SetHDCPStateCallback& callback) {
+ delegate_->SetHDCPState(snapshot.display_id(), state, callback);
+}
+
+std::vector<ColorCalibrationProfile>
+ForwardingDisplayDelegate::GetAvailableColorCalibrationProfiles(
+ const DisplaySnapshot& output) {
+ return std::vector<ColorCalibrationProfile>();
+}
+
+bool ForwardingDisplayDelegate::SetColorCalibrationProfile(
+ const DisplaySnapshot& output,
+ ColorCalibrationProfile new_profile) {
+ return false;
+}
+
+bool ForwardingDisplayDelegate::SetColorCorrection(
+ const DisplaySnapshot& output,
+ const std::vector<GammaRampRGBEntry>& degamma_lut,
+ const std::vector<GammaRampRGBEntry>& gamma_lut,
+ const std::vector<float>& correction_matrix) {
+ delegate_->SetColorCorrection(output.display_id(), degamma_lut, gamma_lut,
+ correction_matrix);
+ // DrmNativeDisplayDelegate always returns true so this will too.
+ return true;
+}
+
+void ForwardingDisplayDelegate::AddObserver(
+ display::NativeDisplayObserver* observer) {
+ observers_.AddObserver(observer);
+}
+
+void ForwardingDisplayDelegate::RemoveObserver(
+ display::NativeDisplayObserver* observer) {
+ observers_.RemoveObserver(observer);
+}
+
+FakeDisplayController* ForwardingDisplayDelegate::GetFakeDisplayController() {
+ return nullptr;
+}
+
+void ForwardingDisplayDelegate::OnConfigurationChanged() {
+ // Forward OnConfigurationChanged received over Mojo to local observers.
+ for (auto& observer : observers_)
+ observer.OnConfigurationChanged();
+}
+
+void ForwardingDisplayDelegate::StoreAndForwardDisplays(
+ const GetDisplaysCallback& callback,
+ std::vector<std::unique_ptr<DisplaySnapshotMojo>> snapshots) {
+ for (auto& observer : observers_)
+ observer.OnDisplaySnapshotsInvalidated();
+ snapshots_ = std::move(snapshots);
+
+ std::vector<DisplaySnapshot*> snapshot_ptrs;
+ for (auto& snapshot : snapshots_)
+ snapshot_ptrs.push_back(snapshot.get());
+ callback.Run(snapshot_ptrs);
+}
+
+} // namespace display
« 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