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