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

Unified Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.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 side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
===================================================================
--- ui/views/widget/desktop_aura/desktop_native_widget_aura.cc (revision 226057)
+++ ui/views/widget/desktop_aura/desktop_native_widget_aura.cc (working copy)
@@ -185,7 +185,8 @@
native_widget_delegate_(delegate),
last_drop_operation_(ui::DragDropTypes::DRAG_NONE),
restore_focus_on_activate_(false),
- cursor_(gfx::kNullCursor) {
+ cursor_(gfx::kNullCursor),
+ widget_type_(Widget::InitParams::TYPE_WINDOW) {
window_->SetProperty(kDesktopNativeWidgetAuraKey, this);
aura::client::SetFocusChangeObserver(window_, this);
aura::client::SetActivationChangeObserver(window_, this);
@@ -208,6 +209,11 @@
// Don't invoke Widget::OnNativeWidgetDestroying(), its done by
// DesktopRootWindowHost.
+ // The WindowModalityController is at the front of the event pretarget
+ // handler list. We destroy it first to preserve order symantics.
+ if (window_modality_controller_)
+ window_modality_controller_.reset();
+
// Make sure we don't still have capture. Otherwise CaptureController and
// RootWindow are left referencing a deleted Window.
{
@@ -222,10 +228,6 @@
shadow_controller_.reset();
tooltip_manager_.reset();
scoped_tooltip_client_.reset();
- if (window_modality_controller_) {
- root_window_->RemovePreTargetHandler(window_modality_controller_.get());
- window_modality_controller_.reset();
- }
root_window_event_filter_->RemoveHandler(input_method_event_filter_.get());
@@ -296,12 +298,23 @@
}
}
+void DesktopNativeWidgetAura::InstallWindowModalityController(
+ aura::RootWindow* root) {
+ // The WindowsModalityController event filter should be at the head of the
+ // pre target handlers list. This ensures that it handles input events first
+ // when modal windows are at the top of the Zorder.
+ if (widget_type_ == Widget::InitParams::TYPE_WINDOW)
+ window_modality_controller_.reset(
+ new views::corewm::WindowModalityController(root));
+}
+
////////////////////////////////////////////////////////////////////////////////
// DesktopNativeWidgetAura, internal::NativeWidgetPrivate implementation:
void DesktopNativeWidgetAura::InitNativeWidget(
const Widget::InitParams& params) {
ownership_ = params.ownership;
+ widget_type_ = params.type;
NativeWidgetAura::RegisterNativeWidgetForWindow(this, window_);
// Animations on TYPE_WINDOW are handled by the OS. Additionally if we animate
@@ -354,12 +367,6 @@
GetNativeView()->GetRootWindow());
}
- if (params.type == Widget::InitParams::TYPE_WINDOW) {
- window_modality_controller_.reset(
- new views::corewm::WindowModalityController);
- root_window_->AddPreTargetHandler(window_modality_controller_.get());
- }
-
window_->Show();
desktop_root_window_host_->InitFocus(window_);

Powered by Google App Engine
This is Rietveld 408576698