summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/extension_popup_api.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/chrome/browser/extensions/extension_popup_api.cc b/chrome/browser/extensions/extension_popup_api.cc
index 504a7a07..d8d7262 100644
--- a/chrome/browser/extensions/extension_popup_api.cc
+++ b/chrome/browser/extensions/extension_popup_api.cc
@@ -72,7 +72,7 @@ class ExtensionPopupHost : public ExtensionPopup::Observer,
public:
explicit ExtensionPopupHost(ExtensionFunctionDispatcher* dispatcher)
: dispatcher_(dispatcher), popup_(NULL) {
- AddRef(); // Balanced in ExtensionPopupClosed().
+ AddRef(); // Balanced in DispatchPopupClosedEvent().
views::FocusManager::GetWidgetFocusManager()->AddFocusChangeListener(this);
}
@@ -87,6 +87,13 @@ class ExtensionPopupHost : public ExtensionPopup::Observer,
// Overriden from ExtensionPopup::Observer
virtual void ExtensionPopupClosed(ExtensionPopup* popup) {
+ // The OnPopupClosed event should be sent later to give the popup time to
+ // complete closing.
+ MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(this,
+ &ExtensionPopupHost::DispatchPopupClosedEvent));
+ }
+
+ virtual void DispatchPopupClosedEvent() {
RenderViewHost* render_view_host = dispatcher_->GetExtensionHost() ?
dispatcher_->GetExtensionHost()->render_view_host() :
dispatcher_->GetExtensionDOMUI()->GetRenderViewHost();