summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-01 06:42:51 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-01 06:42:51 +0000
commit196e945a6a0d734bd3c867a34fe5c9b0c60d0734 (patch)
tree7590bf944307a43bfd527bac99f1a02d45ec97c8 /chrome
parent9d29124d4a1fa47803ff5b371406c722b7c82507 (diff)
downloadchromium_src-196e945a6a0d734bd3c867a34fe5c9b0c60d0734.zip
chromium_src-196e945a6a0d734bd3c867a34fe5c9b0c60d0734.tar.gz
chromium_src-196e945a6a0d734bd3c867a34fe5c9b0c60d0734.tar.bz2
Add Fade-out/Fade-in animation during output-configuration change.
BUG=127493 TEST=manually checked on lumpy Review URL: https://chromiumcodereview.appspot.com/10817028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149382 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/display_options_handler.cc39
-rw-r--r--chrome/browser/ui/webui/options2/chromeos/display_options_handler.h7
2 files changed, 36 insertions, 10 deletions
diff --git a/chrome/browser/ui/webui/options2/chromeos/display_options_handler.cc b/chrome/browser/ui/webui/options2/chromeos/display_options_handler.cc
index 308175a..c106dfc 100644
--- a/chrome/browser/ui/webui/options2/chromeos/display_options_handler.cc
+++ b/chrome/browser/ui/webui/options2/chromeos/display_options_handler.cc
@@ -7,6 +7,7 @@
#include <string>
#include "ash/display/display_controller.h"
+#include "ash/display/output_configurator_animation.h"
#include "ash/shell.h"
#include "base/bind.h"
#include "base/json/json_value_converter.h"
@@ -125,6 +126,24 @@ void DisplayOptionsHandler::SendDisplayInfo() {
mirroring, displays, layout);
}
+void DisplayOptionsHandler::FadeOutForMirroringFinished(bool is_mirroring) {
+ // We use 'PRIMARY_ONLY' for non-mirroring state for now.
+ // TODO(mukai): fix this and support multiple display modes.
+ chromeos::OutputState new_state =
+ is_mirroring ? STATE_DUAL_MIRROR : STATE_DUAL_PRIMARY_ONLY;
+ ash::Shell::GetInstance()->output_configurator()->SetDisplayMode(new_state);
+ SendDisplayInfo();
+ // Not necessary to start fade-in animation. OutputConfigurator will do that.
+}
+
+void DisplayOptionsHandler::FadeOutForDisplayLayoutFinished(int layout) {
+ PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
+ pref_service->SetInteger(prefs::kSecondaryDisplayLayout, layout);
+ SendDisplayInfo();
+ ash::Shell::GetInstance()->output_configurator_animation()->
+ StartFadeInAnimation();
+}
+
void DisplayOptionsHandler::HandleDisplayInfo(
const base::ListValue* unused_args) {
SendDisplayInfo();
@@ -134,12 +153,11 @@ void DisplayOptionsHandler::HandleMirroring(const base::ListValue* args) {
DCHECK(!args->empty());
bool is_mirroring = false;
args->GetBoolean(0, &is_mirroring);
- // We use 'PRIMARY_ONLY' for non-mirroring state for now.
- // TODO(mukai): fix this and support multiple display modes.
- chromeos::OutputState new_state =
- is_mirroring ? STATE_DUAL_MIRROR : STATE_DUAL_PRIMARY_ONLY;
- ash::Shell::GetInstance()->output_configurator()->SetDisplayMode(new_state);
- SendDisplayInfo();
+ ash::Shell::GetInstance()->output_configurator_animation()->
+ StartFadeOutAnimation(base::Bind(
+ &DisplayOptionsHandler::FadeOutForMirroringFinished,
+ base::Unretained(this),
+ is_mirroring));
}
void DisplayOptionsHandler::HandleDisplayLayout(const base::ListValue* args) {
@@ -150,10 +168,11 @@ void DisplayOptionsHandler::HandleDisplayLayout(const base::ListValue* args) {
}
DCHECK_LE(DisplayController::TOP, layout);
DCHECK_GE(DisplayController::LEFT, layout);
-
- PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
- pref_service->SetInteger(prefs::kSecondaryDisplayLayout, layout);
- SendDisplayInfo();
+ ash::Shell::GetInstance()->output_configurator_animation()->
+ StartFadeOutAnimation(base::Bind(
+ &DisplayOptionsHandler::FadeOutForDisplayLayoutFinished,
+ base::Unretained(this),
+ static_cast<int>(layout)));
}
} // namespace options2
diff --git a/chrome/browser/ui/webui/options2/chromeos/display_options_handler.h b/chrome/browser/ui/webui/options2/chromeos/display_options_handler.h
index 05e438d..482610f 100644
--- a/chrome/browser/ui/webui/options2/chromeos/display_options_handler.h
+++ b/chrome/browser/ui/webui/options2/chromeos/display_options_handler.h
@@ -46,6 +46,13 @@ class DisplayOptionsHandler : public ::options2::OptionsPageUIHandler,
// Sends the current display information to the web_ui of options page.
void SendDisplayInfo();
+ // Called when the fade-out animation for mirroring status change is finished.
+ void FadeOutForMirroringFinished(bool is_mirroring);
+
+ // Called when the fade-out animation for secondary display layout change is
+ // finished.
+ void FadeOutForDisplayLayoutFinished(int layout);
+
// Handlers of JS messages.
void HandleDisplayInfo(const base::ListValue* unused_args);
void HandleMirroring(const base::ListValue* args);