| 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 aura::Env::GetInstance()->GetDispatcher())->AddDispatcherForRootWindow( | 582 aura::Env::GetInstance()->GetDispatcher())->AddDispatcherForRootWindow( |
| 582 output_configurator()); | 583 output_configurator()); |
| 583 #endif // defined(OS_CHROMEOS) | 584 #endif // defined(OS_CHROMEOS) |
| 584 } | 585 } |
| 585 | 586 |
| 586 Shell::~Shell() { | 587 Shell::~Shell() { |
| 587 views::FocusManagerFactory::Install(NULL); | 588 views::FocusManagerFactory::Install(NULL); |
| 588 aura::Env::GetInstance()->cursor_manager()->set_delegate(NULL); | 589 aura::Env::GetInstance()->cursor_manager()->set_delegate(NULL); |
| 589 | 590 |
| 590 // Please keep in same order as in Init() because it's easy to miss one. | 591 // Please keep in same order as in Init() because it's easy to miss one. |
| 592 RemoveEnvEventFilter(user_activity_detector_.get()); |
| 591 RemoveEnvEventFilter(key_rewriter_filter_.get()); | 593 RemoveEnvEventFilter(key_rewriter_filter_.get()); |
| 592 RemoveEnvEventFilter(partial_screenshot_filter_.get()); | 594 RemoveEnvEventFilter(partial_screenshot_filter_.get()); |
| 593 RemoveEnvEventFilter(input_method_filter_.get()); | 595 RemoveEnvEventFilter(input_method_filter_.get()); |
| 594 RemoveEnvEventFilter(window_modality_controller_.get()); | 596 RemoveEnvEventFilter(window_modality_controller_.get()); |
| 595 RemoveEnvEventFilter(system_gesture_filter_.get()); | 597 RemoveEnvEventFilter(system_gesture_filter_.get()); |
| 596 RemoveEnvEventFilter(slow_animation_filter_.get()); | 598 RemoveEnvEventFilter(slow_animation_filter_.get()); |
| 597 #if !defined(OS_MACOSX) | 599 #if !defined(OS_MACOSX) |
| 598 RemoveEnvEventFilter(accelerator_filter_.get()); | 600 RemoveEnvEventFilter(accelerator_filter_.get()); |
| 599 #endif | 601 #endif |
| 600 if (touch_observer_hud_.get()) | 602 if (touch_observer_hud_.get()) |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 root_window_->set_focus_manager(focus_manager_.get()); | 725 root_window_->set_focus_manager(focus_manager_.get()); |
| 724 | 726 |
| 725 #if !defined(OS_MACOSX) | 727 #if !defined(OS_MACOSX) |
| 726 nested_dispatcher_controller_.reset(new NestedDispatcherController); | 728 nested_dispatcher_controller_.reset(new NestedDispatcherController); |
| 727 aura::client::SetDispatcherClient(root_window, | 729 aura::client::SetDispatcherClient(root_window, |
| 728 nested_dispatcher_controller_.get()); | 730 nested_dispatcher_controller_.get()); |
| 729 accelerator_controller_.reset(new AcceleratorController); | 731 accelerator_controller_.reset(new AcceleratorController); |
| 730 #endif | 732 #endif |
| 731 shell_context_menu_.reset(new internal::ShellContextMenu); | 733 shell_context_menu_.reset(new internal::ShellContextMenu); |
| 732 | 734 |
| 733 // KeyRewriterEventFilter must be the first one. | 735 // The order in which event filters are added is significant. |
| 734 DCHECK(!GetEnvEventFilterCount()); | 736 DCHECK(!GetEnvEventFilterCount()); |
| 737 user_activity_detector_.reset(new UserActivityDetector); |
| 738 AddEnvEventFilter(user_activity_detector_.get()); |
| 739 |
| 740 DCHECK_EQ(1U, GetEnvEventFilterCount()); |
| 735 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter); | 741 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter); |
| 736 AddEnvEventFilter(key_rewriter_filter_.get()); | 742 AddEnvEventFilter(key_rewriter_filter_.get()); |
| 737 | 743 |
| 738 // PartialScreenshotEventFilter must be the second one to capture key | 744 DCHECK_EQ(2U, GetEnvEventFilterCount()); |
| 739 // events when the taking partial screenshot UI is there. | |
| 740 DCHECK_EQ(1U, GetEnvEventFilterCount()); | |
| 741 partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter); | 745 partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter); |
| 742 AddEnvEventFilter(partial_screenshot_filter_.get()); | 746 AddEnvEventFilter(partial_screenshot_filter_.get()); |
| 743 AddShellObserver(partial_screenshot_filter_.get()); | 747 AddShellObserver(partial_screenshot_filter_.get()); |
| 744 | 748 |
| 745 // InputMethodEventFilter must be the third one. It has to be added before | 749 DCHECK_EQ(3U, GetEnvEventFilterCount()); |
| 746 // AcceleratorFilter. | |
| 747 DCHECK_EQ(2U, GetEnvEventFilterCount()); | |
| 748 input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); | 750 input_method_filter_.reset(new aura::shared::InputMethodEventFilter()); |
| 749 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window); | 751 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window); |
| 750 AddEnvEventFilter(input_method_filter_.get()); | 752 AddEnvEventFilter(input_method_filter_.get()); |
| 753 |
| 751 #if !defined(OS_MACOSX) | 754 #if !defined(OS_MACOSX) |
| 752 accelerator_filter_.reset(new internal::AcceleratorFilter); | 755 accelerator_filter_.reset(new internal::AcceleratorFilter); |
| 753 AddEnvEventFilter(accelerator_filter_.get()); | 756 AddEnvEventFilter(accelerator_filter_.get()); |
| 754 #endif | 757 #endif |
| 755 | 758 |
| 756 system_gesture_filter_.reset(new internal::SystemGestureEventFilter); | 759 system_gesture_filter_.reset(new internal::SystemGestureEventFilter); |
| 757 AddEnvEventFilter(system_gesture_filter_.get()); | 760 AddEnvEventFilter(system_gesture_filter_.get()); |
| 758 | 761 |
| 759 slow_animation_filter_.reset(new internal::SlowAnimationEventFilter); | 762 slow_animation_filter_.reset(new internal::SlowAnimationEventFilter); |
| 760 AddEnvEventFilter(slow_animation_filter_.get()); | 763 AddEnvEventFilter(slow_animation_filter_.get()); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 void Shell::SetCursor(gfx::NativeCursor cursor) { | 1079 void Shell::SetCursor(gfx::NativeCursor cursor) { |
| 1077 // TODO(oshima): set cursor to all root windows. | 1080 // TODO(oshima): set cursor to all root windows. |
| 1078 GetPrimaryRootWindow()->SetCursor(cursor); | 1081 GetPrimaryRootWindow()->SetCursor(cursor); |
| 1079 } | 1082 } |
| 1080 | 1083 |
| 1081 void Shell::ShowCursor(bool visible) { | 1084 void Shell::ShowCursor(bool visible) { |
| 1082 GetPrimaryRootWindow()->ShowCursor(visible); | 1085 GetPrimaryRootWindow()->ShowCursor(visible); |
| 1083 } | 1086 } |
| 1084 | 1087 |
| 1085 } // namespace ash | 1088 } // namespace ash |
| OLD | NEW |