Chromium Code Reviews| Index: chromeos/display/output_configurator.cc |
| diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc |
| index 60013092234cbe9ba6612111b451f5159126c88e..d3ac102235217753c043ce871f1f99608c6e5f72 100644 |
| --- a/chromeos/display/output_configurator.cc |
| +++ b/chromeos/display/output_configurator.cc |
| @@ -16,6 +16,7 @@ |
| #undef Status |
| #undef RootWindow |
| +#include "base/bind.h" |
| #include "base/chromeos/chromeos_version.h" |
| #include "base/logging.h" |
| #include "base/message_pump_aurax11.h" |
| @@ -756,19 +757,13 @@ bool OutputConfigurator::SetDisplayMode(State new_state) { |
| output_state_ == STATE_SINGLE) |
| return false; |
| - Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
| - CHECK(display != NULL); |
| - XGrabServer(display); |
| - Window window = DefaultRootWindow(display); |
| - XRRScreenResources* screen = XRRGetScreenResources(display, window); |
| - CHECK(screen != NULL); |
| - |
| - UpdateCacheAndXrandrToState(display, |
| - screen, |
| - window, |
| - new_state); |
| - XRRFreeScreenResources(screen); |
| - XUngrabServer(display); |
| + if (animation_delegate_.get()) { |
| + animation_delegate_->WillDisplayModeChange( |
| + base::Bind(&OutputConfigurator::SetDisplayModeInternal, |
| + base::Unretained(this), new_state)); |
|
oshima
2012/07/26 05:27:49
what happen if the display configuration changed d
Jun Mukai
2012/07/26 09:44:03
Added the output_state_ guards for STATE_INVALID/H
|
| + } else { |
| + SetDisplayModeInternal(new_state); |
| + } |
| return true; |
| } |
| @@ -793,6 +788,27 @@ bool OutputConfigurator::Dispatch(const base::NativeEvent& event) { |
| return true; |
| } |
| +void OutputConfigurator::SetDisplayModeInternal(State new_state) { |
| + Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
| + CHECK(display != NULL); |
| + XGrabServer(display); |
| + Window window = DefaultRootWindow(display); |
| + XRRScreenResources* screen = XRRGetScreenResources(display, window); |
| + CHECK(screen != NULL); |
| + |
| + UpdateCacheAndXrandrToState(display, |
| + screen, |
| + window, |
| + new_state); |
| + XRRFreeScreenResources(screen); |
| + XUngrabServer(display); |
| + if (animation_delegate_.get()) { |
| + MessageLoop::current()->PostTask( |
| + FROM_HERE, base::Bind(&AnimationDelegate::OnDisplayModeChanged, |
| + base::Unretained(animation_delegate_.get()))); |
| + } |
| +} |
| + |
| void OutputConfigurator::CheckIsProjectingAndNotify() { |
| // Determine if there is an "internal" output and how many outputs are |
| // connected. |