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/ash_switches.h" | 10 #include "ash/ash_switches.h" |
11 #include "ash/desktop_background/desktop_background_controller.h" | 11 #include "ash/desktop_background/desktop_background_controller.h" |
12 #include "ash/desktop_background/desktop_background_resources.h" | 12 #include "ash/desktop_background/desktop_background_resources.h" |
13 #include "ash/desktop_background/desktop_background_view.h" | 13 #include "ash/desktop_background/desktop_background_view.h" |
14 #include "ash/drag_drop/drag_drop_controller.h" | 14 #include "ash/drag_drop/drag_drop_controller.h" |
15 #include "ash/focus_cycler.h" | 15 #include "ash/focus_cycler.h" |
16 #include "ash/launcher/launcher.h" | 16 #include "ash/launcher/launcher.h" |
17 #include "ash/magnifier/magnification_controller.h" | 17 #include "ash/magnifier/magnification_controller.h" |
18 #include "ash/monitor/monitor_controller.h" | 18 #include "ash/monitor/monitor_controller.h" |
19 #include "ash/monitor/multi_monitor_manager.h" | 19 #include "ash/monitor/multi_monitor_manager.h" |
20 #include "ash/screen_ash.h" | 20 #include "ash/screen_ash.h" |
21 #include "ash/shell_context_menu.h" | 21 #include "ash/shell_context_menu.h" |
22 #include "ash/shell_delegate.h" | 22 #include "ash/shell_delegate.h" |
23 #include "ash/shell_factory.h" | 23 #include "ash/shell_factory.h" |
24 #include "ash/shell_window_ids.h" | 24 #include "ash/shell_window_ids.h" |
25 #include "ash/system/bluetooth/bluetooth_observer.h" | 25 #include "ash/system/bluetooth/bluetooth_observer.h" |
26 #include "ash/system/network/network_observer.h" | 26 #include "ash/system/network/network_observer.h" |
27 #include "ash/system/tray/system_tray.h" | 27 #include "ash/system/tray/system_tray.h" |
28 #include "ash/system/tray/system_tray_delegate.h" | 28 #include "ash/system/tray/system_tray_delegate.h" |
29 #include "ash/tooltips/tooltip_controller.h" | 29 #include "ash/tooltips/tooltip_controller.h" |
30 #include "ash/touch/touch_observer_hud.h" | |
30 #include "ash/wm/activation_controller.h" | 31 #include "ash/wm/activation_controller.h" |
31 #include "ash/wm/app_list_controller.h" | 32 #include "ash/wm/app_list_controller.h" |
32 #include "ash/wm/base_layout_manager.h" | 33 #include "ash/wm/base_layout_manager.h" |
33 #include "ash/wm/custom_frame_view_ash.h" | 34 #include "ash/wm/custom_frame_view_ash.h" |
34 #include "ash/wm/dialog_frame_view.h" | 35 #include "ash/wm/dialog_frame_view.h" |
35 #include "ash/wm/event_client_impl.h" | 36 #include "ash/wm/event_client_impl.h" |
36 #include "ash/wm/key_rewriter_event_filter.h" | 37 #include "ash/wm/key_rewriter_event_filter.h" |
37 #include "ash/wm/panel_layout_manager.h" | 38 #include "ash/wm/panel_layout_manager.h" |
38 #include "ash/wm/panel_window_event_filter.h" | 39 #include "ash/wm/panel_window_event_filter.h" |
39 #include "ash/wm/partial_screenshot_event_filter.h" | 40 #include "ash/wm/partial_screenshot_event_filter.h" |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
546 | 547 |
547 Shell::~Shell() { | 548 Shell::~Shell() { |
548 RemoveRootWindowEventFilter(key_rewriter_filter_.get()); | 549 RemoveRootWindowEventFilter(key_rewriter_filter_.get()); |
549 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); | 550 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); |
550 RemoveRootWindowEventFilter(input_method_filter_.get()); | 551 RemoveRootWindowEventFilter(input_method_filter_.get()); |
551 RemoveRootWindowEventFilter(window_modality_controller_.get()); | 552 RemoveRootWindowEventFilter(window_modality_controller_.get()); |
552 RemoveRootWindowEventFilter(system_gesture_filter_.get()); | 553 RemoveRootWindowEventFilter(system_gesture_filter_.get()); |
553 #if !defined(OS_MACOSX) | 554 #if !defined(OS_MACOSX) |
554 RemoveRootWindowEventFilter(accelerator_filter_.get()); | 555 RemoveRootWindowEventFilter(accelerator_filter_.get()); |
555 #endif | 556 #endif |
557 if (touch_observer_hud_.get()) | |
558 RemoveRootWindowEventFilter(touch_observer_hud_.get()); | |
556 | 559 |
557 // Close background widget now so that the focus manager of the | 560 // Close background widget now so that the focus manager of the |
558 // widget gets deleted in the final message loop run. | 561 // widget gets deleted in the final message loop run. |
559 root_window_layout_->SetBackgroundWidget(NULL); | 562 root_window_layout_->SetBackgroundWidget(NULL); |
560 | 563 |
561 // TooltipController is deleted with the Shell so removing its references. | 564 // TooltipController is deleted with the Shell so removing its references. |
562 RemoveRootWindowEventFilter(tooltip_controller_.get()); | 565 RemoveRootWindowEventFilter(tooltip_controller_.get()); |
563 aura::client::SetTooltipClient(GetRootWindow(), NULL); | 566 aura::client::SetTooltipClient(GetRootWindow(), NULL); |
564 | 567 |
565 // Make sure we delete WorkspaceController before launcher is | 568 // Make sure we delete WorkspaceController before launcher is |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
669 new aura::shared::InputMethodEventFilter(root_window)); | 672 new aura::shared::InputMethodEventFilter(root_window)); |
670 AddRootWindowEventFilter(input_method_filter_.get()); | 673 AddRootWindowEventFilter(input_method_filter_.get()); |
671 #if !defined(OS_MACOSX) | 674 #if !defined(OS_MACOSX) |
672 accelerator_filter_.reset(new internal::AcceleratorFilter); | 675 accelerator_filter_.reset(new internal::AcceleratorFilter); |
673 AddRootWindowEventFilter(accelerator_filter_.get()); | 676 AddRootWindowEventFilter(accelerator_filter_.get()); |
674 #endif | 677 #endif |
675 | 678 |
676 system_gesture_filter_.reset(new internal::SystemGestureEventFilter); | 679 system_gesture_filter_.reset(new internal::SystemGestureEventFilter); |
677 AddRootWindowEventFilter(system_gesture_filter_.get()); | 680 AddRootWindowEventFilter(system_gesture_filter_.get()); |
678 | 681 |
682 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
683 | |
684 if (command_line->HasSwitch(switches::kAshTouchHud)) { | |
685 touch_observer_hud_.reset(new internal::TouchObserverHUD); | |
686 AddRootWindowEventFilter(touch_observer_hud_.get()); | |
687 } | |
688 | |
679 root_window->SetCursor(ui::kCursorPointer); | 689 root_window->SetCursor(ui::kCursorPointer); |
680 if (initially_hide_cursor_) | 690 if (initially_hide_cursor_) |
681 root_window->ShowCursor(false); | 691 root_window->ShowCursor(false); |
682 | 692 |
683 activation_controller_.reset(new internal::ActivationController); | 693 activation_controller_.reset(new internal::ActivationController); |
684 | 694 |
685 CreateSpecialContainers(root_window); | 695 CreateSpecialContainers(root_window); |
696 if (touch_observer_hud_.get()) | |
697 touch_observer_hud_->Initialize(); | |
Ben Goodger (Google)
2012/05/16 20:14:35
instead of having an init method, why not just con
sadrul
2012/05/16 20:35:55
Done.
| |
686 | 698 |
687 stacking_controller_.reset(new internal::StackingController); | 699 stacking_controller_.reset(new internal::StackingController); |
688 | 700 |
689 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); | 701 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); |
690 root_window->SetLayoutManager(root_window_layout_); | 702 root_window->SetLayoutManager(root_window_layout_); |
691 | 703 |
692 event_client_.reset(new internal::EventClientImpl(root_window)); | 704 event_client_.reset(new internal::EventClientImpl(root_window)); |
693 | 705 |
694 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
695 | |
696 tray_.reset(new SystemTray()); | 706 tray_.reset(new SystemTray()); |
697 if (delegate_.get()) | 707 if (delegate_.get()) |
698 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get())); | 708 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get())); |
699 if (!tray_delegate_.get()) | 709 if (!tray_delegate_.get()) |
700 tray_delegate_.reset(new DummySystemTrayDelegate()); | 710 tray_delegate_.reset(new DummySystemTrayDelegate()); |
701 tray_->CreateItems(); | 711 tray_->CreateItems(); |
702 tray_->CreateWidget(); | 712 tray_->CreateWidget(); |
703 | 713 |
704 // This controller needs to be set before SetupManagedWindowMode. | 714 // This controller needs to be set before SetupManagedWindowMode. |
705 desktop_background_controller_.reset(new DesktopBackgroundController); | 715 desktop_background_controller_.reset(new DesktopBackgroundController); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
940 panel_container->SetLayoutManager(panel_layout_manager_); | 950 panel_container->SetLayoutManager(panel_layout_manager_); |
941 } | 951 } |
942 } | 952 } |
943 | 953 |
944 void Shell::DisableWorkspaceGridLayout() { | 954 void Shell::DisableWorkspaceGridLayout() { |
945 if (workspace_controller_.get()) | 955 if (workspace_controller_.get()) |
946 workspace_controller_->workspace_manager()->set_grid_size(0); | 956 workspace_controller_->workspace_manager()->set_grid_size(0); |
947 } | 957 } |
948 | 958 |
949 } // namespace ash | 959 } // namespace ash |
OLD | NEW |