Commit 42bd97cb authored by beidson@apple.com's avatar beidson@apple.com

WebCore: <rdar://problem/8613727> and https://bugs.webkit.org/show_bug.cgi?id=48720

Customizable context menu support in WebKit2.

Reviewed by Darin Adler.

Various WebCore support to allow WebKit2 to create new ContextMenuItems with
the information it has.

* WebCore.exp.in:

* platform/ContextMenu.h:
* platform/ContextMenuItem.h:

* platform/mac/ContextMenuItemMac.mm:
(WebCore::ContextMenuItem::ContextMenuItem):
(WebCore::ContextMenuItem::setSubMenu):
* platform/mac/ContextMenuMac.mm:
(WebCore::platformMenuDescription):

* platform/qt/ContextMenuItemQt.cpp:
(WebCore::ContextMenuItem::ContextMenuItem):
(WebCore::ContextMenuItem::setSubMenu):
* platform/qt/ContextMenuQt.cpp:
(WebCore::platformMenuDescription):

* platform/win/ContextMenuItemWin.cpp:
(WebCore::ContextMenuItem::ContextMenuItem):
(WebCore::ContextMenuItem::setSubMenu):
* platform/win/ContextMenuWin.cpp:
(WebCore::platformMenuDescription):

WebKit2: Part of <rdar://problem/8613727> and https://bugs.webkit.org/show_bug.cgi?id=48720
Customizable context menu support in WebKit2.

Reviewed by Darin Adler.

This adds a BundlePageContextMenu client and lets WebKit2 consult it with the proposed
list of WebContextMenuItems.
There is no realistic API for the embedding app to actually inspect or create new
WebContextMenuItems (will be "WKContextMenuItem") and that ability will come later.

* WebKit2.pro:
* WebKit2.xcodeproj/project.pbxproj:
* win/WebKit2.vcproj:

* Platform/Logging.cpp:
(initializeLogChannelsIfNecessary):
* Platform/Logging.h:

* Shared/APIObject.h:

* Shared/MutableArray.cpp:
(WebKit::MutableArray::reserveCapacity):
* Shared/MutableArray.h:

* Shared/WebContextMenuItem.cpp: Added.
(WebKit::WebContextMenuItem::WebContextMenuItem):
(WebKit::WebContextMenuItem::data):
* Shared/WebContextMenuItem.h: Added.
(WebKit::WebContextMenuItem::create):
(WebKit::WebContextMenuItem::type):

* Shared/WebContextMenuItemData.cpp:
(WebKit::WebContextMenuItemData::core):
(WebKit::kitItems):
(WebKit::coreItems):
* Shared/WebContextMenuItemData.h:

* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageSetContextMenuClient):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:

* WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp: Added.
(WebKit::InjectedBundlePageContextMenuClient::InjectedBundlePageContextMenuClient):
(WebKit::InjectedBundlePageContextMenuClient::initialize):
(WebKit::InjectedBundlePageContextMenuClient::getCustomMenuFromDefaultItems):
* WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h: Added.

* WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
(WebKit::WebContextMenuClient::getCustomMenuFromDefaultItems): Call through to the injected bundle client
  with the default items and convert the returned items back for WebCore to use.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::initializeInjectedBundleContextMenuClient):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::injectedBundleContextMenuClient):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71682 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6161c1b7
