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

Unified Diff: chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc

Issue 13588007: Implement WebContentsModalDialogManagerDelegate for ShellWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove newlines in headers Created 7 years, 9 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
« no previous file with comments | « chrome/browser/ui/views/extensions/native_app_window_views.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc
diff --git a/chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc b/chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc
index 835d23fbb9ef8b678d9b817760cdecb8b5701a85..1821634680df3c972523329f1d02c8891e7fa604 100644
--- a/chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc
+++ b/chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc
@@ -104,7 +104,31 @@ class NativeWebContentsModalDialogManagerViews
}
// views::WidgetObserver overrides
+
+ // NOTE(wittman): OnWidgetClosing is overriden to ensure that, when the widget
+ // is explicitly closed, the destruction occurs within the same call
+ // stack. This avoids event races that lead to non-deterministic destruction
+ // ordering in e.g. the print preview dialog. OnWidgetDestroying is overridden
+ // because OnWidgetClosing is *only* invoked on explicit close, not when the
+ // widget is implicitly destroyed due to its parent being closed. This
+ // situation occurs with app windows. WidgetClosing removes the observer, so
+ // only one of these two functions is ever invoked for a given widget.
virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE {
+ WidgetClosing(widget);
+ }
+
+ virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE {
+ WidgetClosing(widget);
+ }
+
+ private:
+ static views::Widget* GetWidget(NativeWebContentsModalDialog dialog) {
+ views::Widget* widget = views::Widget::GetWidgetForNativeWindow(dialog);
+ DCHECK(widget);
+ return widget;
+ }
+
+ void WidgetClosing(views::Widget* widget) {
#if defined(USE_ASH)
gfx::NativeView view = platform_util::GetParent(widget->GetNativeView());
// Allow the parent to animate again.
@@ -116,13 +140,6 @@ class NativeWebContentsModalDialogManagerViews
observed_widgets_.erase(widget);
}
- private:
- static views::Widget* GetWidget(NativeWebContentsModalDialog dialog) {
- views::Widget* widget = views::Widget::GetWidgetForNativeWindow(dialog);
- DCHECK(widget);
- return widget;
- }
-
NativeWebContentsModalDialogManagerDelegate* native_delegate_;
std::set<views::Widget*> observed_widgets_;
« no previous file with comments | « chrome/browser/ui/views/extensions/native_app_window_views.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698