| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/shell.h" | 5 #include "ash/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/accelerators/accelerator_controller.h" | 9 #include "ash/accelerators/accelerator_controller.h" |
| 10 #include "ash/accelerators/accelerator_filter.h" | 10 #include "ash/accelerators/accelerator_filter.h" |
| 11 #include "ash/app_list/app_list.h" | 11 #include "ash/app_list/app_list.h" |
| 12 #include "ash/ash_switches.h" | 12 #include "ash/ash_switches.h" |
| 13 #include "ash/drag_drop/drag_drop_controller.h" | 13 #include "ash/drag_drop/drag_drop_controller.h" |
| 14 #include "ash/ime/input_method_event_filter.h" | 14 #include "ash/ime/input_method_event_filter.h" |
| 15 #include "ash/launcher/launcher.h" | 15 #include "ash/launcher/launcher.h" |
| 16 #include "ash/shell_delegate.h" | 16 #include "ash/shell_delegate.h" |
| 17 #include "ash/shell_factory.h" | 17 #include "ash/shell_factory.h" |
| 18 #include "ash/shell_window_ids.h" | 18 #include "ash/shell_window_ids.h" |
| 19 #include "ash/tooltips/tooltip_controller.h" | 19 #include "ash/tooltips/tooltip_controller.h" |
| 20 #include "ash/wm/activation_controller.h" | 20 #include "ash/wm/activation_controller.h" |
| 21 #include "ash/wm/compact_layout_manager.h" | 21 #include "ash/wm/compact_layout_manager.h" |
| 22 #include "ash/wm/compact_status_area_layout_manager.h" | 22 #include "ash/wm/compact_status_area_layout_manager.h" |
| 23 #include "ash/wm/default_container_event_filter.h" | 23 #include "ash/wm/default_container_event_filter.h" |
| 24 #include "ash/wm/default_container_layout_manager.h" | 24 #include "ash/wm/default_container_layout_manager.h" |
| 25 #include "ash/wm/modal_container_layout_manager.h" | 25 #include "ash/wm/modal_container_layout_manager.h" |
| 26 #include "ash/wm/power_button_controller.h" |
| 26 #include "ash/wm/root_window_event_filter.h" | 27 #include "ash/wm/root_window_event_filter.h" |
| 27 #include "ash/wm/root_window_layout_manager.h" | 28 #include "ash/wm/root_window_layout_manager.h" |
| 28 #include "ash/wm/shadow_controller.h" | 29 #include "ash/wm/shadow_controller.h" |
| 29 #include "ash/wm/shelf_layout_manager.h" | 30 #include "ash/wm/shelf_layout_manager.h" |
| 30 #include "ash/wm/stacking_controller.h" | 31 #include "ash/wm/stacking_controller.h" |
| 31 #include "ash/wm/status_area_layout_manager.h" | 32 #include "ash/wm/status_area_layout_manager.h" |
| 32 #include "ash/wm/toplevel_layout_manager.h" | 33 #include "ash/wm/toplevel_layout_manager.h" |
| 33 #include "ash/wm/toplevel_window_event_filter.h" | 34 #include "ash/wm/toplevel_window_event_filter.h" |
| 34 #include "ash/wm/workspace_controller.h" | 35 #include "ash/wm/workspace_controller.h" |
| 35 #include "base/bind.h" | 36 #include "base/bind.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 stacking_controller_.reset(new internal::StackingController); | 218 stacking_controller_.reset(new internal::StackingController); |
| 218 | 219 |
| 219 InitLayoutManagers(root_window); | 220 InitLayoutManagers(root_window); |
| 220 | 221 |
| 221 if (!command_line->HasSwitch(switches::kAuraNoShadows)) | 222 if (!command_line->HasSwitch(switches::kAuraNoShadows)) |
| 222 shadow_controller_.reset(new internal::ShadowController()); | 223 shadow_controller_.reset(new internal::ShadowController()); |
| 223 | 224 |
| 224 // Force a layout. | 225 // Force a layout. |
| 225 root_window->layout_manager()->OnWindowResized(); | 226 root_window->layout_manager()->OnWindowResized(); |
| 226 | 227 |
| 227 // Initialize InputMethodEventFilter. The filter must be added first since it | 228 // InputMethodEventFilter must be added first since it has the highest |
| 228 // has the highest priority. | 229 // priority. |
| 229 DCHECK(!GetRootWindowEventFilterCount()); | 230 DCHECK(!GetRootWindowEventFilterCount()); |
| 230 input_method_filter_.reset(new internal::InputMethodEventFilter); | 231 input_method_filter_.reset(new internal::InputMethodEventFilter); |
| 231 AddRootWindowEventFilter(input_method_filter_.get()); | 232 AddRootWindowEventFilter(input_method_filter_.get()); |
| 232 | 233 |
| 233 // Initialize AcceleratorFilter. | |
| 234 accelerator_filter_.reset(new internal::AcceleratorFilter); | 234 accelerator_filter_.reset(new internal::AcceleratorFilter); |
| 235 AddRootWindowEventFilter(accelerator_filter_.get()); | 235 AddRootWindowEventFilter(accelerator_filter_.get()); |
| 236 | 236 |
| 237 // Initialize TooltipController. | |
| 238 tooltip_controller_.reset(new internal::TooltipController); | 237 tooltip_controller_.reset(new internal::TooltipController); |
| 239 AddRootWindowEventFilter(tooltip_controller_.get()); | 238 AddRootWindowEventFilter(tooltip_controller_.get()); |
| 240 aura::client::SetTooltipClient(tooltip_controller_.get()); | 239 aura::client::SetTooltipClient(tooltip_controller_.get()); |
| 241 | 240 |
| 242 // Initialize drag drop controller. | |
| 243 drag_drop_controller_.reset(new internal::DragDropController); | 241 drag_drop_controller_.reset(new internal::DragDropController); |
| 242 power_button_controller_.reset(new PowerButtonController); |
| 244 } | 243 } |
| 245 | 244 |
| 246 bool Shell::DefaultToCompactWindowMode(const gfx::Size& monitor_size, | 245 bool Shell::DefaultToCompactWindowMode(const gfx::Size& monitor_size, |
| 247 CommandLine* command_line) const { | 246 CommandLine* command_line) const { |
| 248 // Developers often run the Aura shell in a window on their desktop. | 247 // Developers often run the Aura shell in a window on their desktop. |
| 249 // Don't mess with their window mode. | 248 // Don't mess with their window mode. |
| 250 if (!aura::RootWindow::use_fullscreen_host_window()) | 249 if (!aura::RootWindow::use_fullscreen_host_window()) |
| 251 return false; | 250 return false; |
| 252 | 251 |
| 253 // If user set the flag, don't override their desired behavior. | 252 // If user set the flag, don't override their desired behavior. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 new internal::WorkspaceController(default_container)); | 377 new internal::WorkspaceController(default_container)); |
| 379 workspace_controller_->SetLauncherModel(launcher_->model()); | 378 workspace_controller_->SetLauncherModel(launcher_->model()); |
| 380 default_container->SetEventFilter( | 379 default_container->SetEventFilter( |
| 381 new internal::DefaultContainerEventFilter(default_container)); | 380 new internal::DefaultContainerEventFilter(default_container)); |
| 382 default_container->SetLayoutManager( | 381 default_container->SetLayoutManager( |
| 383 new internal::DefaultContainerLayoutManager( | 382 new internal::DefaultContainerLayoutManager( |
| 384 workspace_controller_->workspace_manager())); | 383 workspace_controller_->workspace_manager())); |
| 385 } | 384 } |
| 386 | 385 |
| 387 } // namespace ash | 386 } // namespace ash |
| OLD | NEW |