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

Unified Diff: chrome/browser/ui/webui/options2/chromeos/display_options_handler.cc

Issue 10817028: Add Fade-out/Fade-in animation during output-configuration change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 5 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
Index: chrome/browser/ui/webui/options2/chromeos/display_options_handler.cc
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 308175a15af3e485d26654cb25afbe870961de72..c106dfc88db60e4a0f25112dca8b50af02e65d21 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
« no previous file with comments | « chrome/browser/ui/webui/options2/chromeos/display_options_handler.h ('k') | chromeos/display/output_configurator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698