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 "ash/display/display_controller.h" | 5 #include "ash/display/display_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } | 550 } |
551 | 551 |
552 void DisplayController::CycleDisplayMode() { | 552 void DisplayController::CycleDisplayMode() { |
553 if (limiter_.get()) { | 553 if (limiter_.get()) { |
554 if (limiter_->IsThrottled()) | 554 if (limiter_->IsThrottled()) |
555 return; | 555 return; |
556 limiter_->SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); | 556 limiter_->SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); |
557 } | 557 } |
558 #if defined(OS_CHROMEOS) | 558 #if defined(OS_CHROMEOS) |
559 Shell* shell = Shell::GetInstance(); | 559 Shell* shell = Shell::GetInstance(); |
| 560 internal::DisplayManager* display_manager = GetDisplayManager(); |
560 if (!base::chromeos::IsRunningOnChromeOS()) { | 561 if (!base::chromeos::IsRunningOnChromeOS()) { |
561 internal::DisplayManager::CycleDisplay(); | 562 internal::DisplayManager::CycleDisplay(); |
562 } else if (shell->output_configurator()->connected_output_count() > 1) { | 563 } else if (display_manager->num_connected_displays() > 1) { |
| 564 chromeos::OutputState new_state = display_manager->IsMirrored() ? |
| 565 chromeos::STATE_DUAL_EXTENDED : chromeos::STATE_DUAL_MIRROR; |
563 internal::OutputConfiguratorAnimation* animation = | 566 internal::OutputConfiguratorAnimation* animation = |
564 shell->output_configurator_animation(); | 567 shell->output_configurator_animation(); |
565 animation->StartFadeOutAnimation(base::Bind( | 568 animation->StartFadeOutAnimation(base::Bind( |
566 base::IgnoreResult(&chromeos::OutputConfigurator::CycleDisplayMode), | 569 base::IgnoreResult(&chromeos::OutputConfigurator::SetDisplayMode), |
567 base::Unretained(shell->output_configurator()))); | 570 base::Unretained(shell->output_configurator()), |
| 571 new_state)); |
568 } | 572 } |
569 #endif | 573 #endif |
570 } | 574 } |
571 | 575 |
572 void DisplayController::SwapPrimaryDisplay() { | 576 void DisplayController::SwapPrimaryDisplay() { |
573 if (limiter_.get()) { | 577 if (limiter_.get()) { |
574 if (limiter_->IsThrottled()) | 578 if (limiter_->IsThrottled()) |
575 return; | 579 return; |
576 limiter_->SetThrottleTimeout(kSwapDisplayThrottleTimeoutMs); | 580 limiter_->SetThrottleTimeout(kSwapDisplayThrottleTimeoutMs); |
577 } | 581 } |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 } | 876 } |
873 | 877 |
874 void DisplayController::OnFadeOutForSwapDisplayFinished() { | 878 void DisplayController::OnFadeOutForSwapDisplayFinished() { |
875 #if defined(OS_CHROMEOS) | 879 #if defined(OS_CHROMEOS) |
876 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); | 880 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); |
877 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); | 881 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); |
878 #endif | 882 #endif |
879 } | 883 } |
880 | 884 |
881 } // namespace ash | 885 } // namespace ash |
OLD | NEW |