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 25 matching lines...) Expand all Loading... |
36 #include "ash/system/tray/tray_empty.h" | 36 #include "ash/system/tray/tray_empty.h" |
37 #include "ash/system/tray_accessibility.h" | 37 #include "ash/system/tray_accessibility.h" |
38 #include "ash/system/tray_caps_lock.h" | 38 #include "ash/system/tray_caps_lock.h" |
39 #include "ash/system/user/tray_user.h" | 39 #include "ash/system/user/tray_user.h" |
40 #include "ash/tooltips/tooltip_controller.h" | 40 #include "ash/tooltips/tooltip_controller.h" |
41 #include "ash/wm/activation_controller.h" | 41 #include "ash/wm/activation_controller.h" |
42 #include "ash/wm/base_layout_manager.h" | 42 #include "ash/wm/base_layout_manager.h" |
43 #include "ash/wm/custom_frame_view_ash.h" | 43 #include "ash/wm/custom_frame_view_ash.h" |
44 #include "ash/wm/dialog_frame_view.h" | 44 #include "ash/wm/dialog_frame_view.h" |
45 #include "ash/wm/event_client_impl.h" | 45 #include "ash/wm/event_client_impl.h" |
| 46 #include "ash/wm/key_rewriter_event_filter.h" |
46 #include "ash/wm/panel_window_event_filter.h" | 47 #include "ash/wm/panel_window_event_filter.h" |
47 #include "ash/wm/panel_layout_manager.h" | 48 #include "ash/wm/panel_layout_manager.h" |
48 #include "ash/wm/partial_screenshot_event_filter.h" | 49 #include "ash/wm/partial_screenshot_event_filter.h" |
49 #include "ash/wm/power_button_controller.h" | 50 #include "ash/wm/power_button_controller.h" |
50 #include "ash/wm/resize_shadow_controller.h" | 51 #include "ash/wm/resize_shadow_controller.h" |
51 #include "ash/wm/root_window_event_filter.h" | 52 #include "ash/wm/root_window_event_filter.h" |
52 #include "ash/wm/root_window_layout_manager.h" | 53 #include "ash/wm/root_window_layout_manager.h" |
53 #include "ash/wm/shadow_controller.h" | 54 #include "ash/wm/shadow_controller.h" |
54 #include "ash/wm/shelf_layout_manager.h" | 55 #include "ash/wm/shelf_layout_manager.h" |
55 #include "ash/wm/stacking_controller.h" | 56 #include "ash/wm/stacking_controller.h" |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 root_filter_(NULL), | 517 root_filter_(NULL), |
517 delegate_(delegate), | 518 delegate_(delegate), |
518 shelf_(NULL), | 519 shelf_(NULL), |
519 root_window_layout_(NULL), | 520 root_window_layout_(NULL), |
520 status_widget_(NULL) { | 521 status_widget_(NULL) { |
521 gfx::Screen::SetInstance(screen_); | 522 gfx::Screen::SetInstance(screen_); |
522 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get())); | 523 ui_controls::InstallUIControlsAura(CreateUIControlsAura(root_window_.get())); |
523 } | 524 } |
524 | 525 |
525 Shell::~Shell() { | 526 Shell::~Shell() { |
| 527 RemoveRootWindowEventFilter(key_rewriter_filter_.get()); |
526 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); | 528 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); |
527 RemoveRootWindowEventFilter(input_method_filter_.get()); | 529 RemoveRootWindowEventFilter(input_method_filter_.get()); |
528 RemoveRootWindowEventFilter(window_modality_controller_.get()); | 530 RemoveRootWindowEventFilter(window_modality_controller_.get()); |
529 #if !defined(OS_MACOSX) | 531 #if !defined(OS_MACOSX) |
530 RemoveRootWindowEventFilter(accelerator_filter_.get()); | 532 RemoveRootWindowEventFilter(accelerator_filter_.get()); |
531 #endif | 533 #endif |
532 | 534 |
533 // Close background widget now so that the focus manager of the | 535 // Close background widget now so that the focus manager of the |
534 // widget gets deleted in the final message loop run. | 536 // widget gets deleted in the final message loop run. |
535 root_window_layout_->SetBackgroundWidget(NULL); | 537 root_window_layout_->SetBackgroundWidget(NULL); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 void Shell::Init() { | 615 void Shell::Init() { |
614 aura::RootWindow* root_window = GetRootWindow(); | 616 aura::RootWindow* root_window = GetRootWindow(); |
615 root_filter_ = new internal::RootWindowEventFilter(root_window); | 617 root_filter_ = new internal::RootWindowEventFilter(root_window); |
616 #if !defined(OS_MACOSX) | 618 #if !defined(OS_MACOSX) |
617 nested_dispatcher_controller_.reset(new NestedDispatcherController); | 619 nested_dispatcher_controller_.reset(new NestedDispatcherController); |
618 accelerator_controller_.reset(new AcceleratorController); | 620 accelerator_controller_.reset(new AcceleratorController); |
619 #endif | 621 #endif |
620 // Pass ownership of the filter to the root window. | 622 // Pass ownership of the filter to the root window. |
621 GetRootWindow()->SetEventFilter(root_filter_); | 623 GetRootWindow()->SetEventFilter(root_filter_); |
622 | 624 |
| 625 // KeyRewriterEventFilter must be the first one. |
623 DCHECK(!GetRootWindowEventFilterCount()); | 626 DCHECK(!GetRootWindowEventFilterCount()); |
| 627 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter); |
| 628 AddRootWindowEventFilter(key_rewriter_filter_.get()); |
624 | 629 |
625 // PartialScreenshotEventFilter must be the first one to capture key | 630 // PartialScreenshotEventFilter must be the second one to capture key |
626 // events when the taking partial screenshot UI is there. | 631 // events when the taking partial screenshot UI is there. |
| 632 DCHECK_EQ(1U, GetRootWindowEventFilterCount()); |
627 partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter); | 633 partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter); |
628 AddRootWindowEventFilter(partial_screenshot_filter_.get()); | 634 AddRootWindowEventFilter(partial_screenshot_filter_.get()); |
629 | 635 |
630 // Then AcceleratorFilter and InputMethodEventFilter must be added (in this | 636 // Then AcceleratorFilter and InputMethodEventFilter must be added (in this |
631 // order) since they have the second highest priority. | 637 // order) since they have the second highest priority. |
632 DCHECK_EQ(1U, GetRootWindowEventFilterCount()); | 638 DCHECK_EQ(2U, GetRootWindowEventFilterCount()); |
633 #if !defined(OS_MACOSX) | 639 #if !defined(OS_MACOSX) |
634 accelerator_filter_.reset(new internal::AcceleratorFilter); | 640 accelerator_filter_.reset(new internal::AcceleratorFilter); |
635 AddRootWindowEventFilter(accelerator_filter_.get()); | 641 AddRootWindowEventFilter(accelerator_filter_.get()); |
636 DCHECK_EQ(2U, GetRootWindowEventFilterCount()); | 642 DCHECK_EQ(3U, GetRootWindowEventFilterCount()); |
637 #endif | 643 #endif |
638 input_method_filter_.reset(new internal::InputMethodEventFilter); | 644 input_method_filter_.reset(new internal::InputMethodEventFilter); |
639 AddRootWindowEventFilter(input_method_filter_.get()); | 645 AddRootWindowEventFilter(input_method_filter_.get()); |
640 | 646 |
641 root_window->SetCursor(aura::kCursorPointer); | 647 root_window->SetCursor(aura::kCursorPointer); |
642 if (initially_hide_cursor_) | 648 if (initially_hide_cursor_) |
643 root_window->ShowCursor(false); | 649 root_window->ShowCursor(false); |
644 | 650 |
645 activation_controller_.reset(new internal::ActivationController); | 651 activation_controller_.reset(new internal::ActivationController); |
646 | 652 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 desktop_background_controller_->SetDesktopBackgroundImageMode( | 912 desktop_background_controller_->SetDesktopBackgroundImageMode( |
907 GetWallpaper(index), GetWallpaperInfo(index).layout); | 913 GetWallpaper(index), GetWallpaperInfo(index).layout); |
908 } | 914 } |
909 | 915 |
910 void Shell::DisableWorkspaceGridLayout() { | 916 void Shell::DisableWorkspaceGridLayout() { |
911 if (workspace_controller_.get()) | 917 if (workspace_controller_.get()) |
912 workspace_controller_->workspace_manager()->set_grid_size(0); | 918 workspace_controller_->workspace_manager()->set_grid_size(0); |
913 } | 919 } |
914 | 920 |
915 } // namespace ash | 921 } // namespace ash |
OLD | NEW |