| 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 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 } | 614 } |
| 615 | 615 |
| 616 DisplayLayout DisplayController::GetRegisteredDisplayLayout( | 616 DisplayLayout DisplayController::GetRegisteredDisplayLayout( |
| 617 const DisplayIdPair& pair) const { | 617 const DisplayIdPair& pair) const { |
| 618 std::map<DisplayIdPair, DisplayLayout>::const_iterator iter = | 618 std::map<DisplayIdPair, DisplayLayout>::const_iterator iter = |
| 619 paired_layouts_.find(pair); | 619 paired_layouts_.find(pair); |
| 620 return iter != paired_layouts_.end() ? iter->second : default_display_layout_; | 620 return iter != paired_layouts_.end() ? iter->second : default_display_layout_; |
| 621 } | 621 } |
| 622 | 622 |
| 623 void DisplayController::ToggleMirrorMode() { | 623 void DisplayController::ToggleMirrorMode() { |
| 624 internal::DisplayManager* display_manager = GetDisplayManager(); |
| 625 if (display_manager->num_connected_displays() <= 1) |
| 626 return; |
| 627 |
| 624 if (limiter_) { | 628 if (limiter_) { |
| 625 if (limiter_->IsThrottled()) | 629 if (limiter_->IsThrottled()) |
| 626 return; | 630 return; |
| 627 limiter_->SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); | 631 limiter_->SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); |
| 628 } | 632 } |
| 629 #if defined(OS_CHROMEOS) && defined(USE_X11) | 633 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 630 Shell* shell = Shell::GetInstance(); | 634 Shell* shell = Shell::GetInstance(); |
| 631 internal::DisplayManager* display_manager = GetDisplayManager(); | 635 internal::OutputConfiguratorAnimation* animation = |
| 632 if (display_manager->num_connected_displays() > 1) { | 636 shell->output_configurator_animation(); |
| 633 internal::OutputConfiguratorAnimation* animation = | 637 animation->StartFadeOutAnimation(base::Bind( |
| 634 shell->output_configurator_animation(); | 638 base::IgnoreResult(&internal::DisplayManager::SetMirrorMode), |
| 635 animation->StartFadeOutAnimation(base::Bind( | 639 base::Unretained(display_manager), |
| 636 base::IgnoreResult(&internal::DisplayManager::SetMirrorMode), | 640 !display_manager->IsMirrored())); |
| 637 base::Unretained(display_manager), | |
| 638 !display_manager->IsMirrored())); | |
| 639 } | |
| 640 #endif | 641 #endif |
| 641 } | 642 } |
| 642 | 643 |
| 643 void DisplayController::SwapPrimaryDisplay() { | 644 void DisplayController::SwapPrimaryDisplay() { |
| 644 if (limiter_) { | 645 if (limiter_) { |
| 645 if (limiter_->IsThrottled()) | 646 if (limiter_->IsThrottled()) |
| 646 return; | 647 return; |
| 647 limiter_->SetThrottleTimeout(kSwapDisplayThrottleTimeoutMs); | 648 limiter_->SetThrottleTimeout(kSwapDisplayThrottleTimeoutMs); |
| 648 } | 649 } |
| 649 | 650 |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 } | 1027 } |
| 1027 | 1028 |
| 1028 void DisplayController::OnFadeOutForSwapDisplayFinished() { | 1029 void DisplayController::OnFadeOutForSwapDisplayFinished() { |
| 1029 #if defined(OS_CHROMEOS) && defined(USE_X11) | 1030 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 1030 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); | 1031 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); |
| 1031 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); | 1032 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); |
| 1032 #endif | 1033 #endif |
| 1033 } | 1034 } |
| 1034 | 1035 |
| 1035 } // namespace ash | 1036 } // namespace ash |
| OLD | NEW |