Index: content/browser/frame_host/popup_menu_helper_mac.h |
diff --git a/content/browser/frame_host/popup_menu_helper_mac.h b/content/browser/frame_host/popup_menu_helper_mac.h |
index 27d3f718c5f4c28632ccbf6fb1bd4dd1fdecb7ab..3f19050fd88475254dfeb88c0666d06012ba514b 100644 |
--- a/content/browser/frame_host/popup_menu_helper_mac.h |
+++ b/content/browser/frame_host/popup_menu_helper_mac.h |
@@ -9,6 +9,7 @@ |
#include "base/compiler_specific.h" |
#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
#include "content/common/content_export.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
@@ -29,9 +30,15 @@ struct MenuItem; |
class PopupMenuHelper : public NotificationObserver { |
public: |
+ class Delegate { |
+ public: |
+ virtual void OnMenuClosed() = 0; |
+ }; |
Avi (use Gerrit)
2017/05/17 15:35:59
blank line after
tapted
2017/05/18 03:25:56
Done.
|
// Creates a PopupMenuHelper that will notify |render_frame_host| when a user |
- // selects or cancels the popup. |
- explicit PopupMenuHelper(RenderFrameHost* render_frame_host); |
+ // selects or cancels the popup. |delegate| is notified when the menu is |
+ // closed. |
+ PopupMenuHelper(Delegate* delegate, RenderFrameHost* render_frame_host); |
+ ~PopupMenuHelper() override; |
void Hide(); |
// Shows the popup menu and notifies the RenderFrameHost of the selection/ |
@@ -50,16 +57,21 @@ class PopupMenuHelper : public NotificationObserver { |
protected: |
virtual RenderWidgetHostViewMac* GetRenderWidgetHostView() const; |
+ private: |
// NotificationObserver implementation: |
void Observe(int type, |
const NotificationSource& source, |
const NotificationDetails& details) override; |
+ Delegate* delegate_; // Weak. Owns |this|. |
+ |
NotificationRegistrar notification_registrar_; |
RenderFrameHostImpl* render_frame_host_; |
WebMenuRunner* menu_runner_; |
bool popup_was_hidden_; |
+ base::WeakPtrFactory<PopupMenuHelper> weak_ptr_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(PopupMenuHelper); |
}; |