| 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/desktop.h" | 12 #include "ui/aura/desktop.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/aura/window_types.h" | 14 #include "ui/aura/window_types.h" |
| 15 #include "ui/aura_shell/app_list.h" | 15 #include "ui/aura_shell/app_list.h" |
| 16 #include "ui/aura_shell/default_container_event_filter.h" | 16 #include "ui/aura_shell/default_container_event_filter.h" |
| 17 #include "ui/aura_shell/default_container_layout_manager.h" | 17 #include "ui/aura_shell/default_container_layout_manager.h" |
| 18 #include "ui/aura_shell/desktop_event_filter.h" | 18 #include "ui/aura_shell/desktop_event_filter.h" |
| 19 #include "ui/aura_shell/desktop_layout_manager.h" | 19 #include "ui/aura_shell/desktop_layout_manager.h" |
| 20 #include "ui/aura_shell/drag_drop_controller.h" | 20 #include "ui/aura_shell/drag_drop_controller.h" |
| 21 #include "ui/aura_shell/launcher/launcher.h" | 21 #include "ui/aura_shell/launcher/launcher.h" |
| 22 #include "ui/aura_shell/modal_container_layout_manager.h" | 22 #include "ui/aura_shell/modal_container_layout_manager.h" |
| 23 #include "ui/aura_shell/shadow_controller.h" | 23 #include "ui/aura_shell/shadow_controller.h" |
| 24 #include "ui/aura_shell/shelf_layout_controller.h" | 24 #include "ui/aura_shell/shelf_layout_controller.h" |
| 25 #include "ui/aura_shell/shell_accelerator_controller.h" | 25 #include "ui/aura_shell/shell_accelerator_controller.h" |
| 26 #include "ui/aura_shell/shell_accelerator_filter.h" | 26 #include "ui/aura_shell/shell_accelerator_filter.h" |
| 27 #include "ui/aura_shell/shell_delegate.h" | 27 #include "ui/aura_shell/shell_delegate.h" |
| 28 #include "ui/aura_shell/shell_factory.h" | 28 #include "ui/aura_shell/shell_factory.h" |
| 29 #include "ui/aura_shell/shell_tooltip_manager.h" |
| 29 #include "ui/aura_shell/shell_window_ids.h" | 30 #include "ui/aura_shell/shell_window_ids.h" |
| 30 #include "ui/aura_shell/stacking_controller.h" | 31 #include "ui/aura_shell/stacking_controller.h" |
| 31 #include "ui/aura_shell/toplevel_layout_manager.h" | 32 #include "ui/aura_shell/toplevel_layout_manager.h" |
| 32 #include "ui/aura_shell/toplevel_window_event_filter.h" | 33 #include "ui/aura_shell/toplevel_window_event_filter.h" |
| 33 #include "ui/aura_shell/workspace_controller.h" | 34 #include "ui/aura_shell/workspace_controller.h" |
| 34 #include "ui/gfx/compositor/layer.h" | 35 #include "ui/gfx/compositor/layer.h" |
| 35 #include "ui/gfx/compositor/layer_animator.h" | 36 #include "ui/gfx/compositor/layer_animator.h" |
| 36 #include "ui/views/widget/native_widget_aura.h" | 37 #include "ui/views/widget/native_widget_aura.h" |
| 37 #include "ui/views/widget/widget.h" | 38 #include "ui/views/widget/widget.h" |
| 38 | 39 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 delegate_(delegate) { | 115 delegate_(delegate) { |
| 115 aura::Desktop::GetInstance()->SetEventFilter( | 116 aura::Desktop::GetInstance()->SetEventFilter( |
| 116 new internal::DesktopEventFilter); | 117 new internal::DesktopEventFilter); |
| 117 aura::Desktop::GetInstance()->SetStackingClient( | 118 aura::Desktop::GetInstance()->SetStackingClient( |
| 118 new internal::StackingController); | 119 new internal::StackingController); |
| 119 } | 120 } |
| 120 | 121 |
| 121 Shell::~Shell() { | 122 Shell::~Shell() { |
| 122 RemoveDesktopEventFilter(accelerator_filter_.get()); | 123 RemoveDesktopEventFilter(accelerator_filter_.get()); |
| 123 | 124 |
| 125 // ShellTooltipManager needs a valid shell instance. We delete it before |
| 126 // deleting the shell |instance_|. |
| 127 RemoveDesktopEventFilter(tooltip_manager_.get()); |
| 128 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopTooltipClientKey, |
| 129 NULL); |
| 130 tooltip_manager_.reset(); |
| 131 |
| 124 // Drag drop controller needs a valid shell instance. We destroy it first. | 132 // Drag drop controller needs a valid shell instance. We destroy it first. |
| 125 drag_drop_controller_.reset(); | 133 drag_drop_controller_.reset(); |
| 126 | 134 |
| 127 DCHECK(instance_ == this); | 135 DCHECK(instance_ == this); |
| 128 instance_ = NULL; | 136 instance_ = NULL; |
| 129 | 137 |
| 130 // Make sure we delete WorkspaceController before launcher is | 138 // Make sure we delete WorkspaceController before launcher is |
| 131 // deleted as it has a reference to launcher model. | 139 // deleted as it has a reference to launcher model. |
| 132 workspace_controller_.reset(); | 140 workspace_controller_.reset(); |
| 133 } | 141 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 toplevel_layout_manager->set_shelf(shelf_layout_controller_.get()); | 209 toplevel_layout_manager->set_shelf(shelf_layout_controller_.get()); |
| 202 } | 210 } |
| 203 | 211 |
| 204 // Force a layout. | 212 // Force a layout. |
| 205 desktop_layout->OnWindowResized(); | 213 desktop_layout->OnWindowResized(); |
| 206 | 214 |
| 207 // Initialize ShellAcceleratorFilter | 215 // Initialize ShellAcceleratorFilter |
| 208 accelerator_filter_.reset(new internal::ShellAcceleratorFilter); | 216 accelerator_filter_.reset(new internal::ShellAcceleratorFilter); |
| 209 AddDesktopEventFilter(accelerator_filter_.get()); | 217 AddDesktopEventFilter(accelerator_filter_.get()); |
| 210 | 218 |
| 219 // Initialize ShellTooltipManager |
| 220 tooltip_manager_.reset(new ShellTooltipManager); |
| 221 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopTooltipClientKey, |
| 222 static_cast<aura::TooltipClient*>(tooltip_manager_.get())); |
| 223 AddDesktopEventFilter(tooltip_manager_.get()); |
| 224 |
| 211 // Initialize drag drop controller. | 225 // Initialize drag drop controller. |
| 212 drag_drop_controller_.reset(new internal::DragDropController); | 226 drag_drop_controller_.reset(new internal::DragDropController); |
| 213 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopDragDropClientKey, | 227 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopDragDropClientKey, |
| 214 static_cast<aura::DragDropClient*>(drag_drop_controller_.get())); | 228 static_cast<aura::DragDropClient*>(drag_drop_controller_.get())); |
| 215 } | 229 } |
| 216 | 230 |
| 217 aura::Window* Shell::GetContainer(int container_id) { | 231 aura::Window* Shell::GetContainer(int container_id) { |
| 218 return const_cast<aura::Window*>( | 232 return const_cast<aura::Window*>( |
| 219 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); | 233 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); |
| 220 } | 234 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 new internal::WorkspaceController(default_container)); | 269 new internal::WorkspaceController(default_container)); |
| 256 workspace_controller_->SetLauncherModel(launcher_->model()); | 270 workspace_controller_->SetLauncherModel(launcher_->model()); |
| 257 default_container->SetEventFilter( | 271 default_container->SetEventFilter( |
| 258 new internal::DefaultContainerEventFilter(default_container)); | 272 new internal::DefaultContainerEventFilter(default_container)); |
| 259 default_container->SetLayoutManager( | 273 default_container->SetLayoutManager( |
| 260 new internal::DefaultContainerLayoutManager( | 274 new internal::DefaultContainerLayoutManager( |
| 261 workspace_controller_->workspace_manager())); | 275 workspace_controller_->workspace_manager())); |
| 262 } | 276 } |
| 263 | 277 |
| 264 } // namespace aura_shell | 278 } // namespace aura_shell |
| OLD | NEW |