OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura_shell/shell.h" | 5 #include "ui/aura_shell/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "ui/aura/aura_switches.h" | 11 #include "ui/aura/aura_switches.h" |
12 #include "ui/aura/client/aura_constants.h" | 12 #include "ui/aura/client/aura_constants.h" |
13 #include "ui/aura/client/drag_drop_client.h" | 13 #include "ui/aura/client/drag_drop_client.h" |
| 14 #include "ui/aura/layout_manager.h" |
14 #include "ui/aura/root_window.h" | 15 #include "ui/aura/root_window.h" |
15 #include "ui/aura/layout_manager.h" | |
16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
17 #include "ui/aura/window_types.h" | 17 #include "ui/aura/window_types.h" |
18 #include "ui/aura_shell/activation_controller.h" | 18 #include "ui/aura_shell/activation_controller.h" |
19 #include "ui/aura_shell/app_list.h" | 19 #include "ui/aura_shell/app_list.h" |
20 #include "ui/aura_shell/default_container_event_filter.h" | 20 #include "ui/aura_shell/default_container_event_filter.h" |
21 #include "ui/aura_shell/default_container_layout_manager.h" | 21 #include "ui/aura_shell/default_container_layout_manager.h" |
| 22 #include "ui/aura_shell/drag_drop_controller.h" |
| 23 #include "ui/aura_shell/input_method_event_filter.h" |
| 24 #include "ui/aura_shell/launcher/launcher.h" |
| 25 #include "ui/aura_shell/modal_container_layout_manager.h" |
22 #include "ui/aura_shell/root_window_event_filter.h" | 26 #include "ui/aura_shell/root_window_event_filter.h" |
23 #include "ui/aura_shell/root_window_layout_manager.h" | 27 #include "ui/aura_shell/root_window_layout_manager.h" |
24 #include "ui/aura_shell/drag_drop_controller.h" | |
25 #include "ui/aura_shell/launcher/launcher.h" | |
26 #include "ui/aura_shell/modal_container_layout_manager.h" | |
27 #include "ui/aura_shell/shadow_controller.h" | 28 #include "ui/aura_shell/shadow_controller.h" |
28 #include "ui/aura_shell/shelf_layout_manager.h" | 29 #include "ui/aura_shell/shelf_layout_manager.h" |
29 #include "ui/aura_shell/shell_accelerator_controller.h" | 30 #include "ui/aura_shell/shell_accelerator_controller.h" |
30 #include "ui/aura_shell/shell_accelerator_filter.h" | 31 #include "ui/aura_shell/shell_accelerator_filter.h" |
31 #include "ui/aura_shell/shell_delegate.h" | 32 #include "ui/aura_shell/shell_delegate.h" |
32 #include "ui/aura_shell/shell_factory.h" | 33 #include "ui/aura_shell/shell_factory.h" |
33 #include "ui/aura_shell/shell_tooltip_manager.h" | 34 #include "ui/aura_shell/shell_tooltip_manager.h" |
34 #include "ui/aura_shell/shell_window_ids.h" | 35 #include "ui/aura_shell/shell_window_ids.h" |
35 #include "ui/aura_shell/stacking_controller.h" | 36 #include "ui/aura_shell/stacking_controller.h" |
36 #include "ui/aura_shell/status_area_layout_manager.h" | 37 #include "ui/aura_shell/status_area_layout_manager.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), | 119 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), |
119 accelerator_controller_(new ShellAcceleratorController), | 120 accelerator_controller_(new ShellAcceleratorController), |
120 delegate_(delegate) { | 121 delegate_(delegate) { |
121 aura::RootWindow::GetInstance()->SetEventFilter( | 122 aura::RootWindow::GetInstance()->SetEventFilter( |
122 new internal::RootWindowEventFilter); | 123 new internal::RootWindowEventFilter); |
123 aura::RootWindow::GetInstance()->SetStackingClient( | 124 aura::RootWindow::GetInstance()->SetStackingClient( |
124 new internal::StackingController); | 125 new internal::StackingController); |
125 } | 126 } |
126 | 127 |
127 Shell::~Shell() { | 128 Shell::~Shell() { |
| 129 RemoveRootWindowEventFilter(input_method_filter_.get()); |
128 RemoveRootWindowEventFilter(accelerator_filter_.get()); | 130 RemoveRootWindowEventFilter(accelerator_filter_.get()); |
129 | 131 |
130 // ShellTooltipManager needs a valid shell instance. We delete it before | 132 // ShellTooltipManager needs a valid shell instance. We delete it before |
131 // deleting the shell |instance_|. | 133 // deleting the shell |instance_|. |
132 RemoveRootWindowEventFilter(tooltip_manager_.get()); | 134 RemoveRootWindowEventFilter(tooltip_manager_.get()); |
133 aura::RootWindow::GetInstance()->SetProperty( | 135 aura::RootWindow::GetInstance()->SetProperty( |
134 aura::kRootWindowTooltipClientKey, | 136 aura::kRootWindowTooltipClientKey, |
135 NULL); | 137 NULL); |
136 | 138 |
137 // Make sure we delete WorkspaceController before launcher is | 139 // Make sure we delete WorkspaceController before launcher is |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } else { | 234 } else { |
233 internal::ToplevelLayoutManager* toplevel_layout_manager = | 235 internal::ToplevelLayoutManager* toplevel_layout_manager = |
234 new internal::ToplevelLayoutManager(); | 236 new internal::ToplevelLayoutManager(); |
235 default_container->SetLayoutManager(toplevel_layout_manager); | 237 default_container->SetLayoutManager(toplevel_layout_manager); |
236 toplevel_layout_manager->set_shelf(shelf_layout_manager); | 238 toplevel_layout_manager->set_shelf(shelf_layout_manager); |
237 } | 239 } |
238 | 240 |
239 // Force a layout. | 241 // Force a layout. |
240 root_window_layout->OnWindowResized(); | 242 root_window_layout->OnWindowResized(); |
241 | 243 |
| 244 // Initialize InputMethodEventFilter. |
| 245 input_method_filter_.reset(new internal::InputMethodEventFilter); |
| 246 AddRootWindowEventFilter(input_method_filter_.get()); |
242 // Initialize ShellAcceleratorFilter | 247 // Initialize ShellAcceleratorFilter |
243 accelerator_filter_.reset(new internal::ShellAcceleratorFilter); | 248 accelerator_filter_.reset(new internal::ShellAcceleratorFilter); |
244 AddRootWindowEventFilter(accelerator_filter_.get()); | 249 AddRootWindowEventFilter(accelerator_filter_.get()); |
245 | 250 |
246 // Initialize ShellTooltipManager | 251 // Initialize ShellTooltipManager |
247 tooltip_manager_.reset(new ShellTooltipManager); | 252 tooltip_manager_.reset(new ShellTooltipManager); |
248 aura::RootWindow::GetInstance()->SetProperty( | 253 aura::RootWindow::GetInstance()->SetProperty( |
249 aura::kRootWindowTooltipClientKey, | 254 aura::kRootWindowTooltipClientKey, |
250 static_cast<aura::TooltipClient*>(tooltip_manager_.get())); | 255 static_cast<aura::TooltipClient*>(tooltip_manager_.get())); |
251 AddRootWindowEventFilter(tooltip_manager_.get()); | 256 AddRootWindowEventFilter(tooltip_manager_.get()); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 new internal::WorkspaceController(default_container)); | 318 new internal::WorkspaceController(default_container)); |
314 workspace_controller_->SetLauncherModel(launcher_->model()); | 319 workspace_controller_->SetLauncherModel(launcher_->model()); |
315 default_container->SetEventFilter( | 320 default_container->SetEventFilter( |
316 new internal::DefaultContainerEventFilter(default_container)); | 321 new internal::DefaultContainerEventFilter(default_container)); |
317 default_container->SetLayoutManager( | 322 default_container->SetLayoutManager( |
318 new internal::DefaultContainerLayoutManager( | 323 new internal::DefaultContainerLayoutManager( |
319 workspace_controller_->workspace_manager())); | 324 workspace_controller_->workspace_manager())); |
320 } | 325 } |
321 | 326 |
322 } // namespace aura_shell | 327 } // namespace aura_shell |
OLD | NEW |