Chromium Code Reviews| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 } else { | 229 } else { |
| 228 internal::ToplevelLayoutManager* toplevel_layout_manager = | 230 internal::ToplevelLayoutManager* toplevel_layout_manager = |
| 229 new internal::ToplevelLayoutManager(); | 231 new internal::ToplevelLayoutManager(); |
| 230 default_container->SetLayoutManager(toplevel_layout_manager); | 232 default_container->SetLayoutManager(toplevel_layout_manager); |
| 231 toplevel_layout_manager->set_shelf(shelf_layout_manager); | 233 toplevel_layout_manager->set_shelf(shelf_layout_manager); |
| 232 } | 234 } |
| 233 | 235 |
| 234 // Force a layout. | 236 // Force a layout. |
| 235 root_window_layout->OnWindowResized(); | 237 root_window_layout->OnWindowResized(); |
| 236 | 238 |
| 239 // Initialize InputMethodEventFilter. This one must be added first since the | |
| 240 // filter has the highest priority. | |
|
Ben Goodger (Google)
2011/12/12 16:51:03
To enforce this, you might want to expose a has_ev
Yusuke Sato
2011/12/14 13:42:04
Removed the restriction by adding the new event ty
| |
| 241 input_method_filter_.reset(new internal::InputMethodEventFilter); | |
| 242 AddRootWindowEventFilter(input_method_filter_.get()); | |
| 243 | |
| 237 // Initialize ShellAcceleratorFilter | 244 // Initialize ShellAcceleratorFilter |
| 238 accelerator_filter_.reset(new internal::ShellAcceleratorFilter); | 245 accelerator_filter_.reset(new internal::ShellAcceleratorFilter); |
| 239 AddRootWindowEventFilter(accelerator_filter_.get()); | 246 AddRootWindowEventFilter(accelerator_filter_.get()); |
| 240 | 247 |
| 241 // Initialize ShellTooltipManager | 248 // Initialize ShellTooltipManager |
| 242 tooltip_manager_.reset(new ShellTooltipManager); | 249 tooltip_manager_.reset(new ShellTooltipManager); |
| 243 aura::RootWindow::GetInstance()->SetProperty( | 250 aura::RootWindow::GetInstance()->SetProperty( |
| 244 aura::kRootWindowTooltipClientKey, | 251 aura::kRootWindowTooltipClientKey, |
| 245 static_cast<aura::TooltipClient*>(tooltip_manager_.get())); | 252 static_cast<aura::TooltipClient*>(tooltip_manager_.get())); |
| 246 AddRootWindowEventFilter(tooltip_manager_.get()); | 253 AddRootWindowEventFilter(tooltip_manager_.get()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 new internal::WorkspaceController(default_container)); | 300 new internal::WorkspaceController(default_container)); |
| 294 workspace_controller_->SetLauncherModel(launcher_->model()); | 301 workspace_controller_->SetLauncherModel(launcher_->model()); |
| 295 default_container->SetEventFilter( | 302 default_container->SetEventFilter( |
| 296 new internal::DefaultContainerEventFilter(default_container)); | 303 new internal::DefaultContainerEventFilter(default_container)); |
| 297 default_container->SetLayoutManager( | 304 default_container->SetLayoutManager( |
| 298 new internal::DefaultContainerLayoutManager( | 305 new internal::DefaultContainerLayoutManager( |
| 299 workspace_controller_->workspace_manager())); | 306 workspace_controller_->workspace_manager())); |
| 300 } | 307 } |
| 301 | 308 |
| 302 } // namespace aura_shell | 309 } // namespace aura_shell |
| OLD | NEW |