OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/options/chromeos/display_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/display_options_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
| 9 #include "ash/display/display_configurator_animation.h" |
9 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
10 #include "ash/display/display_manager.h" | 11 #include "ash/display/display_manager.h" |
11 #include "ash/display/output_configurator_animation.h" | |
12 #include "ash/display/resolution_notification_controller.h" | 12 #include "ash/display/resolution_notification_controller.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "chrome/browser/chromeos/display/display_preferences.h" | 19 #include "chrome/browser/chromeos/display/display_preferences.h" |
20 #include "content/public/browser/user_metrics.h" | 20 #include "content/public/browser/user_metrics.h" |
21 #include "content/public/browser/web_ui.h" | 21 #include "content/public/browser/web_ui.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 355 |
356 void DisplayOptionsHandler::OnFadeOutForMirroringFinished(bool is_mirroring) { | 356 void DisplayOptionsHandler::OnFadeOutForMirroringFinished(bool is_mirroring) { |
357 ash::Shell::GetInstance()->display_manager()->SetMirrorMode(is_mirroring); | 357 ash::Shell::GetInstance()->display_manager()->SetMirrorMode(is_mirroring); |
358 // Not necessary to start fade-in animation. DisplayConfigurator will do that. | 358 // Not necessary to start fade-in animation. DisplayConfigurator will do that. |
359 } | 359 } |
360 | 360 |
361 void DisplayOptionsHandler::OnFadeOutForDisplayLayoutFinished( | 361 void DisplayOptionsHandler::OnFadeOutForDisplayLayoutFinished( |
362 int position, int offset) { | 362 int position, int offset) { |
363 SetCurrentDisplayLayout( | 363 SetCurrentDisplayLayout( |
364 ash::DisplayLayout::FromInts(position, offset)); | 364 ash::DisplayLayout::FromInts(position, offset)); |
365 ash::Shell::GetInstance()->output_configurator_animation()-> | 365 ash::Shell::GetInstance()->display_configurator_animation()-> |
366 StartFadeInAnimation(); | 366 StartFadeInAnimation(); |
367 } | 367 } |
368 | 368 |
369 void DisplayOptionsHandler::HandleDisplayInfo( | 369 void DisplayOptionsHandler::HandleDisplayInfo( |
370 const base::ListValue* unused_args) { | 370 const base::ListValue* unused_args) { |
371 SendAllDisplayInfo(); | 371 SendAllDisplayInfo(); |
372 } | 372 } |
373 | 373 |
374 void DisplayOptionsHandler::HandleMirroring(const base::ListValue* args) { | 374 void DisplayOptionsHandler::HandleMirroring(const base::ListValue* args) { |
375 DCHECK(!args->empty()); | 375 DCHECK(!args->empty()); |
376 content::RecordAction( | 376 content::RecordAction( |
377 base::UserMetricsAction("Options_DisplayToggleMirroring")); | 377 base::UserMetricsAction("Options_DisplayToggleMirroring")); |
378 bool is_mirroring = false; | 378 bool is_mirroring = false; |
379 args->GetBoolean(0, &is_mirroring); | 379 args->GetBoolean(0, &is_mirroring); |
380 ash::Shell::GetInstance()->output_configurator_animation()-> | 380 ash::Shell::GetInstance()->display_configurator_animation()-> |
381 StartFadeOutAnimation(base::Bind( | 381 StartFadeOutAnimation(base::Bind( |
382 &DisplayOptionsHandler::OnFadeOutForMirroringFinished, | 382 &DisplayOptionsHandler::OnFadeOutForMirroringFinished, |
383 base::Unretained(this), | 383 base::Unretained(this), |
384 is_mirroring)); | 384 is_mirroring)); |
385 } | 385 } |
386 | 386 |
387 void DisplayOptionsHandler::HandleSetPrimary(const base::ListValue* args) { | 387 void DisplayOptionsHandler::HandleSetPrimary(const base::ListValue* args) { |
388 DCHECK(!args->empty()); | 388 DCHECK(!args->empty()); |
389 int64 display_id = GetDisplayId(args); | 389 int64 display_id = GetDisplayId(args); |
390 if (display_id == gfx::Display::kInvalidDisplayID) | 390 if (display_id == gfx::Display::kInvalidDisplayID) |
391 return; | 391 return; |
392 | 392 |
393 content::RecordAction(base::UserMetricsAction("Options_DisplaySetPrimary")); | 393 content::RecordAction(base::UserMetricsAction("Options_DisplaySetPrimary")); |
394 ash::Shell::GetInstance()->display_controller()-> | 394 ash::Shell::GetInstance()->display_controller()-> |
395 SetPrimaryDisplayId(display_id); | 395 SetPrimaryDisplayId(display_id); |
396 } | 396 } |
397 | 397 |
398 void DisplayOptionsHandler::HandleDisplayLayout(const base::ListValue* args) { | 398 void DisplayOptionsHandler::HandleDisplayLayout(const base::ListValue* args) { |
399 double layout = -1; | 399 double layout = -1; |
400 double offset = -1; | 400 double offset = -1; |
401 if (!args->GetDouble(0, &layout) || !args->GetDouble(1, &offset)) { | 401 if (!args->GetDouble(0, &layout) || !args->GetDouble(1, &offset)) { |
402 LOG(ERROR) << "Invalid parameter"; | 402 LOG(ERROR) << "Invalid parameter"; |
403 SendAllDisplayInfo(); | 403 SendAllDisplayInfo(); |
404 return; | 404 return; |
405 } | 405 } |
406 DCHECK_LE(ash::DisplayLayout::TOP, layout); | 406 DCHECK_LE(ash::DisplayLayout::TOP, layout); |
407 DCHECK_GE(ash::DisplayLayout::LEFT, layout); | 407 DCHECK_GE(ash::DisplayLayout::LEFT, layout); |
408 content::RecordAction(base::UserMetricsAction("Options_DisplayRearrange")); | 408 content::RecordAction(base::UserMetricsAction("Options_DisplayRearrange")); |
409 ash::Shell::GetInstance()->output_configurator_animation()-> | 409 ash::Shell::GetInstance()->display_configurator_animation()-> |
410 StartFadeOutAnimation(base::Bind( | 410 StartFadeOutAnimation(base::Bind( |
411 &DisplayOptionsHandler::OnFadeOutForDisplayLayoutFinished, | 411 &DisplayOptionsHandler::OnFadeOutForDisplayLayoutFinished, |
412 base::Unretained(this), | 412 base::Unretained(this), |
413 static_cast<int>(layout), | 413 static_cast<int>(layout), |
414 static_cast<int>(offset))); | 414 static_cast<int>(offset))); |
415 } | 415 } |
416 | 416 |
417 void DisplayOptionsHandler::HandleSetUIScale(const base::ListValue* args) { | 417 void DisplayOptionsHandler::HandleSetUIScale(const base::ListValue* args) { |
418 DCHECK(!args->empty()); | 418 DCHECK(!args->empty()); |
419 | 419 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 return; | 532 return; |
533 } | 533 } |
534 | 534 |
535 GetDisplayManager()->SetColorCalibrationProfile( | 535 GetDisplayManager()->SetColorCalibrationProfile( |
536 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); | 536 display_id, static_cast<ui::ColorCalibrationProfile>(profile_id)); |
537 SendAllDisplayInfo(); | 537 SendAllDisplayInfo(); |
538 } | 538 } |
539 | 539 |
540 } // namespace options | 540 } // namespace options |
541 } // namespace chromeos | 541 } // namespace chromeos |
OLD | NEW |