| 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/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 gpu::GPU_FEATURE_TYPE_PANEL_FITTING); | 187 gpu::GPU_FEATURE_TYPE_PANEL_FITTING); |
| 188 | 188 |
| 189 output_configurator_->Init(!is_panel_fitting_disabled); | 189 output_configurator_->Init(!is_panel_fitting_disabled); |
| 190 | 190 |
| 191 base::MessagePumpX11::Current()->AddDispatcherForRootWindow( | 191 base::MessagePumpX11::Current()->AddDispatcherForRootWindow( |
| 192 output_configurator()); | 192 output_configurator()); |
| 193 // We can't do this with a root window listener because XI_HierarchyChanged | 193 // We can't do this with a root window listener because XI_HierarchyChanged |
| 194 // messages don't have a target window. | 194 // messages don't have a target window. |
| 195 base::MessagePumpX11::Current()->AddObserver(output_configurator()); | 195 base::MessagePumpX11::Current()->AddObserver(output_configurator()); |
| 196 #endif // defined(OS_CHROMEOS) | 196 #endif // defined(OS_CHROMEOS) |
| 197 AddPreTargetHandler(this); | |
| 198 | 197 |
| 199 #if defined(OS_CHROMEOS) | 198 #if defined(OS_CHROMEOS) |
| 200 internal::PowerStatus::Initialize(); | 199 internal::PowerStatus::Initialize(); |
| 201 #endif | 200 #endif |
| 202 } | 201 } |
| 203 | 202 |
| 204 Shell::~Shell() { | 203 Shell::~Shell() { |
| 205 TRACE_EVENT0("shutdown", "ash::Shell::Destructor"); | 204 TRACE_EVENT0("shutdown", "ash::Shell::Destructor"); |
| 206 | 205 |
| 207 views::FocusManagerFactory::Install(NULL); | 206 views::FocusManagerFactory::Install(NULL); |
| 208 | 207 |
| 209 // Remove the focus from any window. This will prevent overhead and side | 208 // Remove the focus from any window. This will prevent overhead and side |
| 210 // effects (e.g. crashes) from changing focus during shutdown. | 209 // effects (e.g. crashes) from changing focus during shutdown. |
| 211 // See bug crbug.com/134502. | 210 // See bug crbug.com/134502. |
| 212 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(NULL); | 211 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(NULL); |
| 213 | 212 |
| 214 // Please keep in same order as in Init() because it's easy to miss one. | 213 // Please keep in same order as in Init() because it's easy to miss one. |
| 215 RemovePreTargetHandler(event_rewriter_filter_.get()); | 214 RemovePreTargetHandler(event_rewriter_filter_.get()); |
| 216 RemovePreTargetHandler(user_activity_detector_.get()); | 215 RemovePreTargetHandler(user_activity_detector_.get()); |
| 217 RemovePreTargetHandler(overlay_filter_.get()); | 216 RemovePreTargetHandler(overlay_filter_.get()); |
| 218 RemovePreTargetHandler(input_method_filter_.get()); | 217 RemovePreTargetHandler(input_method_filter_.get()); |
| 219 RemovePreTargetHandler(window_modality_controller_.get()); | |
| 220 if (mouse_cursor_filter_) | 218 if (mouse_cursor_filter_) |
| 221 RemovePreTargetHandler(mouse_cursor_filter_.get()); | 219 RemovePreTargetHandler(mouse_cursor_filter_.get()); |
| 222 RemovePreTargetHandler(system_gesture_filter_.get()); | 220 RemovePreTargetHandler(system_gesture_filter_.get()); |
| 223 RemovePreTargetHandler(keyboard_metrics_filter_.get()); | 221 RemovePreTargetHandler(keyboard_metrics_filter_.get()); |
| 224 RemovePreTargetHandler(event_transformation_handler_.get()); | 222 RemovePreTargetHandler(event_transformation_handler_.get()); |
| 225 RemovePreTargetHandler(accelerator_filter_.get()); | 223 RemovePreTargetHandler(accelerator_filter_.get()); |
| 226 | 224 |
| 227 // TooltipController is deleted with the Shell so removing its references. | 225 // TooltipController is deleted with the Shell so removing its references. |
| 228 RemovePreTargetHandler(tooltip_controller_.get()); | 226 RemovePreTargetHandler(tooltip_controller_.get()); |
| 229 | 227 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 display_initialized = true; | 420 display_initialized = true; |
| 423 } | 421 } |
| 424 #endif // defined(OS_CHROMEOS) && defined(USE_X11) | 422 #endif // defined(OS_CHROMEOS) && defined(USE_X11) |
| 425 if (!display_initialized) | 423 if (!display_initialized) |
| 426 display_manager_->InitFromCommandLine(); | 424 display_manager_->InitFromCommandLine(); |
| 427 | 425 |
| 428 // Install the custom factory first so that views::FocusManagers for Tray, | 426 // Install the custom factory first so that views::FocusManagers for Tray, |
| 429 // Launcher, and WallPaper could be created by the factory. | 427 // Launcher, and WallPaper could be created by the factory. |
| 430 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | 428 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
| 431 | 429 |
| 430 // The WindowModalityController needs to be at the front of the input event |
| 431 // pretarget handler list to ensure that it processes input events when modal |
| 432 // windows are active. |
| 433 window_modality_controller_.reset( |
| 434 new views::corewm::WindowModalityController(this)); |
| 435 |
| 436 AddPreTargetHandler(this); |
| 437 |
| 432 env_filter_.reset(new views::corewm::CompoundEventFilter); | 438 env_filter_.reset(new views::corewm::CompoundEventFilter); |
| 433 AddPreTargetHandler(env_filter_.get()); | 439 AddPreTargetHandler(env_filter_.get()); |
| 434 | 440 |
| 435 // Env creates the compositor. Historically it seems to have been implicitly | 441 // Env creates the compositor. Historically it seems to have been implicitly |
| 436 // initialized first by the ActivationController, but now that FocusController | 442 // initialized first by the ActivationController, but now that FocusController |
| 437 // no longer does this we need to do it explicitly. | 443 // no longer does this we need to do it explicitly. |
| 438 aura::Env::GetInstance(); | 444 aura::Env::GetInstance(); |
| 439 views::corewm::FocusController* focus_controller = | 445 views::corewm::FocusController* focus_controller = |
| 440 new views::corewm::FocusController(new wm::AshFocusRules); | 446 new views::corewm::FocusController(new wm::AshFocusRules); |
| 441 focus_client_.reset(focus_controller); | 447 focus_client_.reset(focus_controller); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 | 509 |
| 504 drag_drop_controller_.reset(new internal::DragDropController); | 510 drag_drop_controller_.reset(new internal::DragDropController); |
| 505 mouse_cursor_filter_.reset(new internal::MouseCursorEventFilter()); | 511 mouse_cursor_filter_.reset(new internal::MouseCursorEventFilter()); |
| 506 PrependPreTargetHandler(mouse_cursor_filter_.get()); | 512 PrependPreTargetHandler(mouse_cursor_filter_.get()); |
| 507 | 513 |
| 508 // Create Controllers that may need root window. | 514 // Create Controllers that may need root window. |
| 509 // TODO(oshima): Move as many controllers before creating | 515 // TODO(oshima): Move as many controllers before creating |
| 510 // RootWindowController as possible. | 516 // RootWindowController as possible. |
| 511 visibility_controller_.reset(new AshVisibilityController); | 517 visibility_controller_.reset(new AshVisibilityController); |
| 512 user_action_client_.reset(delegate_->CreateUserActionClient()); | 518 user_action_client_.reset(delegate_->CreateUserActionClient()); |
| 513 window_modality_controller_.reset( | |
| 514 new views::corewm::WindowModalityController); | |
| 515 AddPreTargetHandler(window_modality_controller_.get()); | |
| 516 | 519 |
| 517 magnification_controller_.reset( | 520 magnification_controller_.reset( |
| 518 MagnificationController::CreateInstance()); | 521 MagnificationController::CreateInstance()); |
| 519 mru_window_tracker_.reset(new MruWindowTracker(activation_client_)); | 522 mru_window_tracker_.reset(new MruWindowTracker(activation_client_)); |
| 520 | 523 |
| 521 partial_magnification_controller_.reset( | 524 partial_magnification_controller_.reset( |
| 522 new PartialMagnificationController()); | 525 new PartialMagnificationController()); |
| 523 | 526 |
| 524 high_contrast_controller_.reset(new HighContrastController); | 527 high_contrast_controller_.reset(new HighContrastController); |
| 525 video_detector_.reset(new VideoDetector); | 528 video_detector_.reset(new VideoDetector); |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 //////////////////////////////////////////////////////////////////////////////// | 937 //////////////////////////////////////////////////////////////////////////////// |
| 935 // Shell, aura::client::ActivationChangeObserver implementation: | 938 // Shell, aura::client::ActivationChangeObserver implementation: |
| 936 | 939 |
| 937 void Shell::OnWindowActivated(aura::Window* gained_active, | 940 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 938 aura::Window* lost_active) { | 941 aura::Window* lost_active) { |
| 939 if (gained_active) | 942 if (gained_active) |
| 940 target_root_window_ = gained_active->GetRootWindow(); | 943 target_root_window_ = gained_active->GetRootWindow(); |
| 941 } | 944 } |
| 942 | 945 |
| 943 } // namespace ash | 946 } // namespace ash |
| OLD | NEW |