1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_POPUP_MENU_HELPER_MAC_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_POPUP_MENU_HELPER_MAC_H_
10 #include "base/compiler_specific.h"
11 #include "content/common/content_export.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14 #include "ui/gfx/rect.h"
20 class RenderViewHostImpl
;
21 class RenderWidgetHostViewMac
;
23 class PopupMenuHelper
: public NotificationObserver
{
25 // Creates a PopupMenuHelper that will notify |render_view_host| when a user
26 // selects or cancels the popup.
27 explicit PopupMenuHelper(RenderViewHost
* render_view_host
);
29 // Shows the popup menu and notifies the RenderViewHost of the selection/
31 // This call is blocking.
32 void ShowPopupMenu(const gfx::Rect
& bounds
,
34 double item_font_size
,
36 const std::vector
<WebMenuItem
>& items
,
38 bool allow_multiple_selection
);
40 // Immediately return from ShowPopupMenu.
41 CONTENT_EXPORT
static void DontShowPopupMenuForTesting();
44 virtual RenderWidgetHostViewMac
* GetRenderWidgetHostView() const;
46 // NotificationObserver implementation:
47 virtual void Observe(int type
,
48 const NotificationSource
& source
,
49 const NotificationDetails
& details
) OVERRIDE
;
51 NotificationRegistrar notification_registrar_
;
53 RenderViewHostImpl
* render_view_host_
;
55 DISALLOW_COPY_AND_ASSIGN(PopupMenuHelper
);
58 } // namespace content
60 #endif // CONTENT_BROWSER_RENDERER_HOST_POPUP_MENU_HELPER_MAC_H_