summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorwittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-05 22:15:35 +0000
committerwittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-05 22:15:35 +0000
commit84685520948dcbf750736faa3e2bcc9dc430e861 (patch)
tree4bfc4086238f2f94355a689c142c5543b9664a09 /ash
parentf84973412773063d475d1b9f91540e6f6fa6e4da (diff)
downloadchromium_src-84685520948dcbf750736faa3e2bcc9dc430e861.zip
chromium_src-84685520948dcbf750736faa3e2bcc9dc430e861.tar.gz
chromium_src-84685520948dcbf750736faa3e2bcc9dc430e861.tar.bz2
Add synchronous Widget closing event
Adds a WidgetObserver event that is guaranteed to be invoked synchronously when a Widget is requested to close. Rename the existing event, which is invoked at Widget destruction time, typically via a task on the event loop, to OnWidgetDestroying. The new event will be used in Views-specific WebContentsModalDialogManager functionality to get close events for Widgets, so that we don't risk adverse interleaving of Widget close events with other relevant events (e.g. IPC). This will allow us to avoids test flakiness observed in https://codereview.chromium.org/12045037 due to event races in PrintPreviewTest.PrintCommands BUG=157161 Review URL: https://chromiumcodereview.appspot.com/12089061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180796 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/desktop_background/desktop_background_view.cc2
-rw-r--r--ash/desktop_background/desktop_background_widget_controller.cc3
-rw-r--r--ash/desktop_background/desktop_background_widget_controller.h2
-rw-r--r--ash/launcher/overflow_bubble.cc2
-rw-r--r--ash/launcher/overflow_bubble.h2
-rw-r--r--ash/magnifier/partial_magnification_controller.cc2
-rw-r--r--ash/magnifier/partial_magnification_controller.h2
-rw-r--r--ash/system/tray/tray_bubble_wrapper.cc2
-rw-r--r--ash/system/tray/tray_bubble_wrapper.h2
-rw-r--r--ash/system/web_notification/web_notification_tray.cc2
-rw-r--r--ash/system/web_notification/web_notification_tray.h2
-rw-r--r--ash/tooltips/tooltip_controller.cc2
-rw-r--r--ash/touch/touch_observer_hud.cc4
-rw-r--r--ash/touch/touch_observer_hud.h2
-rw-r--r--ash/wm/app_list_controller.cc2
-rw-r--r--ash/wm/app_list_controller.h2
-rw-r--r--ash/wm/gestures/tray_gesture_handler.cc2
-rw-r--r--ash/wm/gestures/tray_gesture_handler.h2
-rw-r--r--ash/wm/maximize_bubble_controller.cc7
-rw-r--r--ash/wm/partial_screenshot_view.cc2
20 files changed, 25 insertions, 23 deletions
diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc
index 3590853..0675bc9 100644
--- a/ash/desktop_background/desktop_background_view.cc
+++ b/ash/desktop_background/desktop_background_view.cc
@@ -82,7 +82,7 @@ class ShowWallpaperAnimationObserver : public ui::ImplicitAnimationObserver,
}
// Overridden from views::WidgetObserver.
- virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE {
+ virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE {
desktop_widget_->RemoveObserver(this);
desktop_widget_ = NULL;
}
diff --git a/ash/desktop_background/desktop_background_widget_controller.cc b/ash/desktop_background/desktop_background_widget_controller.cc
index 530dc0e..5b93452 100644
--- a/ash/desktop_background/desktop_background_widget_controller.cc
+++ b/ash/desktop_background/desktop_background_widget_controller.cc
@@ -43,7 +43,8 @@ DesktopBackgroundWidgetController::~DesktopBackgroundWidgetController() {
layer_.reset(NULL);
}
-void DesktopBackgroundWidgetController::OnWidgetClosing(views::Widget* widget) {
+void DesktopBackgroundWidgetController::OnWidgetDestroying(
+ views::Widget* widget) {
widget_->RemoveObserver(this);
widget_ = NULL;
}
diff --git a/ash/desktop_background/desktop_background_widget_controller.h b/ash/desktop_background/desktop_background_widget_controller.h
index 27defa9..bf94619 100644
--- a/ash/desktop_background/desktop_background_widget_controller.h
+++ b/ash/desktop_background/desktop_background_widget_controller.h
@@ -32,7 +32,7 @@ class ASH_EXPORT DesktopBackgroundWidgetController
virtual ~DesktopBackgroundWidgetController();
// Overridden from views::WidgetObserver.
- virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
+ virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
// Set bounds of component that draws background.
void SetBounds(gfx::Rect bounds);
diff --git a/ash/launcher/overflow_bubble.cc b/ash/launcher/overflow_bubble.cc
index e76e340..601090e 100644
--- a/ash/launcher/overflow_bubble.cc
+++ b/ash/launcher/overflow_bubble.cc
@@ -268,7 +268,7 @@ void OverflowBubble::Hide() {
launcher_view_ = NULL;
}
-void OverflowBubble::OnWidgetClosing(views::Widget* widget) {
+void OverflowBubble::OnWidgetDestroying(views::Widget* widget) {
DCHECK(widget == bubble_->GetWidget());
bubble_ = NULL;
launcher_view_ = NULL;
diff --git a/ash/launcher/overflow_bubble.h b/ash/launcher/overflow_bubble.h
index 582680a..84fbcc1 100644
--- a/ash/launcher/overflow_bubble.h
+++ b/ash/launcher/overflow_bubble.h
@@ -38,7 +38,7 @@ class OverflowBubble : public views::WidgetObserver {
private:
// Overridden from views::WidgetObserver:
- virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
+ virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
views::View* bubble_; // Owned by views hierarchy.
LauncherView* launcher_view_; // Owned by |bubble_|.
diff --git a/ash/magnifier/partial_magnification_controller.cc b/ash/magnifier/partial_magnification_controller.cc
index 2a4ab84..3020511 100644
--- a/ash/magnifier/partial_magnification_controller.cc
+++ b/ash/magnifier/partial_magnification_controller.cc
@@ -104,7 +104,7 @@ void PartialMagnificationController::OnWindowDestroying(
SwitchTargetRootWindow(new_root_window);
}
-void PartialMagnificationController::OnWidgetClosing(
+void PartialMagnificationController::OnWidgetDestroying(
views::Widget* widget) {
DCHECK_EQ(widget, zoom_widget_);
RemoveZoomWidgetObservers();
diff --git a/ash/magnifier/partial_magnification_controller.h b/ash/magnifier/partial_magnification_controller.h
index dc95360c..1b8c8fb 100644
--- a/ash/magnifier/partial_magnification_controller.h
+++ b/ash/magnifier/partial_magnification_controller.h
@@ -73,7 +73,7 @@ class PartialMagnificationController
virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
// Overridden from WidgetObserver:
- virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
+ virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
// True if the magnified window is in motion of zooming or un-zooming effect.
// Otherwise, false.
diff --git a/ash/system/tray/tray_bubble_wrapper.cc b/ash/system/tray/tray_bubble_wrapper.cc
index 91efd61..01b4ba0 100644
--- a/ash/system/tray/tray_bubble_wrapper.cc
+++ b/ash/system/tray/tray_bubble_wrapper.cc
@@ -37,7 +37,7 @@ TrayBubbleWrapper::~TrayBubbleWrapper() {
}
}
-void TrayBubbleWrapper::OnWidgetClosing(views::Widget* widget) {
+void TrayBubbleWrapper::OnWidgetDestroying(views::Widget* widget) {
CHECK_EQ(bubble_widget_, widget);
bubble_widget_ = NULL;
tray_->HideBubbleWithView(bubble_view_); // May destroy |bubble_view_|
diff --git a/ash/system/tray/tray_bubble_wrapper.h b/ash/system/tray/tray_bubble_wrapper.h
index 47fdf0d..3af47d5 100644
--- a/ash/system/tray/tray_bubble_wrapper.h
+++ b/ash/system/tray/tray_bubble_wrapper.h
@@ -28,7 +28,7 @@ class TrayBubbleWrapper : public views::WidgetObserver {
virtual ~TrayBubbleWrapper();
// views::WidgetObserver overrides:
- virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
+ virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
TrayBackgroundView* tray() { return tray_; }
views::TrayBubbleView* bubble_view() { return bubble_view_; }
diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc
index f5672d8..4cb6f3b 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -343,7 +343,7 @@ void WebNotificationTray::ButtonPressed(views::Button* sender,
PerformAction(event);
}
-void WebNotificationTray::OnWidgetClosing(views::Widget* widget) {
+void WebNotificationTray::OnWidgetDestroying(views::Widget* widget) {
if (quiet_mode_bubble() && quiet_mode_bubble()->GetBubbleWidget() == widget) {
widget->RemoveObserver(this);
}
diff --git a/ash/system/web_notification/web_notification_tray.h b/ash/system/web_notification/web_notification_tray.h
index 585f457..1466c29 100644
--- a/ash/system/web_notification/web_notification_tray.h
+++ b/ash/system/web_notification/web_notification_tray.h
@@ -89,7 +89,7 @@ class ASH_EXPORT WebNotificationTray
const ui::Event& event) OVERRIDE;
// Overridden from WidgetObserver.
- virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
+ virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
// Overridden from MessageCenterTrayDelegate.
virtual void OnMessageCenterTrayChanged() OVERRIDE;
diff --git a/ash/tooltips/tooltip_controller.cc b/ash/tooltips/tooltip_controller.cc
index 391b4a6..60aed7c 100644
--- a/ash/tooltips/tooltip_controller.cc
+++ b/ash/tooltips/tooltip_controller.cc
@@ -152,7 +152,7 @@ class TooltipController::Tooltip : public views::WidgetObserver {
}
// Overriden from views::WidgetObserver.
- virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE {
+ virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE {
DCHECK_EQ(widget_, widget);
widget_ = NULL;
}
diff --git a/ash/touch/touch_observer_hud.cc b/ash/touch/touch_observer_hud.cc
index 05d0d87..195ae0b 100644
--- a/ash/touch/touch_observer_hud.cc
+++ b/ash/touch/touch_observer_hud.cc
@@ -295,7 +295,7 @@ TouchObserverHUD::TouchObserverHUD() {
widget_->Show();
// The TouchObserverHUD's lifetime is always more than |widget_|. The
- // |widget_| is unset from the OnWidgetClosing callback.
+ // |widget_| is unset from the OnWidgetDestroying callback.
widget_->AddObserver(this);
}
@@ -374,7 +374,7 @@ void TouchObserverHUD::OnTouchEvent(ui::TouchEvent* event) {
label_container_->SetSize(label_container_->GetPreferredSize());
}
-void TouchObserverHUD::OnWidgetClosing(views::Widget* widget) {
+void TouchObserverHUD::OnWidgetDestroying(views::Widget* widget) {
DCHECK_EQ(widget, widget_);
widget_ = NULL;
}
diff --git a/ash/touch/touch_observer_hud.h b/ash/touch/touch_observer_hud.h
index c4f3aa3..5a08633 100644
--- a/ash/touch/touch_observer_hud.h
+++ b/ash/touch/touch_observer_hud.h
@@ -50,7 +50,7 @@ class ASH_EXPORT TouchObserverHUD : public ui::EventHandler,
virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
// Overridden from views::WidgetObserver:
- virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
+ virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
static const int kMaxTouchPoints = 32;
diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc
index c95e1a4..17ea495 100644
--- a/ash/wm/app_list_controller.cc
+++ b/ash/wm/app_list_controller.cc
@@ -276,7 +276,7 @@ void AppListController::OnImplicitAnimationsCompleted() {
////////////////////////////////////////////////////////////////////////////////
// AppListController, views::WidgetObserver implementation:
-void AppListController::OnWidgetClosing(views::Widget* widget) {
+void AppListController::OnWidgetDestroying(views::Widget* widget) {
DCHECK(view_->GetWidget() == widget);
if (is_visible_)
SetVisible(false, widget->GetNativeView());
diff --git a/ash/wm/app_list_controller.h b/ash/wm/app_list_controller.h
index c1abead..d2408d8 100644
--- a/ash/wm/app_list_controller.h
+++ b/ash/wm/app_list_controller.h
@@ -92,7 +92,7 @@ class AppListController : public ui::EventHandler,
virtual void OnImplicitAnimationsCompleted() OVERRIDE;
// views::WidgetObserver overrides:
- virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
+ virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
// ShellObserver overrides:
virtual void OnShelfAlignmentChanged(aura::RootWindow* root_window) OVERRIDE;
diff --git a/ash/wm/gestures/tray_gesture_handler.cc b/ash/wm/gestures/tray_gesture_handler.cc
index 5eabccb9f..78b0fb3 100644
--- a/ash/wm/gestures/tray_gesture_handler.cc
+++ b/ash/wm/gestures/tray_gesture_handler.cc
@@ -100,7 +100,7 @@ void TrayGestureHandler::CompleteGestureDrag(const ui::GestureEvent& event) {
}
}
-void TrayGestureHandler::OnWidgetClosing(views::Widget* widget) {
+void TrayGestureHandler::OnWidgetDestroying(views::Widget* widget) {
CHECK_EQ(widget_, widget);
widget_ = NULL;
}
diff --git a/ash/wm/gestures/tray_gesture_handler.h b/ash/wm/gestures/tray_gesture_handler.h
index 7894ecf..34f033b 100644
--- a/ash/wm/gestures/tray_gesture_handler.h
+++ b/ash/wm/gestures/tray_gesture_handler.h
@@ -31,7 +31,7 @@ class TrayGestureHandler : public views::WidgetObserver {
void CompleteGestureDrag(const ui::GestureEvent& event);
private:
- virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
+ virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
// The widget for the tray-bubble.
views::Widget* widget_;
diff --git a/ash/wm/maximize_bubble_controller.cc b/ash/wm/maximize_bubble_controller.cc
index 7b875ec..be2c63b 100644
--- a/ash/wm/maximize_bubble_controller.cc
+++ b/ash/wm/maximize_bubble_controller.cc
@@ -236,7 +236,7 @@ class MaximizeBubbleController::Bubble : public views::BubbleDelegateView,
virtual gfx::Size GetPreferredSize() OVERRIDE;
// Overridden from views::Widget::Observer.
- virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
+ virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
// Called from the controller class to indicate that the menu should get
// destroyed.
@@ -522,7 +522,8 @@ gfx::Size MaximizeBubbleController::Bubble::GetPreferredSize() {
return contents_view_->GetPreferredSize();
}
-void MaximizeBubbleController::Bubble::OnWidgetClosing(views::Widget* widget) {
+void MaximizeBubbleController::Bubble::OnWidgetDestroying(
+ views::Widget* widget) {
if (bubble_widget_ == widget) {
mouse_watcher_->Stop();
@@ -535,7 +536,7 @@ void MaximizeBubbleController::Bubble::OnWidgetClosing(views::Widget* widget) {
owner_ = NULL;
}
}
- BubbleDelegateView::OnWidgetClosing(widget);
+ BubbleDelegateView::OnWidgetDestroying(widget);
}
void MaximizeBubbleController::Bubble::ControllerRequestsCloseAndDelete() {
diff --git a/ash/wm/partial_screenshot_view.cc b/ash/wm/partial_screenshot_view.cc
index 8680509..e92d807 100644
--- a/ash/wm/partial_screenshot_view.cc
+++ b/ash/wm/partial_screenshot_view.cc
@@ -61,7 +61,7 @@ class PartialScreenshotView::OverlayDelegate
}
// Overridden from views::WidgetObserver:
- virtual void OnWidgetClosing(views::Widget* widget) {
+ virtual void OnWidgetDestroying(views::Widget* widget) {
widget->RemoveObserver(this);
widgets_.erase(std::remove(widgets_.begin(), widgets_.end(), widget));
if (widgets_.empty())