Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: ash/shell.cc

Issue 25445002: Ensure that in Desktop AURA the WindowModalityController class is at the head of the event pre targ… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 window_modality_controller_.reset(
sky 2013/10/02 15:54:12 Add comment that order is important here.
ananta 2013/10/02 17:46:55 Done.
431 new views::corewm::WindowModalityController(this));
432
433 AddPreTargetHandler(this);
434
432 env_filter_.reset(new views::corewm::CompoundEventFilter); 435 env_filter_.reset(new views::corewm::CompoundEventFilter);
433 AddPreTargetHandler(env_filter_.get()); 436 AddPreTargetHandler(env_filter_.get());
434 437
435 // Env creates the compositor. Historically it seems to have been implicitly 438 // Env creates the compositor. Historically it seems to have been implicitly
436 // initialized first by the ActivationController, but now that FocusController 439 // initialized first by the ActivationController, but now that FocusController
437 // no longer does this we need to do it explicitly. 440 // no longer does this we need to do it explicitly.
438 aura::Env::GetInstance(); 441 aura::Env::GetInstance();
439 views::corewm::FocusController* focus_controller = 442 views::corewm::FocusController* focus_controller =
440 new views::corewm::FocusController(new wm::AshFocusRules); 443 new views::corewm::FocusController(new wm::AshFocusRules);
441 focus_client_.reset(focus_controller); 444 focus_client_.reset(focus_controller);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 506
504 drag_drop_controller_.reset(new internal::DragDropController); 507 drag_drop_controller_.reset(new internal::DragDropController);
505 mouse_cursor_filter_.reset(new internal::MouseCursorEventFilter()); 508 mouse_cursor_filter_.reset(new internal::MouseCursorEventFilter());
506 PrependPreTargetHandler(mouse_cursor_filter_.get()); 509 PrependPreTargetHandler(mouse_cursor_filter_.get());
507 510
508 // Create Controllers that may need root window. 511 // Create Controllers that may need root window.
509 // TODO(oshima): Move as many controllers before creating 512 // TODO(oshima): Move as many controllers before creating
510 // RootWindowController as possible. 513 // RootWindowController as possible.
511 visibility_controller_.reset(new AshVisibilityController); 514 visibility_controller_.reset(new AshVisibilityController);
512 user_action_client_.reset(delegate_->CreateUserActionClient()); 515 user_action_client_.reset(delegate_->CreateUserActionClient());
513 window_modality_controller_.reset(
514 new views::corewm::WindowModalityController);
515 AddPreTargetHandler(window_modality_controller_.get());
516 516
517 magnification_controller_.reset( 517 magnification_controller_.reset(
518 MagnificationController::CreateInstance()); 518 MagnificationController::CreateInstance());
519 mru_window_tracker_.reset(new MruWindowTracker(activation_client_)); 519 mru_window_tracker_.reset(new MruWindowTracker(activation_client_));
520 520
521 partial_magnification_controller_.reset( 521 partial_magnification_controller_.reset(
522 new PartialMagnificationController()); 522 new PartialMagnificationController());
523 523
524 high_contrast_controller_.reset(new HighContrastController); 524 high_contrast_controller_.reset(new HighContrastController);
525 video_detector_.reset(new VideoDetector); 525 video_detector_.reset(new VideoDetector);
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 //////////////////////////////////////////////////////////////////////////////// 934 ////////////////////////////////////////////////////////////////////////////////
935 // Shell, aura::client::ActivationChangeObserver implementation: 935 // Shell, aura::client::ActivationChangeObserver implementation:
936 936
937 void Shell::OnWindowActivated(aura::Window* gained_active, 937 void Shell::OnWindowActivated(aura::Window* gained_active,
938 aura::Window* lost_active) { 938 aura::Window* lost_active) {
939 if (gained_active) 939 if (gained_active)
940 target_root_window_ = gained_active->GetRootWindow(); 940 target_root_window_ = gained_active->GetRootWindow();
941 } 941 }
942 942
943 } // namespace ash 943 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/events/event_target.h » ('j') | ui/views/widget/desktop_aura/desktop_native_widget_aura.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698