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

Unified Diff: content/browser/frame_host/popup_menu_helper_mac.mm

Issue 839573002: On Mac: Hide any popup menus on the active view before switching to another. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix moved to popup_menu_helper_mac.mm Created 5 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/popup_menu_helper_mac.mm
diff --git a/content/browser/frame_host/popup_menu_helper_mac.mm b/content/browser/frame_host/popup_menu_helper_mac.mm
index eac8f7c3b7a7db35900f64aa0a18752dbb7059a2..1ab1917d713db69be9d90f1f00e22c77e931a995 100644
--- a/content/browser/frame_host/popup_menu_helper_mac.mm
+++ b/content/browser/frame_host/popup_menu_helper_mac.mm
@@ -13,6 +13,7 @@
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
#include "content/browser/renderer_host/webmenurunner_mac.h"
+#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#import "ui/base/cocoa/base_view.h"
@@ -32,6 +33,9 @@ PopupMenuHelper::PopupMenuHelper(RenderFrameHost* render_frame_host)
notification_registrar_.Add(
this, NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
Source<RenderWidgetHost>(render_frame_host->GetRenderViewHost()));
+ notification_registrar_.Add(
+ this, NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
+ Source<RenderWidgetHost>(render_frame_host->GetRenderViewHost()));
}
void PopupMenuHelper::ShowPopupMenu(
@@ -119,10 +123,20 @@ RenderWidgetHostViewMac* PopupMenuHelper::GetRenderWidgetHostView() const {
void PopupMenuHelper::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED);
DCHECK_EQ(Source<RenderWidgetHost>(source).ptr(),
render_frame_host_->GetRenderViewHost());
- render_frame_host_ = NULL;
+ switch (type) {
+ case NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: {
+ render_frame_host_ = NULL;
+ break;
+ }
+ case NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED: {
+ bool is_visible = *Details<bool>(details).ptr();
+ if (!is_visible)
+ Hide();
+ break;
+ }
+ }
}
} // namespace content
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698