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