Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: Source/WebKit/chromium/src/ContextMenuClientImpl.cpp

Issue 14185003: Use ContextMenu code path that was guarded by CROSS_PLATFORM_CONTEXT_MENU (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use ContextMenu code path that was guarded by CROSS_PLATFORM_CONTEXT_MENU Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebKit/chromium/src/ContextMenuClientImpl.h ('k') | Source/WebKit/chromium/src/WebViewImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
index 2ffd6e4c88fb086074d61d99c8bed19933a154fe..db74de5affc270bb1ed810c41ecc1574f4e10e9b 100644
--- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
+++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
@@ -178,8 +178,7 @@ static String selectMisspellingAsync(Frame* selectedFrame, DocumentMarker& marke
return markerRange->text();
}
-PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
- ContextMenu* defaultMenu)
+PassOwnPtr<WebCore::ContextMenu> ContextMenuClientImpl::customizeMenu(PassOwnPtr<WebCore::ContextMenu> defaultMenu)
{
// Displaying the context menu in this function is a big hack as we don't
// have context, i.e. whether this is being invoked via a script or in
@@ -187,7 +186,7 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
// Keyboard events KeyVK_APPS, Shift+F10). Check if this is being invoked
// in response to the above input events before popping up the context menu.
if (!m_webView->contextMenuAllowed())
- return 0;
+ return defaultMenu;
HitTestResult r = m_webView->page()->contextMenuController()->hitTestResult();
Frame* selectedFrame = r.innerNodeFrame();
@@ -326,7 +325,7 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled();
// Spellchecking might be enabled for the field, but could be disabled on the node.
if (m_webView->focusedWebCoreFrame()->editor()->isSpellCheckingEnabledInFocusedNode()) {
- data.misspelledWord = selectMisspelledWord(defaultMenu, selectedFrame);
+ data.misspelledWord = selectMisspelledWord(defaultMenu.get(), selectedFrame);
if (m_webView->spellCheckClient()) {
int misspelledOffset, misspelledLength;
m_webView->spellCheckClient()->spellCheck(
@@ -364,7 +363,7 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
data.referrerPolicy = static_cast<WebReferrerPolicy>(selectedFrame->document()->referrerPolicy());
// Filter out custom menu elements and add them into the data.
- populateCustomMenuItems(defaultMenu, &data);
+ populateCustomMenuItems(defaultMenu.get(), &data);
data.node = r.innerNonSharedNode();
@@ -372,14 +371,14 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
if (m_webView->client())
m_webView->client()->showContextMenu(selected_web_frame, data);
- return 0;
+ return defaultMenu;
}
-static void populateSubMenuItems(PlatformMenuDescription inputMenu, WebVector<WebMenuItemInfo>& subMenuItems)
+static void populateSubMenuItems(const Vector<ContextMenuItem>& inputMenu, WebVector<WebMenuItemInfo>& subMenuItems)
{
Vector<WebMenuItemInfo> subItems;
- for (size_t i = 0; i < inputMenu->size(); ++i) {
- const ContextMenuItem* inputItem = &inputMenu->at(i);
+ for (size_t i = 0; i < inputMenu.size(); ++i) {
+ const ContextMenuItem* inputItem = &inputMenu.at(i);
if (inputItem->action() < ContextMenuItemBaseCustomTag || inputItem->action() > ContextMenuItemLastCustomTag)
continue;
@@ -400,7 +399,7 @@ static void populateSubMenuItems(PlatformMenuDescription inputMenu, WebVector<We
break;
case SubmenuType:
outputItem.type = WebMenuItemInfo::SubMenu;
- populateSubMenuItems(inputItem->platformSubMenu(), outputItem.subMenuItems);
+ populateSubMenuItems(inputItem->subMenuItems(), outputItem.subMenuItems);
break;
}
subItems.append(outputItem);
@@ -414,7 +413,7 @@ static void populateSubMenuItems(PlatformMenuDescription inputMenu, WebVector<We
void ContextMenuClientImpl::populateCustomMenuItems(WebCore::ContextMenu* defaultMenu, WebContextMenuData* data)
{
- populateSubMenuItems(defaultMenu->platformDescription(), data->customItems);
+ populateSubMenuItems(defaultMenu->items(), data->customItems);
}
} // namespace WebKit
« no previous file with comments | « Source/WebKit/chromium/src/ContextMenuClientImpl.h ('k') | Source/WebKit/chromium/src/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698