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" | |
12 #include "ui/aura/client/aura_constants.h" | |
13 #include "ui/aura/client/drag_drop_client.h" | |
14 #include "ui/aura/root_window.h" | 11 #include "ui/aura/root_window.h" |
15 #include "ui/aura/layout_manager.h" | 12 #include "ui/aura/layout_manager.h" |
16 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
17 #include "ui/aura/window_types.h" | |
18 #include "ui/aura_shell/activation_controller.h" | 14 #include "ui/aura_shell/activation_controller.h" |
19 #include "ui/aura_shell/app_list.h" | 15 #include "ui/aura_shell/app_list.h" |
| 16 #include "ui/aura_shell/aura_shell_switches.h" |
20 #include "ui/aura_shell/default_container_event_filter.h" | 17 #include "ui/aura_shell/default_container_event_filter.h" |
21 #include "ui/aura_shell/default_container_layout_manager.h" | 18 #include "ui/aura_shell/default_container_layout_manager.h" |
22 #include "ui/aura_shell/root_window_event_filter.h" | 19 #include "ui/aura_shell/root_window_event_filter.h" |
23 #include "ui/aura_shell/root_window_layout_manager.h" | 20 #include "ui/aura_shell/root_window_layout_manager.h" |
24 #include "ui/aura_shell/drag_drop_controller.h" | 21 #include "ui/aura_shell/drag_drop_controller.h" |
25 #include "ui/aura_shell/laptop_mode_layout_manager.h" | 22 #include "ui/aura_shell/laptop_mode_layout_manager.h" |
26 #include "ui/aura_shell/launcher/launcher.h" | 23 #include "ui/aura_shell/launcher/launcher.h" |
27 #include "ui/aura_shell/modal_container_layout_manager.h" | 24 #include "ui/aura_shell/modal_container_layout_manager.h" |
28 #include "ui/aura_shell/shadow_controller.h" | 25 #include "ui/aura_shell/shadow_controller.h" |
29 #include "ui/aura_shell/shelf_layout_manager.h" | 26 #include "ui/aura_shell/shelf_layout_manager.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // TODO(jamescook): Adjust status area layout. | 233 // TODO(jamescook): Adjust status area layout. |
237 return; | 234 return; |
238 } | 235 } |
239 | 236 |
240 root_window_layout->set_background_widget( | 237 root_window_layout->set_background_widget( |
241 internal::CreateDesktopBackground()); | 238 internal::CreateDesktopBackground()); |
242 launcher_.reset(new Launcher(default_container)); | 239 launcher_.reset(new Launcher(default_container)); |
243 | 240 |
244 internal::ShelfLayoutManager* shelf_layout_manager = | 241 internal::ShelfLayoutManager* shelf_layout_manager = |
245 new internal::ShelfLayoutManager(launcher_->widget(), status_widget); | 242 new internal::ShelfLayoutManager(launcher_->widget(), status_widget); |
246 GetContainer(aura_shell::internal::kShellWindowId_LauncherContainer)-> | 243 GetContainer(internal::kShellWindowId_LauncherContainer)-> |
247 SetLayoutManager(shelf_layout_manager); | 244 SetLayoutManager(shelf_layout_manager); |
248 | 245 |
249 internal::StatusAreaLayoutManager* status_area_layout_manager = | 246 internal::StatusAreaLayoutManager* status_area_layout_manager = |
250 new internal::StatusAreaLayoutManager(shelf_layout_manager); | 247 new internal::StatusAreaLayoutManager(shelf_layout_manager); |
251 GetContainer(aura_shell::internal::kShellWindowId_StatusContainer)-> | 248 GetContainer(internal::kShellWindowId_StatusContainer)-> |
252 SetLayoutManager(status_area_layout_manager); | 249 SetLayoutManager(status_area_layout_manager); |
253 | 250 |
254 // Workspace manager has its own layout managers. | 251 // Workspace manager has its own layout managers. |
255 if (CommandLine::ForCurrentProcess()-> | 252 if (CommandLine::ForCurrentProcess()-> |
256 HasSwitch(switches::kAuraWorkspaceManager)) { | 253 HasSwitch(switches::kAuraWorkspaceManager)) { |
257 EnableWorkspaceManager(); | 254 EnableWorkspaceManager(); |
258 return; | 255 return; |
259 } | 256 } |
260 | 257 |
261 // Default layout manager. | 258 // Default layout manager. |
262 internal::ToplevelLayoutManager* toplevel_layout_manager = | 259 internal::ToplevelLayoutManager* toplevel_layout_manager = |
263 new internal::ToplevelLayoutManager(); | 260 new internal::ToplevelLayoutManager(); |
264 default_container->SetLayoutManager(toplevel_layout_manager); | 261 default_container->SetLayoutManager(toplevel_layout_manager); |
265 toplevel_layout_manager->set_shelf(shelf_layout_manager); | 262 toplevel_layout_manager->set_shelf(shelf_layout_manager); |
266 } | 263 } |
267 | 264 |
268 aura::Window* Shell::GetContainer(int container_id) { | 265 aura::Window* Shell::GetContainer(int container_id) { |
269 return const_cast<aura::Window*>( | 266 return const_cast<aura::Window*>( |
270 const_cast<const aura_shell::Shell*>(this)->GetContainer(container_id)); | 267 const_cast<const Shell*>(this)->GetContainer(container_id)); |
271 } | 268 } |
272 | 269 |
273 const aura::Window* Shell::GetContainer(int container_id) const { | 270 const aura::Window* Shell::GetContainer(int container_id) const { |
274 return aura::RootWindow::GetInstance()->GetChildById(container_id); | 271 return aura::RootWindow::GetInstance()->GetChildById(container_id); |
275 } | 272 } |
276 | 273 |
277 void Shell::AddRootWindowEventFilter(aura::EventFilter* filter) { | 274 void Shell::AddRootWindowEventFilter(aura::EventFilter* filter) { |
278 static_cast<internal::RootWindowEventFilter*>( | 275 static_cast<internal::RootWindowEventFilter*>( |
279 aura::RootWindow::GetInstance()->event_filter())->AddFilter(filter); | 276 aura::RootWindow::GetInstance()->event_filter())->AddFilter(filter); |
280 } | 277 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 new internal::WorkspaceController(default_container)); | 318 new internal::WorkspaceController(default_container)); |
322 workspace_controller_->SetLauncherModel(launcher_->model()); | 319 workspace_controller_->SetLauncherModel(launcher_->model()); |
323 default_container->SetEventFilter( | 320 default_container->SetEventFilter( |
324 new internal::DefaultContainerEventFilter(default_container)); | 321 new internal::DefaultContainerEventFilter(default_container)); |
325 default_container->SetLayoutManager( | 322 default_container->SetLayoutManager( |
326 new internal::DefaultContainerLayoutManager( | 323 new internal::DefaultContainerLayoutManager( |
327 workspace_controller_->workspace_manager())); | 324 workspace_controller_->workspace_manager())); |
328 } | 325 } |
329 | 326 |
330 } // namespace aura_shell | 327 } // namespace aura_shell |
OLD | NEW |