| 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 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/accelerators/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "ash/wm/root_window_layout_manager.h" | 47 #include "ash/wm/root_window_layout_manager.h" |
| 48 #include "ash/wm/screen_dimmer.h" | 48 #include "ash/wm/screen_dimmer.h" |
| 49 #include "ash/wm/shadow_controller.h" | 49 #include "ash/wm/shadow_controller.h" |
| 50 #include "ash/wm/shelf_layout_manager.h" | 50 #include "ash/wm/shelf_layout_manager.h" |
| 51 #include "ash/wm/slow_animation_event_filter.h" | 51 #include "ash/wm/slow_animation_event_filter.h" |
| 52 #include "ash/wm/stacking_controller.h" | 52 #include "ash/wm/stacking_controller.h" |
| 53 #include "ash/wm/status_area_layout_manager.h" | 53 #include "ash/wm/status_area_layout_manager.h" |
| 54 #include "ash/wm/system_gesture_event_filter.h" | 54 #include "ash/wm/system_gesture_event_filter.h" |
| 55 #include "ash/wm/system_modal_container_layout_manager.h" | 55 #include "ash/wm/system_modal_container_layout_manager.h" |
| 56 #include "ash/wm/toplevel_window_event_filter.h" | 56 #include "ash/wm/toplevel_window_event_filter.h" |
| 57 #include "ash/wm/user_activity_detector.h" |
| 57 #include "ash/wm/video_detector.h" | 58 #include "ash/wm/video_detector.h" |
| 58 #include "ash/wm/visibility_controller.h" | 59 #include "ash/wm/visibility_controller.h" |
| 59 #include "ash/wm/window_cycle_controller.h" | 60 #include "ash/wm/window_cycle_controller.h" |
| 60 #include "ash/wm/window_modality_controller.h" | 61 #include "ash/wm/window_modality_controller.h" |
| 61 #include "ash/wm/window_util.h" | 62 #include "ash/wm/window_util.h" |
| 62 #include "ash/wm/workspace/workspace_event_filter.h" | 63 #include "ash/wm/workspace/workspace_event_filter.h" |
| 63 #include "ash/wm/workspace/workspace_layout_manager.h" | 64 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 64 #include "ash/wm/workspace/workspace_manager.h" | 65 #include "ash/wm/workspace/workspace_manager.h" |
| 65 #include "ash/wm/workspace_controller.h" | 66 #include "ash/wm/workspace_controller.h" |
| 66 #include "base/bind.h" | 67 #include "base/bind.h" |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 static_cast<aura::DispatcherLinux*>( | 569 static_cast<aura::DispatcherLinux*>( |
| 569 aura::Env::GetInstance()->GetDispatcher())->AddDispatcherForRootWindow( | 570 aura::Env::GetInstance()->GetDispatcher())->AddDispatcherForRootWindow( |
| 570 output_configurator()); | 571 output_configurator()); |
| 571 #endif // defined(OS_CHROMEOS) | 572 #endif // defined(OS_CHROMEOS) |
| 572 } | 573 } |
| 573 | 574 |
| 574 Shell::~Shell() { | 575 Shell::~Shell() { |
| 575 views::FocusManagerFactory::Install(NULL); | 576 views::FocusManagerFactory::Install(NULL); |
| 576 | 577 |
| 577 // Please keep in same order as in Init() because it's easy to miss one. | 578 // Please keep in same order as in Init() because it's easy to miss one. |
| 579 RemoveRootWindowEventFilter(user_activity_detector_.get()); |
| 578 RemoveRootWindowEventFilter(key_rewriter_filter_.get()); | 580 RemoveRootWindowEventFilter(key_rewriter_filter_.get()); |
| 579 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); | 581 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); |
| 580 RemoveRootWindowEventFilter(input_method_filter_.get()); | 582 RemoveRootWindowEventFilter(input_method_filter_.get()); |
| 581 RemoveRootWindowEventFilter(window_modality_controller_.get()); | 583 RemoveRootWindowEventFilter(window_modality_controller_.get()); |
| 582 RemoveRootWindowEventFilter(system_gesture_filter_.get()); | 584 RemoveRootWindowEventFilter(system_gesture_filter_.get()); |
| 583 RemoveRootWindowEventFilter(slow_animation_filter_.get()); | 585 RemoveRootWindowEventFilter(slow_animation_filter_.get()); |
| 584 #if !defined(OS_MACOSX) | 586 #if !defined(OS_MACOSX) |
| 585 RemoveRootWindowEventFilter(accelerator_filter_.get()); | 587 RemoveRootWindowEventFilter(accelerator_filter_.get()); |
| 586 #endif | 588 #endif |
| 587 if (touch_observer_hud_.get()) | 589 if (touch_observer_hud_.get()) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 #if !defined(OS_MACOSX) | 709 #if !defined(OS_MACOSX) |
| 708 nested_dispatcher_controller_.reset(new NestedDispatcherController); | 710 nested_dispatcher_controller_.reset(new NestedDispatcherController); |
| 709 aura::client::SetDispatcherClient(root_window, | 711 aura::client::SetDispatcherClient(root_window, |
| 710 nested_dispatcher_controller_.get()); | 712 nested_dispatcher_controller_.get()); |
| 711 accelerator_controller_.reset(new AcceleratorController); | 713 accelerator_controller_.reset(new AcceleratorController); |
| 712 #endif | 714 #endif |
| 713 shell_context_menu_.reset(new internal::ShellContextMenu); | 715 shell_context_menu_.reset(new internal::ShellContextMenu); |
| 714 // Pass ownership of the filter to the root window. | 716 // Pass ownership of the filter to the root window. |
| 715 root_window->SetEventFilter(root_filter_); | 717 root_window->SetEventFilter(root_filter_); |
| 716 | 718 |
| 717 // KeyRewriterEventFilter must be the first one. | 719 // The order in which event filters are added is significant. |
| 718 DCHECK(!GetRootWindowEventFilterCount()); | 720 DCHECK(!GetRootWindowEventFilterCount()); |
| 721 user_activity_detector_.reset(new UserActivityDetector); |
| 722 AddRootWindowEventFilter(user_activity_detector_.get()); |
| 723 |
| 724 DCHECK_EQ(1U, GetRootWindowEventFilterCount()); |
| 719 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter); | 725 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter); |
| 720 AddRootWindowEventFilter(key_rewriter_filter_.get()); | 726 AddRootWindowEventFilter(key_rewriter_filter_.get()); |
| 721 | 727 |
| 722 // PartialScreenshotEventFilter must be the second one to capture key | 728 DCHECK_EQ(2U, GetRootWindowEventFilterCount()); |
| 723 // events when the taking partial screenshot UI is there. | |
| 724 DCHECK_EQ(1U, GetRootWindowEventFilterCount()); | |
| 725 partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter); | 729 partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter); |
| 726 AddRootWindowEventFilter(partial_screenshot_filter_.get()); | 730 AddRootWindowEventFilter(partial_screenshot_filter_.get()); |
| 727 AddShellObserver(partial_screenshot_filter_.get()); | 731 AddShellObserver(partial_screenshot_filter_.get()); |
| 728 | 732 |
| 729 // InputMethodEventFilter must be the third one. It has to be added before | 733 DCHECK_EQ(3U, GetRootWindowEventFilterCount()); |
| 730 // AcceleratorFilter. | |
| 731 DCHECK_EQ(2U, GetRootWindowEventFilterCount()); | |
| 732 input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); | 734 input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); |
| 733 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window); | 735 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window); |
| 734 AddRootWindowEventFilter(input_method_filter_.get()); | 736 AddRootWindowEventFilter(input_method_filter_.get()); |
| 737 |
| 735 #if !defined(OS_MACOSX) | 738 #if !defined(OS_MACOSX) |
| 736 accelerator_filter_.reset(new internal::AcceleratorFilter); | 739 accelerator_filter_.reset(new internal::AcceleratorFilter); |
| 737 AddRootWindowEventFilter(accelerator_filter_.get()); | 740 AddRootWindowEventFilter(accelerator_filter_.get()); |
| 738 #endif | 741 #endif |
| 739 | 742 |
| 740 system_gesture_filter_.reset(new internal::SystemGestureEventFilter); | 743 system_gesture_filter_.reset(new internal::SystemGestureEventFilter); |
| 741 AddRootWindowEventFilter(system_gesture_filter_.get()); | 744 AddRootWindowEventFilter(system_gesture_filter_.get()); |
| 742 | 745 |
| 743 slow_animation_filter_.reset(new internal::SlowAnimationEventFilter); | 746 slow_animation_filter_.reset(new internal::SlowAnimationEventFilter); |
| 744 AddRootWindowEventFilter(slow_animation_filter_.get()); | 747 AddRootWindowEventFilter(slow_animation_filter_.get()); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 panel_container->SetLayoutManager(panel_layout_manager_); | 1057 panel_container->SetLayoutManager(panel_layout_manager_); |
| 1055 } | 1058 } |
| 1056 } | 1059 } |
| 1057 | 1060 |
| 1058 void Shell::DisableWorkspaceGridLayout() { | 1061 void Shell::DisableWorkspaceGridLayout() { |
| 1059 if (workspace_controller_.get()) | 1062 if (workspace_controller_.get()) |
| 1060 workspace_controller_->workspace_manager()->set_grid_size(0); | 1063 workspace_controller_->workspace_manager()->set_grid_size(0); |
| 1061 } | 1064 } |
| 1062 | 1065 |
| 1063 } // namespace ash | 1066 } // namespace ash |
| OLD | NEW |