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

Side by Side Diff: ash/display/display_controller.cc

Issue 14297013: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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::CycleDisplayMode() { 623 void DisplayController::CycleDisplayMode() {
624 if (limiter_.get()) { 624 if (limiter_) {
625 if (limiter_->IsThrottled()) 625 if (limiter_->IsThrottled())
626 return; 626 return;
627 limiter_->SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); 627 limiter_->SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs);
628 } 628 }
629 #if defined(OS_CHROMEOS) 629 #if defined(OS_CHROMEOS)
630 Shell* shell = Shell::GetInstance(); 630 Shell* shell = Shell::GetInstance();
631 internal::DisplayManager* display_manager = GetDisplayManager(); 631 internal::DisplayManager* display_manager = GetDisplayManager();
632 if (!base::chromeos::IsRunningOnChromeOS()) { 632 if (!base::chromeos::IsRunningOnChromeOS()) {
633 internal::DisplayManager::CycleDisplay(); 633 internal::DisplayManager::CycleDisplay();
634 } else if (display_manager->num_connected_displays() > 1) { 634 } else if (display_manager->num_connected_displays() > 1) {
635 chromeos::OutputState new_state = display_manager->IsMirrored() ? 635 chromeos::OutputState new_state = display_manager->IsMirrored() ?
636 chromeos::STATE_DUAL_EXTENDED : chromeos::STATE_DUAL_MIRROR; 636 chromeos::STATE_DUAL_EXTENDED : chromeos::STATE_DUAL_MIRROR;
637 internal::OutputConfiguratorAnimation* animation = 637 internal::OutputConfiguratorAnimation* animation =
638 shell->output_configurator_animation(); 638 shell->output_configurator_animation();
639 animation->StartFadeOutAnimation(base::Bind( 639 animation->StartFadeOutAnimation(base::Bind(
640 base::IgnoreResult(&chromeos::OutputConfigurator::SetDisplayMode), 640 base::IgnoreResult(&chromeos::OutputConfigurator::SetDisplayMode),
641 base::Unretained(shell->output_configurator()), 641 base::Unretained(shell->output_configurator()),
642 new_state)); 642 new_state));
643 } 643 }
644 #endif 644 #endif
645 } 645 }
646 646
647 void DisplayController::SwapPrimaryDisplay() { 647 void DisplayController::SwapPrimaryDisplay() {
648 if (limiter_.get()) { 648 if (limiter_) {
649 if (limiter_->IsThrottled()) 649 if (limiter_->IsThrottled())
650 return; 650 return;
651 limiter_->SetThrottleTimeout(kSwapDisplayThrottleTimeoutMs); 651 limiter_->SetThrottleTimeout(kSwapDisplayThrottleTimeoutMs);
652 } 652 }
653 653
654 if (Shell::GetScreen()->GetNumDisplays() > 1) { 654 if (Shell::GetScreen()->GetNumDisplays() > 1) {
655 #if defined(OS_CHROMEOS) 655 #if defined(OS_CHROMEOS)
656 internal::OutputConfiguratorAnimation* animation = 656 internal::OutputConfiguratorAnimation* animation =
657 Shell::GetInstance()->output_configurator_animation(); 657 Shell::GetInstance()->output_configurator_animation();
658 if (animation) { 658 if (animation) {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 if (bounds_in_native.Contains(point_in_native)) { 813 if (bounds_in_native.Contains(point_in_native)) {
814 gfx::Point point(point_in_native); 814 gfx::Point point(point_in_native);
815 root_window->ConvertPointFromNativeScreen(&point); 815 root_window->ConvertPointFromNativeScreen(&point);
816 root_window->MoveCursorTo(point); 816 root_window->MoveCursorTo(point);
817 break; 817 break;
818 } 818 }
819 } 819 }
820 } 820 }
821 821
822 void DisplayController::OnDisplayBoundsChanged(const gfx::Display& display) { 822 void DisplayController::OnDisplayBoundsChanged(const gfx::Display& display) {
823 if (limiter_.get()) 823 if (limiter_)
824 limiter_->SetThrottleTimeout(kAfterDisplayChangeThrottleTimeoutMs); 824 limiter_->SetThrottleTimeout(kAfterDisplayChangeThrottleTimeoutMs);
825 const internal::DisplayInfo& display_info = 825 const internal::DisplayInfo& display_info =
826 GetDisplayManager()->GetDisplayInfo(display.id()); 826 GetDisplayManager()->GetDisplayInfo(display.id());
827 DCHECK(!display_info.bounds_in_pixel().IsEmpty()); 827 DCHECK(!display_info.bounds_in_pixel().IsEmpty());
828 828
829 UpdateDisplayBoundsForLayout(); 829 UpdateDisplayBoundsForLayout();
830 aura::RootWindow* root = root_windows_[display.id()]; 830 aura::RootWindow* root = root_windows_[display.id()];
831 SetDisplayPropertiesOnHostWindow(root, display); 831 SetDisplayPropertiesOnHostWindow(root, display);
832 root->SetHostBounds(display_info.bounds_in_pixel()); 832 root->SetHostBounds(display_info.bounds_in_pixel());
833 } 833 }
834 834
835 void DisplayController::OnDisplayAdded(const gfx::Display& display) { 835 void DisplayController::OnDisplayAdded(const gfx::Display& display) {
836 if (limiter_.get()) 836 if (limiter_)
837 limiter_->SetThrottleTimeout(kAfterDisplayChangeThrottleTimeoutMs); 837 limiter_->SetThrottleTimeout(kAfterDisplayChangeThrottleTimeoutMs);
838 838
839 if (primary_root_window_for_replace_) { 839 if (primary_root_window_for_replace_) {
840 DCHECK(root_windows_.empty()); 840 DCHECK(root_windows_.empty());
841 primary_display_id = display.id(); 841 primary_display_id = display.id();
842 root_windows_[display.id()] = primary_root_window_for_replace_; 842 root_windows_[display.id()] = primary_root_window_for_replace_;
843 primary_root_window_for_replace_->SetProperty( 843 primary_root_window_for_replace_->SetProperty(
844 internal::kDisplayIdKey, display.id()); 844 internal::kDisplayIdKey, display.id());
845 primary_root_window_for_replace_ = NULL; 845 primary_root_window_for_replace_ = NULL;
846 UpdateDisplayBoundsForLayout(); 846 UpdateDisplayBoundsForLayout();
847 const internal::DisplayInfo& display_info = 847 const internal::DisplayInfo& display_info =
848 GetDisplayManager()->GetDisplayInfo(display.id()); 848 GetDisplayManager()->GetDisplayInfo(display.id());
849 root_windows_[display.id()]->SetHostBounds( 849 root_windows_[display.id()]->SetHostBounds(
850 display_info.bounds_in_pixel()); 850 display_info.bounds_in_pixel());
851 } else { 851 } else {
852 if (primary_display_id == gfx::Display::kInvalidDisplayID) 852 if (primary_display_id == gfx::Display::kInvalidDisplayID)
853 primary_display_id = display.id(); 853 primary_display_id = display.id();
854 DCHECK(!root_windows_.empty()); 854 DCHECK(!root_windows_.empty());
855 aura::RootWindow* root = AddRootWindowForDisplay(display); 855 aura::RootWindow* root = AddRootWindowForDisplay(display);
856 UpdateDisplayBoundsForLayout(); 856 UpdateDisplayBoundsForLayout();
857 Shell::GetInstance()->InitRootWindowForSecondaryDisplay(root); 857 Shell::GetInstance()->InitRootWindowForSecondaryDisplay(root);
858 } 858 }
859 } 859 }
860 860
861 void DisplayController::OnDisplayRemoved(const gfx::Display& display) { 861 void DisplayController::OnDisplayRemoved(const gfx::Display& display) {
862 if (limiter_.get()) 862 if (limiter_)
863 limiter_->SetThrottleTimeout(kAfterDisplayChangeThrottleTimeoutMs); 863 limiter_->SetThrottleTimeout(kAfterDisplayChangeThrottleTimeoutMs);
864 864
865 aura::RootWindow* root_to_delete = root_windows_[display.id()]; 865 aura::RootWindow* root_to_delete = root_windows_[display.id()];
866 DCHECK(root_to_delete) << display.ToString(); 866 DCHECK(root_to_delete) << display.ToString();
867 867
868 // Display for root window will be deleted when the Primary RootWindow 868 // Display for root window will be deleted when the Primary RootWindow
869 // is deleted by the Shell. 869 // is deleted by the Shell.
870 root_windows_.erase(display.id()); 870 root_windows_.erase(display.id());
871 871
872 // When the primary root window's display is removed, move the primary 872 // When the primary root window's display is removed, move the primary
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 } 1033 }
1034 1034
1035 void DisplayController::OnFadeOutForSwapDisplayFinished() { 1035 void DisplayController::OnFadeOutForSwapDisplayFinished() {
1036 #if defined(OS_CHROMEOS) 1036 #if defined(OS_CHROMEOS)
1037 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); 1037 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay());
1038 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); 1038 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation();
1039 #endif 1039 #endif
1040 } 1040 }
1041 1041
1042 } // namespace ash 1042 } // namespace ash
OLDNEW
« no previous file with comments | « ash/desktop_background/desktop_background_widget_controller.cc ('k') | ash/display/output_configurator_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698