1// Copyright (c) 2011 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.
4
5#ifndef CHROME_BROWSER_TAB_CONTENTS_POPUP_MENU_HELPER_MAC_H_
6#define CHROME_BROWSER_TAB_CONTENTS_POPUP_MENU_HELPER_MAC_H_
7
8#include <vector>
9
10#include "content/common/notification_observer.h"
11#include "content/common/notification_registrar.h"
12#include "ui/gfx/rect.h"
13
14class RenderViewHost;
15struct WebMenuItem;
16
17class PopupMenuHelper : public NotificationObserver {
18 public:
19  // Creates a PopupMenuHelper that will notify |render_view_host| when a user
20  // selects or cancels the popup.
21  explicit PopupMenuHelper(RenderViewHost* render_view_host);
22
23  // Shows the popup menu and notifies the RenderViewHost of the selection/
24  // cancel.
25  // This call is blocking.
26  void ShowPopupMenu(const gfx::Rect& bounds,
27                     int item_height,
28                     double item_font_size,
29                     int selected_item,
30                     const std::vector<WebMenuItem>& items,
31                     bool right_aligned);
32
33 private:
34  // NotificationObserver implementation:
35  virtual void Observe(NotificationType type,
36                       const NotificationSource& source,
37                       const NotificationDetails& details);
38
39  NotificationRegistrar notification_registrar_;
40
41  RenderViewHost* render_view_host_;
42
43  DISALLOW_COPY_AND_ASSIGN(PopupMenuHelper);
44};
45
46#endif  // CHROME_BROWSER_TAB_CONTENTS_POPUP_MENU_HELPER_MAC_H_
47