[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / frame_host / popup_menu_helper_mac.h
blob5575d89483c49f7f512712ab140e4e7fd9935112
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_FRAME_HOST_POPUP_MENU_HELPER_MAC_H_
6 #define CONTENT_BROWSER_FRAME_HOST_POPUP_MENU_HELPER_MAC_H_
8 #include <vector>
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/geometry/rect.h"
16 #ifdef __OBJC__
17 @class WebMenuRunner;
18 #else
19 class WebMenuRunner;
20 #endif
22 namespace content {
24 class RenderFrameHost;
25 class RenderFrameHostImpl;
26 class RenderWidgetHostViewMac;
27 struct MenuItem;
29 class PopupMenuHelper : public NotificationObserver {
30 public:
31 // Creates a PopupMenuHelper that will notify |render_frame_host| when a user
32 // selects or cancels the popup.
33 explicit PopupMenuHelper(RenderFrameHost* render_frame_host);
34 void Hide();
36 // Shows the popup menu and notifies the RenderFrameHost of the selection/
37 // cancellation. This call is blocking.
38 void ShowPopupMenu(const gfx::Rect& bounds,
39 int item_height,
40 double item_font_size,
41 int selected_item,
42 const std::vector<MenuItem>& items,
43 bool right_aligned,
44 bool allow_multiple_selection);
46 // Immediately return from ShowPopupMenu.
47 CONTENT_EXPORT static void DontShowPopupMenuForTesting();
49 protected:
50 virtual RenderWidgetHostViewMac* GetRenderWidgetHostView() const;
52 // NotificationObserver implementation:
53 void Observe(int type,
54 const NotificationSource& source,
55 const NotificationDetails& details) override;
57 NotificationRegistrar notification_registrar_;
58 RenderFrameHostImpl* render_frame_host_;
59 WebMenuRunner* menu_runner_;
60 bool popup_was_hidden_;
62 DISALLOW_COPY_AND_ASSIGN(PopupMenuHelper);
65 } // namespace content
67 #endif // CONTENT_BROWSER_FRAME_HOST_POPUP_MENU_HELPER_MAC_H_