OLD | NEW |
1 // Copyright (c) 2012 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/app_list/app_list.h" | 9 #include "ash/app_list/app_list.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 return instance_; | 262 return instance_; |
263 } | 263 } |
264 | 264 |
265 // static | 265 // static |
266 void Shell::DeleteInstance() { | 266 void Shell::DeleteInstance() { |
267 delete instance_; | 267 delete instance_; |
268 instance_ = NULL; | 268 instance_ = NULL; |
269 } | 269 } |
270 | 270 |
271 void Shell::Init() { | 271 void Shell::Init() { |
272 // InputMethodEventFilter must be added first since it has the highest | 272 // AcceleratorFilter and InputMethodEventFilter must be added (in this order) |
273 // priority. | 273 // since they have the highest priority. |
274 DCHECK(!GetRootWindowEventFilterCount()); | 274 DCHECK_EQ(0U, GetRootWindowEventFilterCount()); |
| 275 #if !defined(OS_MACOSX) |
| 276 accelerator_filter_.reset(new internal::AcceleratorFilter); |
| 277 AddRootWindowEventFilter(accelerator_filter_.get()); |
| 278 DCHECK_EQ(1U, GetRootWindowEventFilterCount()); |
| 279 #endif |
275 input_method_filter_.reset(new internal::InputMethodEventFilter); | 280 input_method_filter_.reset(new internal::InputMethodEventFilter); |
276 AddRootWindowEventFilter(input_method_filter_.get()); | 281 AddRootWindowEventFilter(input_method_filter_.get()); |
277 | 282 |
278 // On small screens we automatically enable --aura-window-mode=compact if the | 283 // On small screens we automatically enable --aura-window-mode=compact if the |
279 // user has not explicitly set a window mode flag. This must happen before | 284 // user has not explicitly set a window mode flag. This must happen before |
280 // we create containers or layout managers. | 285 // we create containers or layout managers. |
281 gfx::Size monitor_size = gfx::Screen::GetPrimaryMonitorSize(); | 286 gfx::Size monitor_size = gfx::Screen::GetPrimaryMonitorSize(); |
282 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 287 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
283 window_mode_ = ComputeWindowMode(monitor_size, command_line); | 288 window_mode_ = ComputeWindowMode(monitor_size, command_line); |
284 | 289 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 330 |
326 // Force a layout. | 331 // Force a layout. |
327 root_window->layout_manager()->OnWindowResized(); | 332 root_window->layout_manager()->OnWindowResized(); |
328 | 333 |
329 window_modality_controller_.reset(new internal::WindowModalityController); | 334 window_modality_controller_.reset(new internal::WindowModalityController); |
330 AddRootWindowEventFilter(window_modality_controller_.get()); | 335 AddRootWindowEventFilter(window_modality_controller_.get()); |
331 | 336 |
332 visibility_controller_.reset(new internal::VisibilityController); | 337 visibility_controller_.reset(new internal::VisibilityController); |
333 aura::client::SetVisibilityClient(visibility_controller_.get()); | 338 aura::client::SetVisibilityClient(visibility_controller_.get()); |
334 | 339 |
335 #if !defined(OS_MACOSX) | |
336 accelerator_filter_.reset(new internal::AcceleratorFilter); | |
337 AddRootWindowEventFilter(accelerator_filter_.get()); | |
338 #endif | |
339 | |
340 tooltip_controller_.reset(new internal::TooltipController); | 340 tooltip_controller_.reset(new internal::TooltipController); |
341 AddRootWindowEventFilter(tooltip_controller_.get()); | 341 AddRootWindowEventFilter(tooltip_controller_.get()); |
342 aura::client::SetTooltipClient(tooltip_controller_.get()); | 342 aura::client::SetTooltipClient(tooltip_controller_.get()); |
343 | 343 |
344 drag_drop_controller_.reset(new internal::DragDropController); | 344 drag_drop_controller_.reset(new internal::DragDropController); |
345 power_button_controller_.reset(new PowerButtonController); | 345 power_button_controller_.reset(new PowerButtonController); |
346 video_detector_.reset(new VideoDetector); | 346 video_detector_.reset(new VideoDetector); |
347 window_cycle_controller_.reset(new WindowCycleController); | 347 window_cycle_controller_.reset(new WindowCycleController); |
348 } | 348 } |
349 | 349 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 // Create the desktop background image. | 573 // Create the desktop background image. |
574 root_window_layout_->SetBackgroundWidget(internal::CreateDesktopBackground()); | 574 root_window_layout_->SetBackgroundWidget(internal::CreateDesktopBackground()); |
575 root_window_layout_->SetBackgroundLayer(NULL); | 575 root_window_layout_->SetBackgroundLayer(NULL); |
576 } | 576 } |
577 | 577 |
578 void Shell::ResetLayoutManager(int container_id) { | 578 void Shell::ResetLayoutManager(int container_id) { |
579 GetContainer(container_id)->SetLayoutManager(NULL); | 579 GetContainer(container_id)->SetLayoutManager(NULL); |
580 } | 580 } |
581 | 581 |
582 } // namespace ash | 582 } // namespace ash |
OLD | NEW |