| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "ui/aura/aura_switches.h" | 9 #include "ui/aura/aura_switches.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| 11 #include "ui/aura/client/drag_drop_client.h" | 11 #include "ui/aura/client/drag_drop_client.h" |
| 12 #include "ui/aura/layout_manager.h" |
| 12 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
| 13 #include "ui/aura/layout_manager.h" | |
| 14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 15 #include "ui/aura/window_types.h" | 15 #include "ui/aura/window_types.h" |
| 16 #include "ui/aura_shell/app_list.h" | 16 #include "ui/aura_shell/app_list.h" |
| 17 #include "ui/aura_shell/default_container_event_filter.h" | 17 #include "ui/aura_shell/default_container_event_filter.h" |
| 18 #include "ui/aura_shell/default_container_layout_manager.h" | 18 #include "ui/aura_shell/default_container_layout_manager.h" |
| 19 #include "ui/aura_shell/drag_drop_controller.h" |
| 20 #include "ui/aura_shell/input_method_event_filter.h" |
| 21 #include "ui/aura_shell/launcher/launcher.h" |
| 22 #include "ui/aura_shell/modal_container_layout_manager.h" |
| 19 #include "ui/aura_shell/root_window_event_filter.h" | 23 #include "ui/aura_shell/root_window_event_filter.h" |
| 20 #include "ui/aura_shell/root_window_layout_manager.h" | 24 #include "ui/aura_shell/root_window_layout_manager.h" |
| 21 #include "ui/aura_shell/drag_drop_controller.h" | |
| 22 #include "ui/aura_shell/launcher/launcher.h" | |
| 23 #include "ui/aura_shell/modal_container_layout_manager.h" | |
| 24 #include "ui/aura_shell/shadow_controller.h" | 25 #include "ui/aura_shell/shadow_controller.h" |
| 25 #include "ui/aura_shell/shelf_layout_manager.h" | 26 #include "ui/aura_shell/shelf_layout_manager.h" |
| 26 #include "ui/aura_shell/shell_accelerator_controller.h" | 27 #include "ui/aura_shell/shell_accelerator_controller.h" |
| 27 #include "ui/aura_shell/shell_accelerator_filter.h" | 28 #include "ui/aura_shell/shell_accelerator_filter.h" |
| 28 #include "ui/aura_shell/shell_delegate.h" | 29 #include "ui/aura_shell/shell_delegate.h" |
| 29 #include "ui/aura_shell/shell_factory.h" | 30 #include "ui/aura_shell/shell_factory.h" |
| 30 #include "ui/aura_shell/shell_tooltip_manager.h" | 31 #include "ui/aura_shell/shell_tooltip_manager.h" |
| 31 #include "ui/aura_shell/shell_window_ids.h" | 32 #include "ui/aura_shell/shell_window_ids.h" |
| 32 #include "ui/aura_shell/stacking_controller.h" | 33 #include "ui/aura_shell/stacking_controller.h" |
| 33 #include "ui/aura_shell/status_area_layout_manager.h" | 34 #include "ui/aura_shell/status_area_layout_manager.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), | 116 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), |
| 116 accelerator_controller_(new ShellAcceleratorController), | 117 accelerator_controller_(new ShellAcceleratorController), |
| 117 delegate_(delegate) { | 118 delegate_(delegate) { |
| 118 aura::RootWindow::GetInstance()->SetEventFilter( | 119 aura::RootWindow::GetInstance()->SetEventFilter( |
| 119 new internal::RootWindowEventFilter); | 120 new internal::RootWindowEventFilter); |
| 120 aura::RootWindow::GetInstance()->SetStackingClient( | 121 aura::RootWindow::GetInstance()->SetStackingClient( |
| 121 new internal::StackingController); | 122 new internal::StackingController); |
| 122 } | 123 } |
| 123 | 124 |
| 124 Shell::~Shell() { | 125 Shell::~Shell() { |
| 126 RemoveRootWindowEventFilter(input_method_filter_.get()); |
| 125 RemoveRootWindowEventFilter(accelerator_filter_.get()); | 127 RemoveRootWindowEventFilter(accelerator_filter_.get()); |
| 126 | 128 |
| 127 // ShellTooltipManager needs a valid shell instance. We delete it before | 129 // ShellTooltipManager needs a valid shell instance. We delete it before |
| 128 // deleting the shell |instance_|. | 130 // deleting the shell |instance_|. |
| 129 RemoveRootWindowEventFilter(tooltip_manager_.get()); | 131 RemoveRootWindowEventFilter(tooltip_manager_.get()); |
| 130 aura::RootWindow::GetInstance()->SetProperty( | 132 aura::RootWindow::GetInstance()->SetProperty( |
| 131 aura::kRootWindowTooltipClientKey, | 133 aura::kRootWindowTooltipClientKey, |
| 132 NULL); | 134 NULL); |
| 133 | 135 |
| 134 // Make sure we delete WorkspaceController before launcher is | 136 // Make sure we delete WorkspaceController before launcher is |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } else { | 228 } else { |
| 227 internal::ToplevelLayoutManager* toplevel_layout_manager = | 229 internal::ToplevelLayoutManager* toplevel_layout_manager = |
| 228 new internal::ToplevelLayoutManager(); | 230 new internal::ToplevelLayoutManager(); |
| 229 default_container->SetLayoutManager(toplevel_layout_manager); | 231 default_container->SetLayoutManager(toplevel_layout_manager); |
| 230 toplevel_layout_manager->set_shelf(shelf_layout_manager); | 232 toplevel_layout_manager->set_shelf(shelf_layout_manager); |
| 231 } | 233 } |
| 232 | 234 |
| 233 // Force a layout. | 235 // Force a layout. |
| 234 root_window_layout->OnWindowResized(); | 236 root_window_layout->OnWindowResized(); |
| 235 | 237 |
| 238 // Initialize InputMethodEventFilter. This one must be added first since the |
| 239 // filter has the highest priority. |
| 240 input_method_filter_.reset(new internal::InputMethodEventFilter); |
| 241 AddRootWindowEventFilter(input_method_filter_.get()); |
| 242 |
| 236 // Initialize ShellAcceleratorFilter | 243 // Initialize ShellAcceleratorFilter |
| 237 accelerator_filter_.reset(new internal::ShellAcceleratorFilter); | 244 accelerator_filter_.reset(new internal::ShellAcceleratorFilter); |
| 238 AddRootWindowEventFilter(accelerator_filter_.get()); | 245 AddRootWindowEventFilter(accelerator_filter_.get()); |
| 239 | 246 |
| 240 // Initialize ShellTooltipManager | 247 // Initialize ShellTooltipManager |
| 241 tooltip_manager_.reset(new ShellTooltipManager); | 248 tooltip_manager_.reset(new ShellTooltipManager); |
| 242 aura::RootWindow::GetInstance()->SetProperty( | 249 aura::RootWindow::GetInstance()->SetProperty( |
| 243 aura::kRootWindowTooltipClientKey, | 250 aura::kRootWindowTooltipClientKey, |
| 244 static_cast<aura::TooltipClient*>(tooltip_manager_.get())); | 251 static_cast<aura::TooltipClient*>(tooltip_manager_.get())); |
| 245 AddRootWindowEventFilter(tooltip_manager_.get()); | 252 AddRootWindowEventFilter(tooltip_manager_.get()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 new internal::WorkspaceController(default_container)); | 299 new internal::WorkspaceController(default_container)); |
| 293 workspace_controller_->SetLauncherModel(launcher_->model()); | 300 workspace_controller_->SetLauncherModel(launcher_->model()); |
| 294 default_container->SetEventFilter( | 301 default_container->SetEventFilter( |
| 295 new internal::DefaultContainerEventFilter(default_container)); | 302 new internal::DefaultContainerEventFilter(default_container)); |
| 296 default_container->SetLayoutManager( | 303 default_container->SetLayoutManager( |
| 297 new internal::DefaultContainerLayoutManager( | 304 new internal::DefaultContainerLayoutManager( |
| 298 workspace_controller_->workspace_manager())); | 305 workspace_controller_->workspace_manager())); |
| 299 } | 306 } |
| 300 | 307 |
| 301 } // namespace aura_shell | 308 } // namespace aura_shell |
| OLD | NEW |