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