summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-17 06:43:20 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-17 06:43:20 +0000
commit54bf9954482f34598b776dcd6c75cf31b0975cb6 (patch)
treebe3e17acb7c20f4b1451610a8d615085442069f8 /content
parentf1a50fabbbc310c9a78ffe9a6a1ff4fac0a5e7d7 (diff)
downloadchromium_src-54bf9954482f34598b776dcd6c75cf31b0975cb6.zip
chromium_src-54bf9954482f34598b776dcd6c75cf31b0975cb6.tar.gz
chromium_src-54bf9954482f34598b776dcd6c75cf31b0975cb6.tar.bz2
Move WebMenuItem to content::MenuItem.
BUG=237267 Review URL: https://chromiumcodereview.appspot.com/19393003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211982 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/android/content_view_core_impl.cc6
-rw-r--r--content/browser/android/content_view_core_impl.h5
-rw-r--r--content/browser/renderer_host/popup_menu_helper_mac.h5
-rw-r--r--content/browser/renderer_host/popup_menu_helper_mac.mm2
-rw-r--r--content/browser/renderer_host/render_view_host_unittest.cc2
-rw-r--r--content/browser/renderer_host/webmenurunner_mac.h4
-rw-r--r--content/browser/renderer_host/webmenurunner_mac.mm14
-rw-r--r--content/browser/web_contents/interstitial_page_impl.cc4
-rw-r--r--content/browser/web_contents/web_contents_view_android.cc2
-rw-r--r--content/browser/web_contents/web_contents_view_android.h2
-rw-r--r--content/browser/web_contents/web_contents_view_aura.cc2
-rw-r--r--content/browser/web_contents/web_contents_view_aura.h2
-rw-r--r--content/browser/web_contents/web_contents_view_gtk.cc2
-rw-r--r--content/browser/web_contents/web_contents_view_gtk.h2
-rw-r--r--content/browser/web_contents/web_contents_view_guest.cc2
-rw-r--r--content/browser/web_contents/web_contents_view_guest.h2
-rw-r--r--content/browser/web_contents/web_contents_view_mac.h2
-rw-r--r--content/browser/web_contents/web_contents_view_mac.mm2
-rw-r--r--content/browser/web_contents/web_contents_view_win.cc2
-rw-r--r--content/browser/web_contents/web_contents_view_win.h2
-rw-r--r--content/common/view_messages.h10
-rw-r--r--content/content_common.gypi2
-rw-r--r--content/content_renderer.gypi2
-rw-r--r--content/port/browser/render_view_host_delegate_view.h5
-rw-r--r--content/public/common/context_menu_params.h4
-rw-r--r--content/public/common/menu_item.cc33
-rw-r--r--content/public/common/menu_item.h44
-rw-r--r--content/renderer/context_menu_params_builder.cc3
-rw-r--r--content/renderer/external_popup_menu.cc7
-rw-r--r--content/renderer/menu_item_builder.cc28
-rw-r--r--content/renderer/menu_item_builder.h23
-rw-r--r--content/test/test_web_contents_view.cc2
-rw-r--r--content/test/test_web_contents_view.h2
33 files changed, 182 insertions, 49 deletions
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index ef94c7f..9ee3838 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -42,6 +42,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
+#include "content/public/common/menu_item.h"
#include "content/public/common/page_transition_types.h"
#include "jni/ContentViewCore_jni.h"
#include "third_party/WebKit/public/web/WebBindings.h"
@@ -54,7 +55,6 @@
#include "ui/gfx/size_conversions.h"
#include "ui/gfx/size_f.h"
#include "webkit/common/user_agent/user_agent_util.h"
-#include "webkit/common/webmenuitem.h"
using base::android::AttachCurrentThread;
using base::android::ConvertJavaStringToUTF16;
@@ -430,7 +430,7 @@ void ContentViewCoreImpl::OnBackgroundColorChanged(SkColor color) {
}
void ContentViewCoreImpl::ShowSelectPopupMenu(
- const std::vector<WebMenuItem>& items, int selected_item, bool multiple) {
+ const std::vector<MenuItem>& items, int selected_item, bool multiple) {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
if (j_obj.is_null())
@@ -465,7 +465,7 @@ void ContentViewCoreImpl::ShowSelectPopupMenu(
for (size_t i = 0; i < items.size(); ++i) {
labels.push_back(items[i].label);
jint enabled =
- (items[i].type == WebMenuItem::GROUP ? POPUP_ITEM_TYPE_GROUP :
+ (items[i].type == MenuItem::GROUP ? POPUP_ITEM_TYPE_GROUP :
(items[i].enabled ? POPUP_ITEM_TYPE_ENABLED :
POPUP_ITEM_TYPE_DISABLED));
env->SetIntArrayRegion(enabled_array.obj(), i, 1, &enabled);
diff --git a/content/browser/android/content_view_core_impl.h b/content/browser/android/content_view_core_impl.h
index 2464706..967f2af 100644
--- a/content/browser/android/content_view_core_impl.h
+++ b/content/browser/android/content_view_core_impl.h
@@ -24,8 +24,6 @@
#include "ui/gfx/rect_f.h"
#include "url/gurl.h"
-struct WebMenuItem;
-
namespace ui {
class ViewAndroid;
class WindowAndroid;
@@ -33,6 +31,7 @@ class WindowAndroid;
namespace content {
class RenderWidgetHostViewAndroid;
+struct MenuItem;
// TODO(jrg): this is a shell. Upstream the rest.
class ContentViewCoreImpl : public ContentViewCore,
@@ -231,7 +230,7 @@ class ContentViewCoreImpl : public ContentViewCore,
// |multiple| defines if it should support multi-select.
// If not |multiple|, |selected_item| sets the initially selected item.
// Otherwise, item's "checked" flag selects it.
- void ShowSelectPopupMenu(const std::vector<WebMenuItem>& items,
+ void ShowSelectPopupMenu(const std::vector<MenuItem>& items,
int selected_item,
bool multiple);
diff --git a/content/browser/renderer_host/popup_menu_helper_mac.h b/content/browser/renderer_host/popup_menu_helper_mac.h
index fa143cb..332fecd 100644
--- a/content/browser/renderer_host/popup_menu_helper_mac.h
+++ b/content/browser/renderer_host/popup_menu_helper_mac.h
@@ -13,12 +13,11 @@
#include "content/public/browser/notification_registrar.h"
#include "ui/gfx/rect.h"
-struct WebMenuItem;
-
namespace content {
class RenderViewHost;
class RenderViewHostImpl;
class RenderWidgetHostViewMac;
+struct MenuItem;
class PopupMenuHelper : public NotificationObserver {
public:
@@ -33,7 +32,7 @@ class PopupMenuHelper : public NotificationObserver {
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection);
diff --git a/content/browser/renderer_host/popup_menu_helper_mac.mm b/content/browser/renderer_host/popup_menu_helper_mac.mm
index d3f7063..65340ae 100644
--- a/content/browser/renderer_host/popup_menu_helper_mac.mm
+++ b/content/browser/renderer_host/popup_menu_helper_mac.mm
@@ -36,7 +36,7 @@ void PopupMenuHelper::ShowPopupMenu(
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) {
// Only single selection list boxes show a popup on Mac.
diff --git a/content/browser/renderer_host/render_view_host_unittest.cc b/content/browser/renderer_host/render_view_host_unittest.cc
index 5661316..810439d 100644
--- a/content/browser/renderer_host/render_view_host_unittest.cc
+++ b/content/browser/renderer_host/render_view_host_unittest.cc
@@ -122,7 +122,7 @@ class MockDraggingRenderViewHostDelegateView
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) OVERRIDE {}
virtual void StartDragging(const DropData& drop_data,
diff --git a/content/browser/renderer_host/webmenurunner_mac.h b/content/browser/renderer_host/webmenurunner_mac.h
index 28afb19..e1ce91a 100644
--- a/content/browser/renderer_host/webmenurunner_mac.h
+++ b/content/browser/renderer_host/webmenurunner_mac.h
@@ -10,7 +10,7 @@
#include <vector>
#include "base/mac/scoped_nsobject.h"
-#include "webkit/common/webmenuitem.h"
+#include "content/public/common/menu_item.h"
// WebMenuRunner ---------------------------------------------------------------
@@ -39,7 +39,7 @@
}
// Initializes the MenuDelegate with a list of items sent from WebKit.
-- (id)initWithItems:(const std::vector<WebMenuItem>&)items
+- (id)initWithItems:(const std::vector<content::MenuItem>&)items
fontSize:(CGFloat)fontSize
rightAligned:(BOOL)rightAligned;
diff --git a/content/browser/renderer_host/webmenurunner_mac.mm b/content/browser/renderer_host/webmenurunner_mac.mm
index 2ff5137..a81d2c9 100644
--- a/content/browser/renderer_host/webmenurunner_mac.mm
+++ b/content/browser/renderer_host/webmenurunner_mac.mm
@@ -9,7 +9,7 @@
@interface WebMenuRunner (PrivateAPI)
// Worker function used during initialization.
-- (void)addItem:(const WebMenuItem&)item;
+- (void)addItem:(const content::MenuItem&)item;
// A callback for the menu controller object to call when an item is selected
// from the menu. This is not called if the menu is dismissed without a
@@ -20,7 +20,7 @@
@implementation WebMenuRunner
-- (id)initWithItems:(const std::vector<WebMenuItem>&)items
+- (id)initWithItems:(const std::vector<content::MenuItem>&)items
fontSize:(CGFloat)fontSize
rightAligned:(BOOL)rightAligned {
if ((self = [super init])) {
@@ -35,8 +35,8 @@
return self;
}
-- (void)addItem:(const WebMenuItem&)item {
- if (item.type == WebMenuItem::SEPARATOR) {
+- (void)addItem:(const content::MenuItem&)item {
+ if (item.type == content::MenuItem::SEPARATOR) {
[menu_ addItem:[NSMenuItem separatorItem]];
return;
}
@@ -45,11 +45,11 @@
NSMenuItem* menuItem = [menu_ addItemWithTitle:title
action:@selector(menuItemSelected:)
keyEquivalent:@""];
- if (!item.toolTip.empty()) {
- NSString* toolTip = base::SysUTF16ToNSString(item.toolTip);
+ if (!item.tool_tip.empty()) {
+ NSString* toolTip = base::SysUTF16ToNSString(item.tool_tip);
[menuItem setToolTip:toolTip];
}
- [menuItem setEnabled:(item.enabled && item.type != WebMenuItem::GROUP)];
+ [menuItem setEnabled:(item.enabled && item.type != content::MenuItem::GROUP)];
[menuItem setTarget:self];
// Set various alignment/language attributes. Note that many (if not most) of
diff --git a/content/browser/web_contents/interstitial_page_impl.cc b/content/browser/web_contents/interstitial_page_impl.cc
index 3aaaba8..5ab2134 100644
--- a/content/browser/web_contents/interstitial_page_impl.cc
+++ b/content/browser/web_contents/interstitial_page_impl.cc
@@ -77,7 +77,7 @@ class InterstitialPageImpl::InterstitialPageRVHDelegateView
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) OVERRIDE;
virtual void StartDragging(const DropData& drop_data,
@@ -769,7 +769,7 @@ void InterstitialPageImpl::InterstitialPageRVHDelegateView::ShowPopupMenu(
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) {
NOTREACHED() << "InterstitialPage does not support showing popup menus.";
diff --git a/content/browser/web_contents/web_contents_view_android.cc b/content/browser/web_contents/web_contents_view_android.cc
index 016858c..1f7b247 100644
--- a/content/browser/web_contents/web_contents_view_android.cc
+++ b/content/browser/web_contents/web_contents_view_android.cc
@@ -188,7 +188,7 @@ void WebContentsViewAndroid::ShowPopupMenu(
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) {
if (content_view_core_) {
diff --git a/content/browser/web_contents/web_contents_view_android.h b/content/browser/web_contents/web_contents_view_android.h
index c72c512..594bc5c 100644
--- a/content/browser/web_contents/web_contents_view_android.h
+++ b/content/browser/web_contents/web_contents_view_android.h
@@ -68,7 +68,7 @@ class WebContentsViewAndroid : public WebContentsViewPort,
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) OVERRIDE;
virtual void StartDragging(const DropData& drop_data,
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index c59757c..185d483 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -1229,7 +1229,7 @@ void WebContentsViewAura::ShowPopupMenu(const gfx::Rect& bounds,
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) {
// External popup menus are only used on Mac and Android.
diff --git a/content/browser/web_contents/web_contents_view_aura.h b/content/browser/web_contents/web_contents_view_aura.h
index 0ed09ef..e2336dd 100644
--- a/content/browser/web_contents/web_contents_view_aura.h
+++ b/content/browser/web_contents/web_contents_view_aura.h
@@ -130,7 +130,7 @@ class CONTENT_EXPORT WebContentsViewAura
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) OVERRIDE;
virtual void StartDragging(const DropData& drop_data,
diff --git a/content/browser/web_contents/web_contents_view_gtk.cc b/content/browser/web_contents/web_contents_view_gtk.cc
index e60a011..cdc36c8 100644
--- a/content/browser/web_contents/web_contents_view_gtk.cc
+++ b/content/browser/web_contents/web_contents_view_gtk.cc
@@ -360,7 +360,7 @@ void WebContentsViewGtk::ShowPopupMenu(const gfx::Rect& bounds,
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) {
// External popup menus are only used on Mac and Android.
diff --git a/content/browser/web_contents/web_contents_view_gtk.h b/content/browser/web_contents/web_contents_view_gtk.h
index 7a603d7..4a456fc 100644
--- a/content/browser/web_contents/web_contents_view_gtk.h
+++ b/content/browser/web_contents/web_contents_view_gtk.h
@@ -77,7 +77,7 @@ class CONTENT_EXPORT WebContentsViewGtk
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) OVERRIDE;
virtual void StartDragging(const DropData& drop_data,
diff --git a/content/browser/web_contents/web_contents_view_guest.cc b/content/browser/web_contents/web_contents_view_guest.cc
index c675063..2143e8a 100644
--- a/content/browser/web_contents/web_contents_view_guest.cc
+++ b/content/browser/web_contents/web_contents_view_guest.cc
@@ -196,7 +196,7 @@ void WebContentsViewGuest::ShowPopupMenu(const gfx::Rect& bounds,
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) {
// External popup menus are only used on Mac and Android.
diff --git a/content/browser/web_contents/web_contents_view_guest.h b/content/browser/web_contents/web_contents_view_guest.h
index 436295a..8d968f4 100644
--- a/content/browser/web_contents/web_contents_view_guest.h
+++ b/content/browser/web_contents/web_contents_view_guest.h
@@ -78,7 +78,7 @@ class CONTENT_EXPORT WebContentsViewGuest
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) OVERRIDE;
virtual void StartDragging(const DropData& drop_data,
diff --git a/content/browser/web_contents/web_contents_view_mac.h b/content/browser/web_contents/web_contents_view_mac.h
index 8e0894f..a8e7bb3 100644
--- a/content/browser/web_contents/web_contents_view_mac.h
+++ b/content/browser/web_contents/web_contents_view_mac.h
@@ -101,7 +101,7 @@ class WebContentsViewMac : public WebContentsViewPort,
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) OVERRIDE;
virtual void StartDragging(const DropData& drop_data,
diff --git a/content/browser/web_contents/web_contents_view_mac.mm b/content/browser/web_contents/web_contents_view_mac.mm
index cb9f274..6a9459d 100644
--- a/content/browser/web_contents/web_contents_view_mac.mm
+++ b/content/browser/web_contents/web_contents_view_mac.mm
@@ -247,7 +247,7 @@ void WebContentsViewMac::ShowPopupMenu(
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) {
PopupMenuHelper popup_menu_helper(web_contents_->GetRenderViewHost());
diff --git a/content/browser/web_contents/web_contents_view_win.cc b/content/browser/web_contents/web_contents_view_win.cc
index 59415ea..6a75e71 100644
--- a/content/browser/web_contents/web_contents_view_win.cc
+++ b/content/browser/web_contents/web_contents_view_win.cc
@@ -252,7 +252,7 @@ void WebContentsViewWin::ShowPopupMenu(const gfx::Rect& bounds,
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) {
// External popup menus are only used on Mac and Android.
diff --git a/content/browser/web_contents/web_contents_view_win.h b/content/browser/web_contents/web_contents_view_win.h
index cfb4ecd..3ca6b48 100644
--- a/content/browser/web_contents/web_contents_view_win.h
+++ b/content/browser/web_contents/web_contents_view_win.h
@@ -84,7 +84,7 @@ class CONTENT_EXPORT WebContentsViewWin
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) OVERRIDE;
virtual void StartDragging(const DropData& drop_data,
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 034bfb1..9d7b328 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -25,6 +25,7 @@
#include "content/public/common/file_chooser_params.h"
#include "content/public/common/frame_navigate_params.h"
#include "content/public/common/javascript_message_type.h"
+#include "content/public/common/menu_item.h"
#include "content/public/common/page_state.h"
#include "content/public/common/page_zoom.h"
#include "content/public/common/referrer.h"
@@ -58,7 +59,6 @@
#include "ui/gfx/vector2d.h"
#include "ui/gfx/vector2d_f.h"
#include "ui/shell_dialogs/selected_file_info.h"
-#include "webkit/common/webmenuitem.h"
#include "webkit/plugins/npapi/webplugin.h"
#if defined(OS_MACOSX)
@@ -77,11 +77,11 @@ IPC_ENUM_TRAITS(WebKit::WebMediaPlayerAction::Type)
IPC_ENUM_TRAITS(WebKit::WebPluginAction::Type)
IPC_ENUM_TRAITS(WebKit::WebPopupType)
IPC_ENUM_TRAITS(WebKit::WebTextDirection)
-IPC_ENUM_TRAITS(WebMenuItem::Type)
IPC_ENUM_TRAITS(WindowContainerType)
IPC_ENUM_TRAITS(content::FaviconURL::IconType)
IPC_ENUM_TRAITS(content::FileChooserParams::Mode)
IPC_ENUM_TRAITS(content::JavaScriptMessageType)
+IPC_ENUM_TRAITS(content::MenuItem::Type)
IPC_ENUM_TRAITS(content::NavigationGesture)
IPC_ENUM_TRAITS(content::PageZoom)
IPC_ENUM_TRAITS(content::RendererPreferencesHintingEnum)
@@ -145,9 +145,9 @@ IPC_STRUCT_TRAITS_BEGIN(WebKit::WebScreenInfo)
IPC_STRUCT_TRAITS_MEMBER(availableRect)
IPC_STRUCT_TRAITS_END()
-IPC_STRUCT_TRAITS_BEGIN(WebMenuItem)
+IPC_STRUCT_TRAITS_BEGIN(content::MenuItem)
IPC_STRUCT_TRAITS_MEMBER(label)
- IPC_STRUCT_TRAITS_MEMBER(toolTip)
+ IPC_STRUCT_TRAITS_MEMBER(tool_tip)
IPC_STRUCT_TRAITS_MEMBER(type)
IPC_STRUCT_TRAITS_MEMBER(action)
IPC_STRUCT_TRAITS_MEMBER(rtl)
@@ -485,7 +485,7 @@ IPC_STRUCT_BEGIN(ViewHostMsg_ShowPopup_Params)
IPC_STRUCT_MEMBER(int, selected_item)
// The entire list of items in the popup menu.
- IPC_STRUCT_MEMBER(std::vector<WebMenuItem>, popup_items)
+ IPC_STRUCT_MEMBER(std::vector<content::MenuItem>, popup_items)
// Whether items should be right-aligned.
IPC_STRUCT_MEMBER(bool, right_aligned)
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 7e72a48..f55381c 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -56,6 +56,8 @@
'public/common/main_function_params.h',
'public/common/media_stream_request.cc',
'public/common/media_stream_request.h',
+ 'public/common/menu_item.cc',
+ 'public/common/menu_item.h',
'public/common/page_state.cc',
'public/common/page_state.h',
'public/common/page_transition_types.cc',
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index a2e634e..e3aa05f 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -247,6 +247,8 @@
'renderer/media/websourcebuffer_impl.h',
'renderer/memory_benchmarking_extension.cc',
'renderer/memory_benchmarking_extension.h',
+ 'renderer/menu_item_builder.cc',
+ 'renderer/menu_item_builder.h',
'renderer/mhtml_generator.cc',
'renderer/mhtml_generator.h',
'renderer/mouse_lock_dispatcher.cc',
diff --git a/content/port/browser/render_view_host_delegate_view.h b/content/port/browser/render_view_host_delegate_view.h
index 375b867..5e5d9b4 100644
--- a/content/port/browser/render_view_host_delegate_view.h
+++ b/content/port/browser/render_view_host_delegate_view.h
@@ -13,7 +13,6 @@
#include "third_party/WebKit/public/web/WebDragOperation.h"
class SkBitmap;
-struct WebMenuItem;
namespace gfx {
class ImageSkia;
@@ -22,9 +21,9 @@ class Vector2d;
}
namespace content {
-
struct ContextMenuParams;
struct DropData;
+struct MenuItem;
// This class provides a way for the RenderViewHost to reach out to its
// delegate's view. It only needs to be implemented by embedders if they don't
@@ -42,7 +41,7 @@ class CONTENT_EXPORT RenderViewHostDelegateView {
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) = 0;
diff --git a/content/public/common/context_menu_params.h b/content/public/common/context_menu_params.h
index e962530..f58e9de 100644
--- a/content/public/common/context_menu_params.h
+++ b/content/public/common/context_menu_params.h
@@ -10,13 +10,13 @@
#include "base/basictypes.h"
#include "base/strings/string16.h"
#include "content/common/content_export.h"
+#include "content/public/common/menu_item.h"
#include "content/public/common/page_state.h"
#include "content/public/common/ssl_status.h"
#include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
#include "third_party/WebKit/public/web/WebContextMenuData.h"
#include "ui/base/ui_base_types.h"
#include "url/gurl.h"
-#include "webkit/common/webmenuitem.h"
#if defined(OS_ANDROID)
#include "ui/gfx/point.h"
@@ -144,7 +144,7 @@ struct CONTENT_EXPORT ContextMenuParams {
WebKit::WebReferrerPolicy referrer_policy;
CustomContextMenuContext custom_context;
- std::vector<WebMenuItem> custom_items;
+ std::vector<MenuItem> custom_items;
ui::MenuSourceType source_type;
diff --git a/content/public/common/menu_item.cc b/content/public/common/menu_item.cc
new file mode 100644
index 0000000..4ea06cf
--- /dev/null
+++ b/content/public/common/menu_item.cc
@@ -0,0 +1,33 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/public/common/menu_item.h"
+
+namespace content {
+
+MenuItem::MenuItem()
+ : type(OPTION),
+ action(0),
+ rtl(false),
+ has_directional_override(false),
+ enabled(false),
+ checked(false) {
+}
+
+MenuItem::MenuItem(const MenuItem& item)
+ : label(item.label),
+ tool_tip(item.tool_tip),
+ type(item.type),
+ action(item.action),
+ rtl(item.rtl),
+ has_directional_override(item.has_directional_override),
+ enabled(item.enabled),
+ checked(item.checked),
+ submenu(item.submenu) {
+}
+
+MenuItem::~MenuItem() {
+}
+
+} // namespace content
diff --git a/content/public/common/menu_item.h b/content/public/common/menu_item.h
new file mode 100644
index 0000000..c6c20bc
--- /dev/null
+++ b/content/public/common/menu_item.h
@@ -0,0 +1,44 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_COMMON_MENU_ITEM_H_
+#define CONTENT_PUBLIC_COMMON_MENU_ITEM_H_
+
+#include <vector>
+
+#include "base/strings/string16.h"
+#include "content/common/content_export.h"
+#include "third_party/WebKit/public/web/WebMenuItemInfo.h"
+
+namespace content {
+
+// Container for information about entries in an HTML select popup menu and
+// custom entries of the context menu.
+struct CONTENT_EXPORT MenuItem {
+ enum Type {
+ OPTION = WebKit::WebMenuItemInfo::Option,
+ CHECKABLE_OPTION = WebKit::WebMenuItemInfo::CheckableOption,
+ GROUP = WebKit::WebMenuItemInfo::Group,
+ SEPARATOR = WebKit::WebMenuItemInfo::Separator,
+ SUBMENU // This is currently only used by Pepper, not by WebKit.
+ };
+
+ MenuItem();
+ MenuItem(const MenuItem& item);
+ ~MenuItem();
+
+ base::string16 label;
+ base::string16 tool_tip;
+ Type type;
+ unsigned action;
+ bool rtl;
+ bool has_directional_override;
+ bool enabled;
+ bool checked;
+ std::vector<MenuItem> submenu;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_COMMON_MENU_ITEM_H_
diff --git a/content/renderer/context_menu_params_builder.cc b/content/renderer/context_menu_params_builder.cc
index d4aa912..8459fa2 100644
--- a/content/renderer/context_menu_params_builder.cc
+++ b/content/renderer/context_menu_params_builder.cc
@@ -8,6 +8,7 @@
#include "content/common/ssl_status_serialization.h"
#include "content/public/common/context_menu_params.h"
#include "content/public/renderer/history_item_serialization.h"
+#include "content/renderer/menu_item_builder.h"
#include "third_party/WebKit/public/web/WebElement.h"
#include "third_party/WebKit/public/web/WebNode.h"
@@ -48,7 +49,7 @@ ContextMenuParams ContextMenuParamsBuilder::Build(
params.custom_context.is_pepper_menu = false;
for (size_t i = 0; i < data.customItems.size(); ++i)
- params.custom_items.push_back(WebMenuItem(data.customItems[i]));
+ params.custom_items.push_back(MenuItemBuilder::Build(data.customItems[i]));
if (!data.frameHistoryItem.isNull())
params.frame_page_state = HistoryItemToPageState(data.frameHistoryItem);
diff --git a/content/renderer/external_popup_menu.cc b/content/renderer/external_popup_menu.cc
index 06f8345..08d71e9 100644
--- a/content/renderer/external_popup_menu.cc
+++ b/content/renderer/external_popup_menu.cc
@@ -5,6 +5,7 @@
#include "content/renderer/external_popup_menu.h"
#include "content/common/view_messages.h"
+#include "content/renderer/menu_item_builder.h"
#include "content/renderer/render_view_impl.h"
#include "third_party/WebKit/public/platform/WebRect.h"
#include "third_party/WebKit/public/web/WebExternalPopupMenuClient.h"
@@ -26,8 +27,10 @@ void ExternalPopupMenu::show(const WebKit::WebRect& bounds) {
popup_params.item_height = popup_menu_info_.itemHeight;
popup_params.item_font_size = popup_menu_info_.itemFontSize;
popup_params.selected_item = popup_menu_info_.selectedIndex;
- for (size_t i = 0; i < popup_menu_info_.items.size(); ++i)
- popup_params.popup_items.push_back(WebMenuItem(popup_menu_info_.items[i]));
+ for (size_t i = 0; i < popup_menu_info_.items.size(); ++i) {
+ popup_params.popup_items.push_back(
+ MenuItemBuilder::Build(popup_menu_info_.items[i]));
+ }
popup_params.right_aligned = popup_menu_info_.rightAligned;
popup_params.allow_multiple_selection =
popup_menu_info_.allowMultipleSelection;
diff --git a/content/renderer/menu_item_builder.cc b/content/renderer/menu_item_builder.cc
new file mode 100644
index 0000000..5946c41
--- /dev/null
+++ b/content/renderer/menu_item_builder.cc
@@ -0,0 +1,28 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/menu_item_builder.h"
+
+#include "content/public/common/menu_item.h"
+
+namespace content {
+
+MenuItem MenuItemBuilder::Build(const WebKit::WebMenuItemInfo& item) {
+ MenuItem result;
+
+ result.label = item.label;
+ result.tool_tip = item.toolTip;
+ result.type = static_cast<MenuItem::Type>(item.type);
+ result.action = item.action;
+ result.rtl = (item.textDirection == WebKit::WebTextDirectionRightToLeft);
+ result.has_directional_override = item.hasTextDirectionOverride;
+ result.enabled = item.enabled;
+ result.checked = item.checked;
+ for (size_t i = 0; i < item.subMenuItems.size(); ++i)
+ result.submenu.push_back(MenuItemBuilder::Build(item.subMenuItems[i]));
+
+ return result;
+}
+
+} // namespace content
diff --git a/content/renderer/menu_item_builder.h b/content/renderer/menu_item_builder.h
new file mode 100644
index 0000000..8f007bd
--- /dev/null
+++ b/content/renderer/menu_item_builder.h
@@ -0,0 +1,23 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_MENU_ITEM_BUILDER_H_
+#define CONTENT_RENDERER_MENU_ITEM_BUILDER_H_
+
+namespace WebKit {
+struct WebMenuItemInfo;
+}
+
+namespace content {
+struct MenuItem;
+
+class MenuItemBuilder {
+ public:
+ static MenuItem Build(const WebKit::WebMenuItemInfo& item);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MENU_ITEM_BUILDER_H_
+
diff --git a/content/test/test_web_contents_view.cc b/content/test/test_web_contents_view.cc
index 1d6f7db..b732a01 100644
--- a/content/test/test_web_contents_view.cc
+++ b/content/test/test_web_contents_view.cc
@@ -16,7 +16,7 @@ void TestWebContentsView::ShowPopupMenu(const gfx::Rect& bounds,
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) {
}
diff --git a/content/test/test_web_contents_view.h b/content/test/test_web_contents_view.h
index 149e300..a087f78 100644
--- a/content/test/test_web_contents_view.h
+++ b/content/test/test_web_contents_view.h
@@ -22,7 +22,7 @@ class TestWebContentsView : public WebContentsViewPort,
int item_height,
double item_font_size,
int selected_item,
- const std::vector<WebMenuItem>& items,
+ const std::vector<MenuItem>& items,
bool right_aligned,
bool allow_multiple_selection) OVERRIDE;
virtual void StartDragging(const DropData& drop_data,