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" | |
31 #include "ash/wm/activation_controller.h" | 30 #include "ash/wm/activation_controller.h" |
32 #include "ash/wm/app_list_controller.h" | 31 #include "ash/wm/app_list_controller.h" |
33 #include "ash/wm/base_layout_manager.h" | 32 #include "ash/wm/base_layout_manager.h" |
34 #include "ash/wm/custom_frame_view_ash.h" | 33 #include "ash/wm/custom_frame_view_ash.h" |
35 #include "ash/wm/dialog_frame_view.h" | 34 #include "ash/wm/dialog_frame_view.h" |
36 #include "ash/wm/event_client_impl.h" | 35 #include "ash/wm/event_client_impl.h" |
37 #include "ash/wm/key_rewriter_event_filter.h" | 36 #include "ash/wm/key_rewriter_event_filter.h" |
38 #include "ash/wm/panel_layout_manager.h" | 37 #include "ash/wm/panel_layout_manager.h" |
39 #include "ash/wm/panel_window_event_filter.h" | 38 #include "ash/wm/panel_window_event_filter.h" |
40 #include "ash/wm/partial_screenshot_event_filter.h" | 39 #include "ash/wm/partial_screenshot_event_filter.h" |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 546 |
548 Shell::~Shell() { | 547 Shell::~Shell() { |
549 RemoveRootWindowEventFilter(key_rewriter_filter_.get()); | 548 RemoveRootWindowEventFilter(key_rewriter_filter_.get()); |
550 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); | 549 RemoveRootWindowEventFilter(partial_screenshot_filter_.get()); |
551 RemoveRootWindowEventFilter(input_method_filter_.get()); | 550 RemoveRootWindowEventFilter(input_method_filter_.get()); |
552 RemoveRootWindowEventFilter(window_modality_controller_.get()); | 551 RemoveRootWindowEventFilter(window_modality_controller_.get()); |
553 RemoveRootWindowEventFilter(system_gesture_filter_.get()); | 552 RemoveRootWindowEventFilter(system_gesture_filter_.get()); |
554 #if !defined(OS_MACOSX) | 553 #if !defined(OS_MACOSX) |
555 RemoveRootWindowEventFilter(accelerator_filter_.get()); | 554 RemoveRootWindowEventFilter(accelerator_filter_.get()); |
556 #endif | 555 #endif |
557 if (touch_observer_hud_.get()) | |
558 RemoveRootWindowEventFilter(touch_observer_hud_.get()); | |
559 | 556 |
560 // Close background widget now so that the focus manager of the | 557 // Close background widget now so that the focus manager of the |
561 // widget gets deleted in the final message loop run. | 558 // widget gets deleted in the final message loop run. |
562 root_window_layout_->SetBackgroundWidget(NULL); | 559 root_window_layout_->SetBackgroundWidget(NULL); |
563 | 560 |
564 // TooltipController is deleted with the Shell so removing its references. | 561 // TooltipController is deleted with the Shell so removing its references. |
565 RemoveRootWindowEventFilter(tooltip_controller_.get()); | 562 RemoveRootWindowEventFilter(tooltip_controller_.get()); |
566 aura::client::SetTooltipClient(GetRootWindow(), NULL); | 563 aura::client::SetTooltipClient(GetRootWindow(), NULL); |
567 | 564 |
568 // Make sure we delete WorkspaceController before launcher is | 565 // Make sure we delete WorkspaceController before launcher is |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 AddRootWindowEventFilter(system_gesture_filter_.get()); | 677 AddRootWindowEventFilter(system_gesture_filter_.get()); |
681 | 678 |
682 root_window->SetCursor(ui::kCursorPointer); | 679 root_window->SetCursor(ui::kCursorPointer); |
683 if (initially_hide_cursor_) | 680 if (initially_hide_cursor_) |
684 root_window->ShowCursor(false); | 681 root_window->ShowCursor(false); |
685 | 682 |
686 activation_controller_.reset(new internal::ActivationController); | 683 activation_controller_.reset(new internal::ActivationController); |
687 | 684 |
688 CreateSpecialContainers(root_window); | 685 CreateSpecialContainers(root_window); |
689 | 686 |
690 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
691 | |
692 if (command_line->HasSwitch(switches::kAshTouchHud)) { | |
693 touch_observer_hud_.reset(new internal::TouchObserverHUD); | |
694 AddRootWindowEventFilter(touch_observer_hud_.get()); | |
695 } | |
696 | |
697 stacking_controller_.reset(new internal::StackingController); | 687 stacking_controller_.reset(new internal::StackingController); |
698 | 688 |
699 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); | 689 root_window_layout_ = new internal::RootWindowLayoutManager(root_window); |
700 root_window->SetLayoutManager(root_window_layout_); | 690 root_window->SetLayoutManager(root_window_layout_); |
701 | 691 |
702 event_client_.reset(new internal::EventClientImpl(root_window)); | 692 event_client_.reset(new internal::EventClientImpl(root_window)); |
703 | 693 |
| 694 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 695 |
704 tray_.reset(new SystemTray()); | 696 tray_.reset(new SystemTray()); |
705 if (delegate_.get()) | 697 if (delegate_.get()) |
706 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get())); | 698 tray_delegate_.reset(delegate_->CreateSystemTrayDelegate(tray_.get())); |
707 if (!tray_delegate_.get()) | 699 if (!tray_delegate_.get()) |
708 tray_delegate_.reset(new DummySystemTrayDelegate()); | 700 tray_delegate_.reset(new DummySystemTrayDelegate()); |
709 tray_->CreateItems(); | 701 tray_->CreateItems(); |
710 tray_->CreateWidget(); | 702 tray_->CreateWidget(); |
711 | 703 |
712 // This controller needs to be set before SetupManagedWindowMode. | 704 // This controller needs to be set before SetupManagedWindowMode. |
713 desktop_background_controller_.reset(new DesktopBackgroundController); | 705 desktop_background_controller_.reset(new DesktopBackgroundController); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 panel_container->SetLayoutManager(panel_layout_manager_); | 940 panel_container->SetLayoutManager(panel_layout_manager_); |
949 } | 941 } |
950 } | 942 } |
951 | 943 |
952 void Shell::DisableWorkspaceGridLayout() { | 944 void Shell::DisableWorkspaceGridLayout() { |
953 if (workspace_controller_.get()) | 945 if (workspace_controller_.get()) |
954 workspace_controller_->workspace_manager()->set_grid_size(0); | 946 workspace_controller_->workspace_manager()->set_grid_size(0); |
955 } | 947 } |
956 | 948 |
957 } // namespace ash | 949 } // namespace ash |
OLD | NEW |