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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 delegate_(delegate) { | 107 delegate_(delegate) { |
107 aura::Desktop::GetInstance()->SetEventFilter( | 108 aura::Desktop::GetInstance()->SetEventFilter( |
108 new internal::DesktopEventFilter); | 109 new internal::DesktopEventFilter); |
109 aura::Desktop::GetInstance()->SetStackingClient( | 110 aura::Desktop::GetInstance()->SetStackingClient( |
110 new internal::StackingController); | 111 new internal::StackingController); |
111 } | 112 } |
112 | 113 |
113 Shell::~Shell() { | 114 Shell::~Shell() { |
114 RemoveDesktopEventFilter(accelerator_filter_.get()); | 115 RemoveDesktopEventFilter(accelerator_filter_.get()); |
115 | 116 |
| 117 // ShellTooltipManager needs a valid shell instance. We delete it before |
| 118 // deleting the shell |instance_|. |
| 119 RemoveDesktopEventFilter(tooltip_manager_.get()); |
| 120 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopTooltipClientKey, |
| 121 NULL); |
| 122 tooltip_manager_.reset(); |
| 123 |
116 // Drag drop controller needs a valid shell instance. We destroy it first. | 124 // Drag drop controller needs a valid shell instance. We destroy it first. |
117 drag_drop_controller_.reset(); | 125 drag_drop_controller_.reset(); |
118 | 126 |
119 DCHECK(instance_ == this); | 127 DCHECK(instance_ == this); |
120 instance_ = NULL; | 128 instance_ = NULL; |
121 | 129 |
122 // Make sure we delete WorkspaceController before launcher is | 130 // Make sure we delete WorkspaceController before launcher is |
123 // deleted as it has a reference to launcher model. | 131 // deleted as it has a reference to launcher model. |
124 workspace_controller_.reset(); | 132 workspace_controller_.reset(); |
125 } | 133 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 toplevel_layout_manager->set_shelf(shelf_layout_controller_.get()); | 201 toplevel_layout_manager->set_shelf(shelf_layout_controller_.get()); |
194 } | 202 } |
195 | 203 |
196 // Force a layout. | 204 // Force a layout. |
197 desktop_layout->OnWindowResized(); | 205 desktop_layout->OnWindowResized(); |
198 | 206 |
199 // Initialize ShellAcceleratorFilter | 207 // Initialize ShellAcceleratorFilter |
200 accelerator_filter_.reset(new internal::ShellAcceleratorFilter); | 208 accelerator_filter_.reset(new internal::ShellAcceleratorFilter); |
201 AddDesktopEventFilter(accelerator_filter_.get()); | 209 AddDesktopEventFilter(accelerator_filter_.get()); |
202 | 210 |
| 211 // Initialize ShellTooltipManager |
| 212 tooltip_manager_.reset(new ShellTooltipManager); |
| 213 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopTooltipClientKey, |
| 214 static_cast<aura::TooltipClient*>(tooltip_manager_.get())); |
| 215 AddDesktopEventFilter(tooltip_manager_.get()); |
| 216 |
203 // Initialize drag drop controller. | 217 // Initialize drag drop controller. |
204 drag_drop_controller_.reset(new internal::DragDropController); | 218 drag_drop_controller_.reset(new internal::DragDropController); |
205 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopDragDropClientKey, | 219 aura::Desktop::GetInstance()->SetProperty(aura::kDesktopDragDropClientKey, |
206 static_cast<aura::DragDropClient*>(drag_drop_controller_.get())); | 220 static_cast<aura::DragDropClient*>(drag_drop_controller_.get())); |
207 } | 221 } |
208 | 222 |
209 aura::Window* Shell::GetContainer(int container_id) { | 223 aura::Window* Shell::GetContainer(int container_id) { |
210 return const_cast<aura::Window*>( | 224 return const_cast<aura::Window*>( |
211 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); | 225 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); |
212 } | 226 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 new internal::WorkspaceController(default_container)); | 261 new internal::WorkspaceController(default_container)); |
248 workspace_controller_->SetLauncherModel(launcher_->model()); | 262 workspace_controller_->SetLauncherModel(launcher_->model()); |
249 default_container->SetEventFilter( | 263 default_container->SetEventFilter( |
250 new internal::DefaultContainerEventFilter(default_container)); | 264 new internal::DefaultContainerEventFilter(default_container)); |
251 default_container->SetLayoutManager( | 265 default_container->SetLayoutManager( |
252 new internal::DefaultContainerLayoutManager( | 266 new internal::DefaultContainerLayoutManager( |
253 workspace_controller_->workspace_manager())); | 267 workspace_controller_->workspace_manager())); |
254 } | 268 } |
255 | 269 |
256 } // namespace aura_shell | 270 } // namespace aura_shell |
OLD | NEW |