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