| 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 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/accelerators/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
| 11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
| 12 #include "ash/caps_lock_delegate_stub.h" | 12 #include "ash/caps_lock_delegate_stub.h" |
| 13 #include "ash/desktop_background/desktop_background_controller.h" | 13 #include "ash/desktop_background/desktop_background_controller.h" |
| 14 #include "ash/desktop_background/desktop_background_resources.h" | 14 #include "ash/desktop_background/desktop_background_resources.h" |
| 15 #include "ash/desktop_background/desktop_background_view.h" | 15 #include "ash/desktop_background/desktop_background_view.h" |
| 16 #include "ash/display/display_controller.h" | 16 #include "ash/display/display_controller.h" |
| 17 #include "ash/display/mouse_cursor_event_filter.h" | 17 #include "ash/display/mouse_cursor_event_filter.h" |
| 18 #include "ash/display/multi_display_manager.h" | 18 #include "ash/display/multi_display_manager.h" |
| 19 #include "ash/display/screen_position_controller.h" | 19 #include "ash/display/screen_position_controller.h" |
| 20 #include "ash/display/secondary_display_view.h" | 20 #include "ash/display/secondary_display_view.h" |
| 21 #include "ash/drag_drop/drag_drop_controller.h" | 21 #include "ash/drag_drop/drag_drop_controller.h" |
| 22 #include "ash/focus_cycler.h" | 22 #include "ash/focus_cycler.h" |
| 23 #include "ash/high_contrast/high_contrast_controller.h" | 23 #include "ash/high_contrast/high_contrast_controller.h" |
| 24 #include "ash/launcher/launcher.h" | 24 #include "ash/launcher/launcher.h" |
| 25 #include "ash/magnifier/magnification_controller.h" | 25 #include "ash/magnifier/magnification_controller.h" |
| 26 #include "ash/magnifier/partial_magnification_controller.h" |
| 26 #include "ash/root_window_controller.h" | 27 #include "ash/root_window_controller.h" |
| 27 #include "ash/screen_ash.h" | 28 #include "ash/screen_ash.h" |
| 28 #include "ash/shell_context_menu.h" | 29 #include "ash/shell_context_menu.h" |
| 29 #include "ash/shell_delegate.h" | 30 #include "ash/shell_delegate.h" |
| 30 #include "ash/shell_factory.h" | 31 #include "ash/shell_factory.h" |
| 31 #include "ash/shell_window_ids.h" | 32 #include "ash/shell_window_ids.h" |
| 32 #include "ash/system/status_area_widget.h" | 33 #include "ash/system/status_area_widget.h" |
| 33 #include "ash/system/tray/system_tray.h" | 34 #include "ash/system/tray/system_tray.h" |
| 34 #include "ash/tooltips/tooltip_controller.h" | 35 #include "ash/tooltips/tooltip_controller.h" |
| 35 #include "ash/touch/touch_observer_hud.h" | 36 #include "ash/touch/touch_observer_hud.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 #include "ui/compositor/layer.h" | 83 #include "ui/compositor/layer.h" |
| 83 #include "ui/compositor/layer_animator.h" | 84 #include "ui/compositor/layer_animator.h" |
| 84 #include "ui/gfx/display.h" | 85 #include "ui/gfx/display.h" |
| 85 #include "ui/gfx/image/image_skia.h" | 86 #include "ui/gfx/image/image_skia.h" |
| 86 #include "ui/gfx/screen.h" | 87 #include "ui/gfx/screen.h" |
| 87 #include "ui/gfx/size.h" | 88 #include "ui/gfx/size.h" |
| 88 #include "ui/ui_controls/ui_controls.h" | 89 #include "ui/ui_controls/ui_controls.h" |
| 89 #include "ui/views/focus/focus_manager_factory.h" | 90 #include "ui/views/focus/focus_manager_factory.h" |
| 90 #include "ui/views/widget/native_widget_aura.h" | 91 #include "ui/views/widget/native_widget_aura.h" |
| 91 #include "ui/views/widget/widget.h" | 92 #include "ui/views/widget/widget.h" |
| 93 #include "ui/views/widget/widget_delegate.h" |
| 92 | 94 |
| 93 #if !defined(OS_MACOSX) | 95 #if !defined(OS_MACOSX) |
| 94 #include "ash/accelerators/accelerator_controller.h" | 96 #include "ash/accelerators/accelerator_controller.h" |
| 95 #include "ash/accelerators/accelerator_filter.h" | 97 #include "ash/accelerators/accelerator_filter.h" |
| 96 #include "ash/accelerators/nested_dispatcher_controller.h" | 98 #include "ash/accelerators/nested_dispatcher_controller.h" |
| 97 #endif | 99 #endif |
| 98 | 100 |
| 99 #if defined(OS_CHROMEOS) | 101 #if defined(OS_CHROMEOS) |
| 100 #include "ash/display/output_configurator_animation.h" | 102 #include "ash/display/output_configurator_animation.h" |
| 101 #include "base/message_pump_aurax11.h" | 103 #include "base/message_pump_aurax11.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // Closing the windows frees the workspace controller. | 247 // Closing the windows frees the workspace controller. |
| 246 shelf_->set_workspace_controller(NULL); | 248 shelf_->set_workspace_controller(NULL); |
| 247 // Destroy all child windows including widgets. | 249 // Destroy all child windows including widgets. |
| 248 display_controller_->CloseChildWindows(); | 250 display_controller_->CloseChildWindows(); |
| 249 | 251 |
| 250 // These need a valid Shell instance to clean up properly, so explicitly | 252 // These need a valid Shell instance to clean up properly, so explicitly |
| 251 // delete them before invalidating the instance. | 253 // delete them before invalidating the instance. |
| 252 // Alphabetical. | 254 // Alphabetical. |
| 253 drag_drop_controller_.reset(); | 255 drag_drop_controller_.reset(); |
| 254 magnification_controller_.reset(); | 256 magnification_controller_.reset(); |
| 257 partial_magnification_controller_.reset(); |
| 255 power_button_controller_.reset(); | 258 power_button_controller_.reset(); |
| 256 resize_shadow_controller_.reset(); | 259 resize_shadow_controller_.reset(); |
| 257 shadow_controller_.reset(); | 260 shadow_controller_.reset(); |
| 258 tooltip_controller_.reset(); | 261 tooltip_controller_.reset(); |
| 259 event_client_.reset(); | 262 event_client_.reset(); |
| 260 window_cycle_controller_.reset(); | 263 window_cycle_controller_.reset(); |
| 261 capture_controller_.reset(); | 264 capture_controller_.reset(); |
| 262 nested_dispatcher_controller_.reset(); | 265 nested_dispatcher_controller_.reset(); |
| 263 user_action_client_.reset(); | 266 user_action_client_.reset(); |
| 264 visibility_controller_.reset(); | 267 visibility_controller_.reset(); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 visibility_controller_.reset(new internal::VisibilityController); | 442 visibility_controller_.reset(new internal::VisibilityController); |
| 440 drag_drop_controller_.reset(new internal::DragDropController); | 443 drag_drop_controller_.reset(new internal::DragDropController); |
| 441 if (delegate_.get()) | 444 if (delegate_.get()) |
| 442 user_action_client_.reset(delegate_->CreateUserActionClient()); | 445 user_action_client_.reset(delegate_->CreateUserActionClient()); |
| 443 window_modality_controller_.reset(new internal::WindowModalityController); | 446 window_modality_controller_.reset(new internal::WindowModalityController); |
| 444 AddEnvEventFilter(window_modality_controller_.get()); | 447 AddEnvEventFilter(window_modality_controller_.get()); |
| 445 | 448 |
| 446 magnification_controller_.reset( | 449 magnification_controller_.reset( |
| 447 internal::MagnificationController::CreateInstance()); | 450 internal::MagnificationController::CreateInstance()); |
| 448 | 451 |
| 452 partial_magnification_controller_.reset( |
| 453 internal::PartialMagnificationController::CreateInstance()); |
| 454 |
| 449 high_contrast_controller_.reset(new HighContrastController); | 455 high_contrast_controller_.reset(new HighContrastController); |
| 450 video_detector_.reset(new VideoDetector); | 456 video_detector_.reset(new VideoDetector); |
| 451 window_cycle_controller_.reset( | 457 window_cycle_controller_.reset( |
| 452 new WindowCycleController(activation_controller_.get())); | 458 new WindowCycleController(activation_controller_.get())); |
| 453 | 459 |
| 454 tooltip_controller_.reset(new internal::TooltipController( | 460 tooltip_controller_.reset(new internal::TooltipController( |
| 455 drag_drop_controller_.get())); | 461 drag_drop_controller_.get())); |
| 456 AddEnvEventFilter(tooltip_controller_.get()); | 462 AddEnvEventFilter(tooltip_controller_.get()); |
| 457 | 463 |
| 458 event_client_.reset(new internal::EventClientImpl); | 464 event_client_.reset(new internal::EventClientImpl); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 | 506 |
| 501 // It needs to be created after OnWindowResized has been called, otherwise the | 507 // It needs to be created after OnWindowResized has been called, otherwise the |
| 502 // widget will not paint when restoring after a browser crash. Also it needs | 508 // widget will not paint when restoring after a browser crash. Also it needs |
| 503 // to be created after InitSecondaryDisplays() to initialize the wallpapers in | 509 // to be created after InitSecondaryDisplays() to initialize the wallpapers in |
| 504 // the correct size. | 510 // the correct size. |
| 505 user_wallpaper_delegate_->InitializeWallpaper(); | 511 user_wallpaper_delegate_->InitializeWallpaper(); |
| 506 | 512 |
| 507 power_button_controller_.reset(new PowerButtonController); | 513 power_button_controller_.reset(new PowerButtonController); |
| 508 AddShellObserver(power_button_controller_.get()); | 514 AddShellObserver(power_button_controller_.get()); |
| 509 | 515 |
| 516 //display_controller_->InitSecondaryDisplays(); |
| 517 |
| 510 if (initially_hide_cursor_) | 518 if (initially_hide_cursor_) |
| 511 cursor_manager_.ShowCursor(false); | 519 cursor_manager_.ShowCursor(false); |
| 512 | 520 |
| 513 // Cursor might have been hidden by somethign other than chrome. | 521 // Cursor might have been hidden by somethign other than chrome. |
| 514 // Let the first mouse event show the cursor. | 522 // Let the first mouse event show the cursor. |
| 515 env_filter_->set_cursor_hidden_by_filter(true); | 523 env_filter_->set_cursor_hidden_by_filter(true); |
| 516 } | 524 } |
| 517 | 525 |
| 518 void Shell::AddEnvEventFilter(aura::EventFilter* filter) { | 526 void Shell::AddEnvEventFilter(aura::EventFilter* filter) { |
| 519 aura::Env::GetInstance()->AddPreTargetHandler(filter); | 527 aura::Env::GetInstance()->AddPreTargetHandler(filter); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 iter != controllers.end(); ++iter) { | 833 iter != controllers.end(); ++iter) { |
| 826 if ((*iter)->GetSystemModalLayoutManager()-> | 834 if ((*iter)->GetSystemModalLayoutManager()-> |
| 827 CanWindowReceiveEvents(window)) { | 835 CanWindowReceiveEvents(window)) { |
| 828 return true; | 836 return true; |
| 829 } | 837 } |
| 830 } | 838 } |
| 831 return false; | 839 return false; |
| 832 } | 840 } |
| 833 | 841 |
| 834 } // namespace ash | 842 } // namespace ash |
| OLD | NEW |