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