Chromium Code Reviews| Index: chromeos/display/output_configurator.h |
| diff --git a/chromeos/display/output_configurator.h b/chromeos/display/output_configurator.h |
| index 672a989413e1b7d0279db747ce16e5448a420548..22262c227ad8de8d41393a02cf5a12f44f95c539 100644 |
| --- a/chromeos/display/output_configurator.h |
| +++ b/chromeos/display/output_configurator.h |
| @@ -6,6 +6,7 @@ |
| #define CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ |
| #include "base/basictypes.h" |
| +#include "base/callback.h" |
| #include "base/event_types.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/message_loop.h" |
| @@ -57,11 +58,34 @@ enum State { |
| // it. |
| class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher { |
| public: |
| + // AnimationDelegate is responsible for making visual effect around the change |
| + // of output configurations. Typically it makes fade-out the displays before |
| + // the transition and fade-in again after the transition finished. |
| + class AnimationDelegate { |
|
Ben Goodger (Google)
2012/07/27 17:17:07
I don't like how this is called "Animation*" since
Jun Mukai
2012/07/30 11:28:45
Agree to rename this class, but I'm afraid that wh
|
| + public: |
| + virtual ~AnimationDelegate() {} |
| + |
| + // Called when the change of display mode is scheduled. It will usually |
| + // start fading out the displays. It also has to run |callback| once |
| + // the visual effect has finished. |
| + virtual void WillDisplayModeChange(base::Closure callback) { |
| + callback.Run(); |
| + } |
| + |
| + // Called when the change of the display mode finished. It will usually |
| + // start the fading in the displays. |
| + virtual void OnDisplayModeChanged() {} |
| + }; |
| + |
| OutputConfigurator(); |
| virtual ~OutputConfigurator(); |
| State output_state() const { return output_state_; } |
| + void set_animation_delegate(AnimationDelegate* animation_delegate) { |
| + animation_delegate_.reset(animation_delegate); |
| + } |
| + |
| // Called when the user hits ctrl-F4 to request a display mode change. |
| // This method should only return false if it was called in a single-head or |
| // headless mode. |
| @@ -85,6 +109,10 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher { |
| virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
| private: |
| + // The actual task of changing display mode. Usually this is called by the |
| + // |animation_delegate_|. |
| + void SetDisplayModeInternal(State new_state); |
| + |
| // Updates |output_count_|, |output_cache_|, |mirror_supported_|, |
| // |primary_output_index_|, and |secondary_output_index_| with new data. |
| // Returns true if the update succeeded or false if it was skipped since no |
| @@ -156,6 +184,8 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher { |
| // This is used for rotating display modes. |
| State output_state_; |
| + scoped_ptr<AnimationDelegate> animation_delegate_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); |
| }; |