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/shell.h" | 5 #include "ash/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/app_list/app_list.h" | 9 #include "ash/app_list/app_list.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 // KeyRewriterEventFilter must be the first one. | 648 // KeyRewriterEventFilter must be the first one. |
649 DCHECK(!GetRootWindowEventFilterCount()); | 649 DCHECK(!GetRootWindowEventFilterCount()); |
650 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter); | 650 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter); |
651 AddRootWindowEventFilter(key_rewriter_filter_.get()); | 651 AddRootWindowEventFilter(key_rewriter_filter_.get()); |
652 | 652 |
653 // PartialScreenshotEventFilter must be the second one to capture key | 653 // PartialScreenshotEventFilter must be the second one to capture key |
654 // events when the taking partial screenshot UI is there. | 654 // events when the taking partial screenshot UI is there. |
655 DCHECK_EQ(1U, GetRootWindowEventFilterCount()); | 655 DCHECK_EQ(1U, GetRootWindowEventFilterCount()); |
656 partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter); | 656 partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter); |
657 AddRootWindowEventFilter(partial_screenshot_filter_.get()); | 657 AddRootWindowEventFilter(partial_screenshot_filter_.get()); |
| 658 AddShellObserver(partial_screenshot_filter_.get()); |
658 | 659 |
659 // Then AcceleratorFilter and InputMethodEventFilter must be added (in this | 660 // Then AcceleratorFilter and InputMethodEventFilter must be added (in this |
660 // order) since they have the second highest priority. | 661 // order) since they have the second highest priority. |
661 DCHECK_EQ(2U, GetRootWindowEventFilterCount()); | 662 DCHECK_EQ(2U, GetRootWindowEventFilterCount()); |
662 #if !defined(OS_MACOSX) | 663 #if !defined(OS_MACOSX) |
663 accelerator_filter_.reset(new internal::AcceleratorFilter); | 664 accelerator_filter_.reset(new internal::AcceleratorFilter); |
664 AddRootWindowEventFilter(accelerator_filter_.get()); | 665 AddRootWindowEventFilter(accelerator_filter_.get()); |
665 DCHECK_EQ(3U, GetRootWindowEventFilterCount()); | 666 DCHECK_EQ(3U, GetRootWindowEventFilterCount()); |
666 #endif | 667 #endif |
667 input_method_filter_.reset(new internal::InputMethodEventFilter); | 668 input_method_filter_.reset(new internal::InputMethodEventFilter); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 window_modality_controller_.reset(new internal::WindowModalityController); | 764 window_modality_controller_.reset(new internal::WindowModalityController); |
764 AddRootWindowEventFilter(window_modality_controller_.get()); | 765 AddRootWindowEventFilter(window_modality_controller_.get()); |
765 | 766 |
766 visibility_controller_.reset(new internal::VisibilityController); | 767 visibility_controller_.reset(new internal::VisibilityController); |
767 | 768 |
768 tooltip_controller_.reset(new internal::TooltipController); | 769 tooltip_controller_.reset(new internal::TooltipController); |
769 AddRootWindowEventFilter(tooltip_controller_.get()); | 770 AddRootWindowEventFilter(tooltip_controller_.get()); |
770 | 771 |
771 drag_drop_controller_.reset(new internal::DragDropController); | 772 drag_drop_controller_.reset(new internal::DragDropController); |
772 power_button_controller_.reset(new PowerButtonController); | 773 power_button_controller_.reset(new PowerButtonController); |
| 774 AddShellObserver(power_button_controller_.get()); |
773 video_detector_.reset(new VideoDetector); | 775 video_detector_.reset(new VideoDetector); |
774 window_cycle_controller_.reset(new WindowCycleController); | 776 window_cycle_controller_.reset(new WindowCycleController); |
775 monitor_controller_.reset(new internal::MonitorController); | 777 monitor_controller_.reset(new internal::MonitorController); |
776 } | 778 } |
777 | 779 |
778 aura::Window* Shell::GetContainer(int container_id) { | 780 aura::Window* Shell::GetContainer(int container_id) { |
779 return const_cast<aura::Window*>( | 781 return const_cast<aura::Window*>( |
780 const_cast<const Shell*>(this)->GetContainer(container_id)); | 782 const_cast<const Shell*>(this)->GetContainer(container_id)); |
781 } | 783 } |
782 | 784 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 const gfx::Insets& insets) { | 853 const gfx::Insets& insets) { |
852 aura::Monitor* monitor = aura::Env::GetInstance()->monitor_manager()-> | 854 aura::Monitor* monitor = aura::Env::GetInstance()->monitor_manager()-> |
853 GetMonitorNearestWindow(contains); | 855 GetMonitorNearestWindow(contains); |
854 if (monitor->work_area_insets() == insets) | 856 if (monitor->work_area_insets() == insets) |
855 return; | 857 return; |
856 monitor->set_work_area_insets(insets); | 858 monitor->set_work_area_insets(insets); |
857 FOR_EACH_OBSERVER(ShellObserver, observers_, | 859 FOR_EACH_OBSERVER(ShellObserver, observers_, |
858 OnMonitorWorkAreaInsetsChanged()); | 860 OnMonitorWorkAreaInsetsChanged()); |
859 } | 861 } |
860 | 862 |
| 863 void Shell::OnLoginStateChange(bool logged_in, bool is_guest) { |
| 864 FOR_EACH_OBSERVER(ShellObserver, observers_, |
| 865 OnLoginStateChange(logged_in, is_guest)); |
| 866 } |
| 867 |
| 868 void Shell::OnExit() { |
| 869 FOR_EACH_OBSERVER(ShellObserver, observers_, OnExit()); |
| 870 } |
| 871 |
| 872 void Shell::OnLockStateChange(bool locked) { |
| 873 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLockStateChange(locked)); |
| 874 } |
| 875 |
861 void Shell::CreateLauncher() { | 876 void Shell::CreateLauncher() { |
862 if (launcher_.get()) | 877 if (launcher_.get()) |
863 return; | 878 return; |
864 | 879 |
865 aura::Window* default_container = | 880 aura::Window* default_container = |
866 GetContainer(internal::kShellWindowId_DefaultContainer); | 881 GetContainer(internal::kShellWindowId_DefaultContainer); |
867 launcher_.reset(new Launcher(default_container)); | 882 launcher_.reset(new Launcher(default_container)); |
868 | 883 |
869 launcher_->SetFocusCycler(focus_cycler_.get()); | 884 launcher_->SetFocusCycler(focus_cycler_.get()); |
870 shelf_->SetLauncher(launcher_.get()); | 885 shelf_->SetLauncher(launcher_.get()); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 // Create desktop background widget. | 951 // Create desktop background widget. |
937 desktop_background_controller_->SetDesktopBackgroundImageMode(); | 952 desktop_background_controller_->SetDesktopBackgroundImageMode(); |
938 } | 953 } |
939 | 954 |
940 void Shell::DisableWorkspaceGridLayout() { | 955 void Shell::DisableWorkspaceGridLayout() { |
941 if (workspace_controller_.get()) | 956 if (workspace_controller_.get()) |
942 workspace_controller_->workspace_manager()->set_grid_size(0); | 957 workspace_controller_->workspace_manager()->set_grid_size(0); |
943 } | 958 } |
944 | 959 |
945 } // namespace ash | 960 } // namespace ash |
OLD | NEW |