2010-11-09 Brady Eidson <beidson@apple.com>
Reviewed by Darin Adler.
<rdar://problem/8613727> and https://bugs.webkit.org/show_bug.cgi?id=48720
Customizable context menu support in WebKit2.
Various WebCore support to allow WebKit2 to create new ContextMenuItems with
the information it has.
* WebCore.exp.in:
* platform/ContextMenu.h:
* platform/ContextMenuItem.h:
* platform/mac/ContextMenuItemMac.mm:
(WebCore::ContextMenuItem::ContextMenuItem):
(WebCore::ContextMenuItem::setSubMenu):
* platform/mac/ContextMenuMac.mm:
(WebCore::platformMenuDescription):
* platform/qt/ContextMenuItemQt.cpp:
(WebCore::ContextMenuItem::ContextMenuItem):
(WebCore::ContextMenuItem::setSubMenu):
* platform/qt/ContextMenuQt.cpp:
(WebCore::platformMenuDescription):
* platform/win/ContextMenuItemWin.cpp:
(WebCore::ContextMenuItem::ContextMenuItem):
(WebCore::ContextMenuItem::setSubMenu):
* platform/win/ContextMenuWin.cpp:
(WebCore::platformMenuDescription):
2010-11-09 Sam Weinig <sam@webkit.org>
Reviewed by Anders Carlsson.
......@@ -1235,11 +1235,14 @@ __ZN7WebCore11ContextMenu22setPlatformDescriptionEP14NSMutableArray
__ZN7WebCore12EventHandler20sendContextMenuEventEP7NSEvent
__ZN7WebCore12EventHandler20sendContextMenuEventERKNS_18PlatformMouseEventE
__ZN7WebCore15ContextMenuItem26releasePlatformDescriptionEv
__ZN7WebCore15ContextMenuItemC1ENS_17ContextMenuActionERKN3WTF6StringEbbRNS2_6VectorIS0_Lm0EEE
__ZN7WebCore15ContextMenuItemC1ENS_19ContextMenuItemTypeENS_17ContextMenuActionERKN3WTF6StringEPNS_11ContextMenuE
__ZN7WebCore15ContextMenuItemC1ENS_19ContextMenuItemTypeENS_17ContextMenuActionERKN3WTF6StringEbb
__ZN7WebCore15ContextMenuItemD1Ev
__ZN7WebCore21ContextMenuController16clearContextMenuEv
__ZN7WebCore21ContextMenuController23contextMenuItemSelectedEPNS_15ContextMenuItemE
__ZN7WebCore21contextMenuItemVectorEP14NSMutableArray
__ZN7WebCore23platformMenuDescriptionERN3WTF6VectorINS_15ContextMenuItemELm0EEE
__ZN7WebCore6Chrome15showContextMenuEv
__ZNK7WebCore11ContextMenu19platformDescriptionEv
__ZNK7WebCore11ContextMenu21checkOrEnableIfNeededERNS_15ContextMenuItemE
......
......@@ -92,6 +92,7 @@ namespace WebCore {
};
Vector<ContextMenuItem> contextMenuItemVector(PlatformMenuDescription);
PlatformMenuDescription platformMenuDescription(Vector<ContextMenuItem>&);
}
......
......@@ -257,6 +257,9 @@ namespace WebCore {
ContextMenuItem(PlatformMenuItemDescription);
ContextMenuItem(ContextMenu* subMenu = 0);
ContextMenuItem(ContextMenuItemType type, ContextMenuAction action, const String& title, ContextMenu* subMenu = 0);
ContextMenuItem(ContextMenuItemType, ContextMenuAction, const String&, bool enabled, bool checked);
ContextMenuItem(ContextMenuAction, const String&, bool enabled, bool checked, Vector<ContextMenuItem>& submenuItems);
#if PLATFORM(GTK)
ContextMenuItem(GtkMenuItem*);
#endif
......@@ -275,6 +278,7 @@ namespace WebCore {
PlatformMenuDescription platformSubMenu() const;
void setSubMenu(ContextMenu*);
void setSubMenu(Vector<ContextMenuItem>&);
void setChecked(bool = true);
bool checked() const;
......
......@@ -58,22 +58,39 @@ ContextMenuItem::ContextMenuItem(ContextMenu* subMenu)
setSubMenu(subMenu);
}
ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction action, const String& title, ContextMenu* subMenu)
static PlatformMenuItemDescription createPlatformMenuItemDescription(ContextMenuItemType type, ContextMenuAction action, const String& title, bool enabled, bool checked)
{
if (type == SeparatorType) {
m_platformDescription = [NSMenuItem separatorItem];
return;
}
if (type == SeparatorType)
return [[NSMenuItem separatorItem] retain];
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle:title action:nil keyEquivalent:@""];
m_platformDescription = item;
[item release];
[item setEnabled:enabled];
[item setState:checked ? NSOnState : NSOffState];
[item setTag:action];
return item;
}
ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction action, const String& title, ContextMenu* subMenu)
{
m_platformDescription.adoptNS(createPlatformMenuItemDescription(type, action, title, true, false));
[m_platformDescription.get() setTag:action];
if (subMenu)
setSubMenu(subMenu);
}
ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction action, const String& title, bool enabled, bool checked)
{
m_platformDescription.adoptNS(createPlatformMenuItemDescription(type, action, title, enabled, checked));
}
ContextMenuItem::ContextMenuItem(ContextMenuAction action, const String& title, bool enabled, bool checked, Vector<ContextMenuItem>& subMenuItems)
{
m_platformDescription.adoptNS(createPlatformMenuItemDescription(SubmenuType, action, title, enabled, checked));
setSubMenu(subMenuItems);
}
ContextMenuItem::~ContextMenuItem()
{
}
......@@ -136,6 +153,17 @@ void ContextMenuItem::setSubMenu(ContextMenu* menu)
[subMenu release];
}
void ContextMenuItem::setSubMenu(Vector<ContextMenuItem>& subMenuItems)
{
NSMenu* subMenu = [[NSMenu alloc] init];
[subMenu setAutoenablesItems:NO];
for (unsigned i = 0; i < subMenuItems.size(); ++i)
[subMenu addItem:subMenuItems[i].releasePlatformDescription()];
[m_platformDescription.get() setSubmenu:subMenu];
[subMenu release];
}
void ContextMenuItem::setChecked(bool checked)
{
if (checked)
......
......@@ -166,6 +166,18 @@ Vector<ContextMenuItem> contextMenuItemVector(PlatformMenuDescription menu)
return items;
}
PlatformMenuDescription platformMenuDescription(Vector<ContextMenuItem>& menuItemVector)
{
PlatformMenuDescription platformMenu = [[NSMutableArray alloc] initWithCapacity:menuItemVector.size()];
for (unsigned i = 0; i < menuItemVector.size(); ++i) {
PlatformMenuItemDescription platformItem = menuItemVector[i].releasePlatformDescription();
[platformMenu addObject:platformItem];
[platformItem release];
}
return [platformMenu autorelease];
}
} // namespace WebCore
#endif // ENABLE(CONTEXT_MENUS)
......@@ -49,6 +49,16 @@ ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction act
setSubMenu(subMenu);
}
ContextMenuItem::ContextMenuItem(ContextMenuItemType, ContextMenuAction, const String&, bool, bool)
{
// FIXME: Implement
}
ContextMenuItem::ContextMenuItem(ContextMenuAction, const String&, bool, bool, Vector<ContextMenuItem>&)
{
// FIXME: Implement
}
ContextMenuItem::~ContextMenuItem()
{
}
......@@ -99,6 +109,11 @@ void ContextMenuItem::setSubMenu(ContextMenu* menu)
m_platformDescription.subMenuItems = *menu->platformDescription();
}
void ContextMenuItem::setSubMenu(Vector<ContextMenuItem>&)
{
// FIXME: Implement
}
void ContextMenuItem::setChecked(bool on)
{
m_platformDescription.checked = on;
......
......@@ -80,5 +80,11 @@ Vector<ContextMenuItem> contextMenuItemVector(PlatformMenuDescription)
return Vector<ContextMenuItem>();
}
PlatformMenuDescription platformMenuDescription(Vector<ContextMenuItem>& menuItemVector)
{
// FIXME - Implement
return 0;
}
}
// vim: ts=4 sw=4 et
......@@ -95,6 +95,16 @@ ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction act
m_platformDescription->dwTypeData = wcsdup(t.charactersWithNullTermination());
}
ContextMenuItem::ContextMenuItem(ContextMenuItemType, ContextMenuAction, const String&, bool, bool)
{
// FIXME: Implement
}
ContextMenuItem::ContextMenuItem(ContextMenuAction, const String&, bool, bool, Vector<ContextMenuItem>&)
{
// FIXME: Implement
}
ContextMenuItem::~ContextMenuItem()
{
if (m_platformDescription) {
......@@ -172,6 +182,11 @@ void ContextMenuItem::setSubMenu(ContextMenu* subMenu)
m_platformDescription->hSubMenu = subMenu->releasePlatformDescription();
}
void ContextMenuItem::setSubMenu(Vector<ContextMenuItem>&)
{
// FIXME: Implement
}
void ContextMenuItem::setChecked(bool checked)
{
m_platformDescription->fMask |= MIIM_STATE;
......
......@@ -161,4 +161,10 @@ Vector<ContextMenuItem> contextMenuItemVector(PlatformMenuDescription)
return Vector<ContextMenuItem>();
}
PlatformMenuDescription platformMenuDescription(Vector<ContextMenuItem>& menuItemVector)
{
// FIXME - Implement
return 0;
}
}
2010-11-09 Brady Eidson <beidson@apple.com>
Reviewed by Darin Adler.
Part of <rdar://problem/8613727> and https://bugs.webkit.org/show_bug.cgi?id=48720
Customizable context menu support in WebKit2.
This adds a BundlePageContextMenu client and lets WebKit2 consult it with the proposed
list of WebContextMenuItems.
There is no realistic API for the embedding app to actually inspect or create new
WebContextMenuItems (will be "WKContextMenuItem") and that ability will come later.
* WebKit2.pro:
* WebKit2.xcodeproj/project.pbxproj:
* win/WebKit2.vcproj:
* Platform/Logging.cpp:
(initializeLogChannelsIfNecessary):
* Platform/Logging.h:
* Shared/APIObject.h:
* Shared/MutableArray.cpp:
(WebKit::MutableArray::reserveCapacity):
* Shared/MutableArray.h:
* Shared/WebContextMenuItem.cpp: Added.
(WebKit::WebContextMenuItem::WebContextMenuItem):
(WebKit::WebContextMenuItem::data):
* Shared/WebContextMenuItem.h: Added.
(WebKit::WebContextMenuItem::create):
(WebKit::WebContextMenuItem::type):
* Shared/WebContextMenuItemData.cpp:
(WebKit::WebContextMenuItemData::core):
(WebKit::kitItems):
(WebKit::coreItems):
* Shared/WebContextMenuItemData.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageSetContextMenuClient):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp: Added.
(WebKit::InjectedBundlePageContextMenuClient::InjectedBundlePageContextMenuClient):
(WebKit::InjectedBundlePageContextMenuClient::initialize):
(WebKit::InjectedBundlePageContextMenuClient::getCustomMenuFromDefaultItems):
* WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h: Added.
* WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
(WebKit::WebContextMenuClient::getCustomMenuFromDefaultItems): Call through to the injected bundle client
with the default items and convert the returned items back for WebCore to use.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::initializeInjectedBundleContextMenuClient):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::injectedBundleContextMenuClient):
2010-11-09 Sam Weinig <sam@webkit.org>
Add some stylistic flourish to the last patch as suggested by Lord Darin Adler.
......
......@@ -28,6 +28,7 @@
#if !LOG_DISABLED
WTFLogChannel LogSessionState = { 0x00000001, "WebKit2LogLevel", WTFLogChannelOn };
WTFLogChannel LogContextMenu = { 0x00000002, "WebKit2LogLevel", WTFLogChannelOn };
static inline void initializeLogChannel(WTFLogChannel* channel)
{
......@@ -41,6 +42,7 @@ void initializeLogChannelsIfNecessary()
return;
haveInitializedLogChannels = true;
initializeLogChannel(&LogContextMenu);
initializeLogChannel(&LogSessionState);
}
......
......@@ -36,6 +36,7 @@
EXTERN_C_BEGIN
extern WTFLogChannel LogContextMenu;
extern WTFLogChannel LogSessionState;
void initializeLogChannelsIfNecessary(void);
......
......@@ -37,6 +37,7 @@ public:
TypeNull = 0,
TypeArray,
TypeCertificateInfo,
TypeContextMenuItem,
TypeData,
TypeDictionary,
TypeError,
......
......@@ -40,4 +40,9 @@ void MutableArray::append(APIObject* item)
m_entries.append(item);
}
void MutableArray::reserveCapacity(unsigned capacity)
{
m_entries.reserveCapacity(capacity);
}
} // namespace WebKit
......@@ -42,6 +42,7 @@ public:
~MutableArray();
void append(APIObject*);
void reserveCapacity(unsigned);
virtual bool isMutable() { return true; }
......
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "WebContextMenuItem.h"
namespace WebKit {
WebContextMenuItem::WebContextMenuItem(const WebContextMenuItemData& data)
: m_webContextMenuItemData(data)
{
}
} // namespace WebKit
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebContextMenuItem_h
#define WebContextMenuItem_h
#include "APIObject.h"
#include "WebContextMenuItemData.h"
namespace WebKit {
class WebContextMenuItem : public APIObject {
public:
static const Type APIType = TypeContextMenuItem;
static PassRefPtr<WebContextMenuItem> create(const WebContextMenuItemData& data)
{
return adoptRef(new WebContextMenuItem(data));
}
WebContextMenuItemData* data() { return &m_webContextMenuItemData; }
private:
WebContextMenuItem(const WebContextMenuItemData&);
virtual Type type() const { return APIType; }
WebContextMenuItemData m_webContextMenuItemData;
};
} // namespace WebKit
#endif // WebContextMenuItem_h
......@@ -30,6 +30,8 @@
#include <wtf/text/CString.h>
#include <WebCore/ContextMenu.h>
using namespace WebCore;
namespace WebKit {
WebContextMenuItemData::WebContextMenuItemData()
......@@ -76,6 +78,17 @@ WebContextMenuItemData::WebContextMenuItemData(WebCore::ContextMenuItem& item, W
m_checked = item.checked();
}
ContextMenuItem WebContextMenuItemData::core() const
{
if (m_type != SubmenuType) {
ContextMenuItem result(m_type, m_action, m_title, m_enabled, m_checked);
return result;
}
Vector<ContextMenuItem> subMenuItems = coreItems(m_submenu);
return ContextMenuItem(m_action, m_title, m_enabled, m_checked, subMenuItems);
}
void WebContextMenuItemData::encode(CoreIPC::ArgumentEncoder* encoder) const
{
encoder->encode(CoreIPC::In(static_cast<uint32_t>(m_type), static_cast<uint32_t>(m_action), m_title, m_checked, m_enabled, m_submenu));
......@@ -110,12 +123,22 @@ bool WebContextMenuItemData::decode(CoreIPC::ArgumentDecoder* decoder, WebContex
return true;
}
Vector<WebContextMenuItemData> kitItems(Vector<WebCore::ContextMenuItem>& coreItems, WebCore::ContextMenu* menu)
Vector<WebContextMenuItemData> kitItems(Vector<WebCore::ContextMenuItem>& coreItemVector, WebCore::ContextMenu* menu)
{
Vector<WebContextMenuItemData> result;
result.reserveCapacity(coreItems.size());
for (unsigned i = 0; i < coreItems.size(); ++i)
result.append(WebContextMenuItemData(coreItems[i], menu));
result.reserveCapacity(coreItemVector.size());
for (unsigned i = 0; i < coreItemVector.size(); ++i)
result.append(WebContextMenuItemData(coreItemVector[i], menu));
return result;
}
Vector<ContextMenuItem> coreItems(const Vector<WebContextMenuItemData>& kitItemVector)
{
Vector<ContextMenuItem> result;
result.reserveCapacity(kitItemVector.size());
for (unsigned i = 0; i < kitItemVector.size(); ++i)
result.append(kitItemVector[i].core());
return result;
}
......
......@@ -54,6 +54,8 @@ public:
bool checked() const { return m_checked; }
const Vector<WebContextMenuItemData>& submenu() const { return m_submenu; }
WebCore::ContextMenuItem core() const;
void encode(CoreIPC::ArgumentEncoder*) const;
static bool decode(CoreIPC::ArgumentDecoder*, WebContextMenuItemData&);
......@@ -67,6 +69,7 @@ private:
};
Vector<WebContextMenuItemData> kitItems(Vector<WebCore::ContextMenuItem>&, WebCore::ContextMenu*);
Vector<WebCore::ContextMenuItem> coreItems(const Vector<WebContextMenuItemData>&);
} // namespace WebKit
......
......@@ -230,6 +230,7 @@ HEADERS += \
Shared/UserMessageCoders.h \
Shared/VisitedLinkTable.h \
Shared/WebCertificateInfo.h \
Shared/WebContextMenuItem.h \
Shared/WebContextMenuItemData.h \
Shared/WebEvent.h \
Shared/WebError.h \
......@@ -319,6 +320,7 @@ HEADERS += \
WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h \
WebProcess/InjectedBundle/InjectedBundle.h \
WebProcess/InjectedBundle/InjectedBundleHitTestResult.h \
WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.h \
WebProcess/InjectedBundle/InjectedBundlePageFormClient.h \
WebProcess/InjectedBundle/InjectedBundlePageUIClient.h \
WebProcess/InjectedBundle/InjectedBundleScriptWorld.h \
......@@ -402,6 +404,7 @@ SOURCES += \
Shared/qt/WebURLResponseQt.cpp \
Shared/PlatformPopupMenuData.cpp \
Shared/VisitedLinkTable.cpp \
Shared/WebContextMenuItem.cpp \
Shared/WebContextMenuItemData.cpp \
Shared/WebError.cpp \
Shared/WebEvent.cpp \
......@@ -488,7 +491,8 @@ SOURCES += \
WebProcess/InjectedBundle/InjectedBundle.cpp \
WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp \
WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.cpp \
WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp \
WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp \
WebProcess/InjectedBundle/InjectedBundlePageContextMenuClient.cpp \
WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp \
WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp \
WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp \
......
......@@ -190,6 +190,10 @@
1C8E2A361277852400BC7BD0 /* WebInspectorMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C8E2A321277852400BC7BD0 /* WebInspectorMessages.h */; };
510FBB9A1288C95E00AFFDF4 /* WebContextMenuItemData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */; };
510FBB9B1288C95E00AFFDF4 /* WebContextMenuItemData.h in Headers */ = {isa = PBXBuildFile; fileRef = 510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */; };
512935D71288D19400A4B695 /* WebContextMenuItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512935D51288D19400A4B695 /* WebContextMenuItem.cpp */; };
512935D81288D19400A4B695 /* WebContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 512935D61288D19400A4B695 /* WebContextMenuItem.h */; };
512935E31288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */; };
512935E41288D97800A4B695 /* InjectedBundlePageContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */; };
51578B831209ECEF00A37C4A /* WebData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51578B821209ECEF00A37C4A /* WebData.h */; };
516A4A5D120A2CCD00C05B7F /* WebError.h in Headers */ = {isa = PBXBuildFile; fileRef = 516A4A5B120A2CCD00C05B7F /* WebError.h */; };
51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51871B59127CB89D00F76232 /* WebContextMenu.cpp */; };
......@@ -735,6 +739,10 @@
32DBCF5E0370ADEE00C91783 /* WebKit2Prefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2Prefix.h; sourceTree = "<group>"; };
510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuItemData.cpp; sourceTree = "<group>"; };
510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuItemData.h; sourceTree = "<group>"; };
512935D51288D19400A4B695 /* WebContextMenuItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuItem.cpp; sourceTree = "<group>"; };
512935D61288D19400A4B695 /* WebContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuItem.h; sourceTree = "<group>"; };
512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePageContextMenuClient.cpp; sourceTree = "<group>"; };
512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageContextMenuClient.h; sourceTree = "<group>"; };
51578B821209ECEF00A37C4A /* WebData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebData.h; sourceTree = "<group>"; };
516A4A5B120A2CCD00C05B7F /* WebError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebError.h; sourceTree = "<group>"; };
51871B59127CB89D00F76232 /* WebContextMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenu.cpp; sourceTree = "<group>"; };
......@@ -1368,6 +1376,8 @@
1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */,
BC1DD7B1114DC396005ADAF3 /* WebCoreArgumentCoders.h */,
BCF50726124329AA005955AE /* WebCertificateInfo.h */,
512935D51288D19400A4B695 /* WebContextMenuItem.cpp */,
512935D61288D19400A4B695 /* WebContextMenuItem.h */,
510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */,
510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */,
51578B821209ECEF00A37C4A /* WebData.h */,
......@@ -1812,6 +1822,8 @@
935EEB921277615D003322B8 /* InjectedBundleBackForwardListItem.h */,
BC498617124D10E200D834E1 /* InjectedBundleHitTestResult.cpp */,
BC498616124D10E200D834E1 /* InjectedBundleHitTestResult.h */,
512935E11288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp */,
512935E21288D97800A4B695 /* InjectedBundlePageContextMenuClient.h */,
E1EE53E611F8CFFB00CCBEE4 /* InjectedBundlePageEditorClient.cpp */,
E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */,
BC14E107120B905E00826C0C /* InjectedBundlePageFormClient.cpp */,
......@@ -2360,6 +2372,8 @@
510FBB9B1288C95E00AFFDF4 /* WebContextMenuItemData.h in Headers */,
1AB7D4CA1288AAA700CFD08C /* DownloadProxy.h in Headers */,
1AB7D61A1288B9D900CFD08C /* DownloadProxyMessages.h in Headers */,
512935D81288D19400A4B695 /* WebContextMenuItem.h in Headers */,
512935E41288D97800A4B695 /* InjectedBundlePageContextMenuClient.h in Headers */,
1AB7D72C1288CAAD00CFD08C /* WebDownloadClient.h in Headers */,
1AB7D78D1288CD9A00CFD08C /* WKDownload.h in Headers */,
);
......@@ -2710,6 +2724,8 @@
510FBB9A1288C95E00AFFDF4 /* WebContextMenuItemData.cpp in Sources */,
1AB7D4CB1288AAA700CFD08C /* DownloadProxy.cpp in Sources */,
1AB7D6191288B9D900CFD08C /* DownloadProxyMessageReceiver.cpp in Sources */,
512935D71288D19400A4B695 /* WebContextMenuItem.cpp in Sources */,
512935E31288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp in Sources */,
1AB7D72D1288CAAD00CFD08C /* WebDownloadClient.cpp in Sources */,
1AB7D78E1288CD9A00CFD08C /* WKDownload.cpp in Sources */,
);
......
......@@ -38,6 +38,13 @@ WKTypeID WKBundlePageGetTypeID()
return toAPI(WebPage::APIType);
}
void WKBundlePageSetContextMenuClient(WKBundlePageRef pageRef, WKBundlePageContextMenuClient* wkClient)
{
if (wkClient && wkClient->version)