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

Unified Diff: ui/display/manager/forwarding_display_delegate.cc

Issue 2838613002: Allow ForwardingDelegate to have a null delegate (Closed)
Patch Set: comment 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') | no next file » | 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
index 0a0813da8cab588c8d5d20957927bf6d4123447e..bab0e798ab5b901396894fded843b3bff7c1fb0f 100644
--- a/ui/display/manager/forwarding_display_delegate.cc
+++ b/ui/display/manager/forwarding_display_delegate.cc
@@ -18,7 +18,8 @@ ForwardingDisplayDelegate::ForwardingDisplayDelegate(
ForwardingDisplayDelegate::~ForwardingDisplayDelegate() {}
void ForwardingDisplayDelegate::Initialize() {
- delegate_->Initialize(binding_.CreateInterfacePtrAndBind());
+ if (delegate_)
+ delegate_->Initialize(binding_.CreateInterfacePtrAndBind());
}
void ForwardingDisplayDelegate::GrabServer() {}
@@ -27,12 +28,14 @@ void ForwardingDisplayDelegate::UngrabServer() {}
void ForwardingDisplayDelegate::TakeDisplayControl(
const DisplayControlCallback& callback) {
- delegate_->TakeDisplayControl(callback);
+ if (delegate_)
+ delegate_->TakeDisplayControl(callback);
}
void ForwardingDisplayDelegate::RelinquishDisplayControl(
const DisplayControlCallback& callback) {
- delegate_->TakeDisplayControl(callback);
+ if (delegate_)
+ delegate_->TakeDisplayControl(callback);
}
void ForwardingDisplayDelegate::SyncWithServer() {}
@@ -43,9 +46,11 @@ void ForwardingDisplayDelegate::ForceDPMSOn() {}
void ForwardingDisplayDelegate::GetDisplays(
const GetDisplaysCallback& callback) {
- delegate_->GetDisplays(
- base::Bind(&ForwardingDisplayDelegate::StoreAndForwardDisplays,
- base::Unretained(this), callback));
+ if (delegate_) {
+ delegate_->GetDisplays(
+ base::Bind(&ForwardingDisplayDelegate::StoreAndForwardDisplays,
+ base::Unretained(this), callback));
+ }
}
void ForwardingDisplayDelegate::AddMode(const DisplaySnapshot& snapshot,
@@ -55,7 +60,9 @@ 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);
+ if (delegate_)
+ delegate_->Configure(snapshot.display_id(), mode->Clone(), origin,
+ callback);
}
void ForwardingDisplayDelegate::CreateFrameBuffer(const gfx::Size& size) {}
@@ -63,14 +70,16 @@ void ForwardingDisplayDelegate::CreateFrameBuffer(const gfx::Size& size) {}
void ForwardingDisplayDelegate::GetHDCPState(
const DisplaySnapshot& snapshot,
const GetHDCPStateCallback& callback) {
- delegate_->GetHDCPState(snapshot.display_id(), callback);
+ if (delegate_)
+ delegate_->GetHDCPState(snapshot.display_id(), callback);
}
void ForwardingDisplayDelegate::SetHDCPState(
const DisplaySnapshot& snapshot,
HDCPState state,
const SetHDCPStateCallback& callback) {
- delegate_->SetHDCPState(snapshot.display_id(), state, callback);
+ if (delegate_)
+ delegate_->SetHDCPState(snapshot.display_id(), state, callback);
}
std::vector<ColorCalibrationProfile>
@@ -90,8 +99,10 @@ bool ForwardingDisplayDelegate::SetColorCorrection(
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);
+ if (delegate_) {
+ delegate_->SetColorCorrection(output.display_id(), degamma_lut, gamma_lut,
+ correction_matrix);
+ }
// DrmNativeDisplayDelegate always returns true so this will too.
return true;
}
« no previous file with comments | « ui/display/manager/forwarding_display_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698