[EFL][WK2] Support Context Menu
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Nov 2012 14:24:54 +0000 (14:24 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Nov 2012 14:24:54 +0000 (14:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=96200

Reviewed by Laszlo Gombos.

Source/WebCore:

* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::populate):
EFL port also doesn't hide unavailable menus as gtk port.

Source/WebKit2:

This patch supports WK2 EFL's context menu as WK1 implementation because we can't use elementary in inside WebKit.
Only basic functionalities of context menu are supported. Beside this implementation follows GTK's implementation.
For example, ewk_context_menu_new, ewk_context_menu_item_append, ewk_context_menu_item_remove are supported.

In addition, ewk_defines.h file is added in order to support cross inclusion as GTK port.

* PlatformEfl.cmake:
* UIProcess/API/efl/EWebKit2.h:
* UIProcess/API/efl/EwkViewImpl.cpp:
(EwkViewImpl::EwkViewImpl):
(EwkViewImpl::showContextMenu):
(EwkViewImpl::hideContextMenu):
* UIProcess/API/efl/EwkViewImpl.h:
(WebKit):
(EwkViewImpl):
* UIProcess/API/efl/ewk_context_menu.cpp: Added.
(EwkContextMenu::EwkContextMenu):
(EwkContextMenu::~EwkContextMenu):
(EwkContextMenu::hide):
(Ewk_Context_Menu::appendItem):
(Ewk_Context_Menu::removeItem):
(EwkContextMenu::contextMenuItemSelected):
(ewk_context_menu_new):
(ewk_context_menu_new_with_items):
(ewk_context_menu_item_append):
(ewk_context_menu_item_remove):
(ewk_context_menu_hide):
(ewk_context_menu_items_get):
(ewk_context_menu_item_select):
* UIProcess/API/efl/ewk_context_menu.h: Added.
* UIProcess/API/efl/ewk_context_menu_item.cpp: Added.
(EwkContextMenuItem::EwkContextMenuItem):
(ewk_context_menu_item_new):
(ewk_context_menu_item_new_with_submenu):
(ewk_context_menu_item_type_get):
(ewk_context_menu_item_type_set):
(ewk_context_menu_item_action_get):
(ewk_context_menu_item_action_set):
(ewk_context_menu_item_title_get):
(ewk_context_menu_item_title_set):
(ewk_context_menu_item_checked_get):
(ewk_context_menu_item_checked_set):
(ewk_context_menu_item_enabled_get):
(ewk_context_menu_item_enabled_set):
* UIProcess/API/efl/ewk_context_menu_item.h: Added.
* UIProcess/API/efl/ewk_context_menu_item_private.h: Added.
(EwkContextMenuItem):
(EwkContextMenuItem::create):
(EwkContextMenuItem::action):
(EwkContextMenuItem::setAction):
(EwkContextMenuItem::title):
(EwkContextMenuItem::setTitle):
(EwkContextMenuItem::type):
(EwkContextMenuItem::setType):
(EwkContextMenuItem::checked):
(EwkContextMenuItem::setChecked):
(EwkContextMenuItem::enabled):
(EwkContextMenuItem::setEnabled):
* UIProcess/API/efl/ewk_context_menu_private.h: Added.
(WebKit):
(EwkContextMenu):
(EwkContextMenu::create):
(EwkContextMenu::items):
* UIProcess/API/efl/ewk_defines.h: Added.
* UIProcess/API/efl/ewk_view.h:
* UIProcess/API/efl/tests/test_ewk2_context_menu.cpp: Added.
(checkBasicContextMenuItem):
(showContextMenu):
(TEST_F):
* UIProcess/efl/ContextMenuClientEfl.cpp: Added.
(toContextClientEfl):
(ContextMenuClientEfl::ContextMenuClientEfl):
(ContextMenuClientEfl::getContextMenuFromProposedMenu):
* UIProcess/efl/ContextMenuClientEfl.h: Added.
(WebKit):
(ContextMenuClientEfl):
(WebKit::ContextMenuClientEfl::create):
* UIProcess/efl/PageClientBase.cpp:
(WebKit::PageClientBase::createContextMenuProxy):
* UIProcess/efl/WebContextMenuProxyEfl.cpp: Added.
(WebKit):
(WebKit::WebContextMenuProxyEfl::WebContextMenuProxyEfl):
(WebKit::WebContextMenuProxyEfl::~WebContextMenuProxyEfl):
(WebKit::WebContextMenuProxyEfl::showContextMenu):
(WebKit::WebContextMenuProxyEfl::hideContextMenu):
(WebKit::WebContextMenuProxyEfl::contextMenuItemSelected):
* UIProcess/efl/WebContextMenuProxyEfl.h: Added.
(WebKit):
(WebContextMenuProxyEfl):
(WebKit::WebContextMenuProxyEfl::create):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135394 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/ContextMenuController.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformEfl.cmake
Source/WebKit2/UIProcess/API/efl/EWebKit2.h
Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h
Source/WebKit2/UIProcess/API/efl/ewk_context_menu.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/efl/ewk_context_menu.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item_private.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/efl/ewk_context_menu_private.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/efl/ewk_defines.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/efl/ewk_view.h
Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_menu.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/efl/ContextMenuClientEfl.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/efl/ContextMenuClientEfl.h [new file with mode: 0644]
Source/WebKit2/UIProcess/efl/PageClientBase.cpp
Source/WebKit2/UIProcess/efl/WebContextMenuProxyEfl.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/efl/WebContextMenuProxyEfl.h [new file with mode: 0644]

index c8b151f..7b4c171 100644 (file)
@@ -1,3 +1,14 @@
+2012-11-21  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        [EFL][WK2] Support Context Menu
+        https://bugs.webkit.org/show_bug.cgi?id=96200
+
+        Reviewed by Laszlo Gombos.
+
+        * page/ContextMenuController.cpp:
+        (WebCore::ContextMenuController::populate):
+        EFL port also doesn't hide unavailable menus as gtk port.
+
 2012-11-21  Florin Malita  <fmalita@chromium.org>
 
         [Chromium] Unreviewed Mac build fix after http://trac.webkit.org/changeset/135390.
index 797971d..5640dc7 100644 (file)
@@ -876,8 +876,8 @@ void ContextMenuController::populate()
                 if (!(frame->page() && frame->page()->inspectorController()->hasInspectorFrontendClient())) {
 #endif
 
-                // In GTK+ unavailable items are not hidden but insensitive
-#if PLATFORM(GTK)
+                // In GTK+ and EFL, unavailable items are not hidden but insensitive.
+#if PLATFORM(GTK) || PLATFORM(EFL)
                 appendItem(BackItem, m_contextMenu.get());
                 appendItem(ForwardItem, m_contextMenu.get());
                 appendItem(StopItem, m_contextMenu.get());
index 88b909e..2ef0c3f 100644 (file)
@@ -1,3 +1,101 @@
+2012-11-21  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        [EFL][WK2] Support Context Menu
+        https://bugs.webkit.org/show_bug.cgi?id=96200
+
+        Reviewed by Laszlo Gombos.
+
+        This patch supports WK2 EFL's context menu as WK1 implementation because we can't use elementary in inside WebKit.
+        Only basic functionalities of context menu are supported. Beside this implementation follows GTK's implementation.
+        For example, ewk_context_menu_new, ewk_context_menu_item_append, ewk_context_menu_item_remove are supported.
+
+        In addition, ewk_defines.h file is added in order to support cross inclusion as GTK port.
+
+        * PlatformEfl.cmake:
+        * UIProcess/API/efl/EWebKit2.h:
+        * UIProcess/API/efl/EwkViewImpl.cpp:
+        (EwkViewImpl::EwkViewImpl):
+        (EwkViewImpl::showContextMenu):
+        (EwkViewImpl::hideContextMenu):
+        * UIProcess/API/efl/EwkViewImpl.h:
+        (WebKit):
+        (EwkViewImpl):
+        * UIProcess/API/efl/ewk_context_menu.cpp: Added.
+        (EwkContextMenu::EwkContextMenu):
+        (EwkContextMenu::~EwkContextMenu):
+        (EwkContextMenu::hide):
+        (Ewk_Context_Menu::appendItem):
+        (Ewk_Context_Menu::removeItem):
+        (EwkContextMenu::contextMenuItemSelected):
+        (ewk_context_menu_new):
+        (ewk_context_menu_new_with_items):
+        (ewk_context_menu_item_append):
+        (ewk_context_menu_item_remove):
+        (ewk_context_menu_hide):
+        (ewk_context_menu_items_get):
+        (ewk_context_menu_item_select):
+        * UIProcess/API/efl/ewk_context_menu.h: Added.
+        * UIProcess/API/efl/ewk_context_menu_item.cpp: Added.
+        (EwkContextMenuItem::EwkContextMenuItem):
+        (ewk_context_menu_item_new):
+        (ewk_context_menu_item_new_with_submenu):
+        (ewk_context_menu_item_type_get):
+        (ewk_context_menu_item_type_set):
+        (ewk_context_menu_item_action_get):
+        (ewk_context_menu_item_action_set):
+        (ewk_context_menu_item_title_get):
+        (ewk_context_menu_item_title_set):
+        (ewk_context_menu_item_checked_get):
+        (ewk_context_menu_item_checked_set):
+        (ewk_context_menu_item_enabled_get):
+        (ewk_context_menu_item_enabled_set):
+        * UIProcess/API/efl/ewk_context_menu_item.h: Added.
+        * UIProcess/API/efl/ewk_context_menu_item_private.h: Added.
+        (EwkContextMenuItem):
+        (EwkContextMenuItem::create):
+        (EwkContextMenuItem::action):
+        (EwkContextMenuItem::setAction):
+        (EwkContextMenuItem::title):
+        (EwkContextMenuItem::setTitle):
+        (EwkContextMenuItem::type):
+        (EwkContextMenuItem::setType):
+        (EwkContextMenuItem::checked):
+        (EwkContextMenuItem::setChecked):
+        (EwkContextMenuItem::enabled):
+        (EwkContextMenuItem::setEnabled):
+        * UIProcess/API/efl/ewk_context_menu_private.h: Added.
+        (WebKit):
+        (EwkContextMenu):
+        (EwkContextMenu::create):
+        (EwkContextMenu::items):
+        * UIProcess/API/efl/ewk_defines.h: Added.
+        * UIProcess/API/efl/ewk_view.h:
+        * UIProcess/API/efl/tests/test_ewk2_context_menu.cpp: Added.
+        (checkBasicContextMenuItem):
+        (showContextMenu):
+        (TEST_F):
+        * UIProcess/efl/ContextMenuClientEfl.cpp: Added.
+        (toContextClientEfl):
+        (ContextMenuClientEfl::ContextMenuClientEfl):
+        (ContextMenuClientEfl::getContextMenuFromProposedMenu):
+        * UIProcess/efl/ContextMenuClientEfl.h: Added.
+        (WebKit):
+        (ContextMenuClientEfl):
+        (WebKit::ContextMenuClientEfl::create):
+        * UIProcess/efl/PageClientBase.cpp:
+        (WebKit::PageClientBase::createContextMenuProxy):
+        * UIProcess/efl/WebContextMenuProxyEfl.cpp: Added.
+        (WebKit):
+        (WebKit::WebContextMenuProxyEfl::WebContextMenuProxyEfl):
+        (WebKit::WebContextMenuProxyEfl::~WebContextMenuProxyEfl):
+        (WebKit::WebContextMenuProxyEfl::showContextMenu):
+        (WebKit::WebContextMenuProxyEfl::hideContextMenu):
+        (WebKit::WebContextMenuProxyEfl::contextMenuItemSelected):
+        * UIProcess/efl/WebContextMenuProxyEfl.h: Added.
+        (WebKit):
+        (WebContextMenuProxyEfl):
+        (WebKit::WebContextMenuProxyEfl::create):
+
 2012-11-21  Jongseok Yang  <js45.yang@samsung.com>
 
         [EFL][WK2] Rename ewk_view_setting_encoding_custom_XXX to ewk_view_custom_encoding_XXX
index 679a6a5..7734a92 100644 (file)
@@ -49,6 +49,8 @@ LIST(APPEND WebKit2_SOURCES
     UIProcess/API/efl/ewk_back_forward_list_item.cpp
     UIProcess/API/efl/ewk_color_picker.cpp
     UIProcess/API/efl/ewk_context.cpp
+    UIProcess/API/efl/ewk_context_menu.cpp
+    UIProcess/API/efl/ewk_context_menu_item.cpp
     UIProcess/API/efl/ewk_cookie_manager.cpp
     UIProcess/API/efl/ewk_database_manager.cpp
     UIProcess/API/efl/ewk_download_job.cpp
@@ -79,6 +81,7 @@ LIST(APPEND WebKit2_SOURCES
 
     UIProcess/efl/BatteryProvider.cpp
     UIProcess/efl/ContextHistoryClientEfl.cpp
+    UIProcess/efl/ContextMenuClientEfl.cpp
     UIProcess/efl/DownloadManagerEfl.cpp
     UIProcess/efl/FindClientEfl.cpp
     UIProcess/efl/FormClientEfl.cpp
@@ -96,6 +99,7 @@ LIST(APPEND WebKit2_SOURCES
     UIProcess/efl/TextCheckerEfl.cpp
     UIProcess/efl/VibrationClientEfl.cpp
     UIProcess/efl/WebContextEfl.cpp
+    UIProcess/efl/WebContextMenuProxyEfl.cpp
     UIProcess/efl/WebFullScreenManagerProxyEfl.cpp
     UIProcess/efl/WebInspectorProxyEfl.cpp
     UIProcess/efl/WebPageProxyEfl.cpp
@@ -257,6 +261,7 @@ SET (EWebKit2_HEADERS
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_context.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_cookie_manager.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_database_manager.h"
+    "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_defines.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_download_job.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_error.h"
     "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_favicon_database.h"
@@ -364,6 +369,7 @@ SET(EWK2UnitTests_BINARIES
     test_ewk2_color_picker
     test_ewk2_context
     test_ewk2_context_history_callbacks
+    test_ewk2_context_menu
     test_ewk2_cookie_manager
     test_ewk2_database_manager
     test_ewk2_download_job
index adaae1e..b122110 100644 (file)
@@ -33,6 +33,8 @@
 #include "ewk_back_forward_list_item.h"
 #include "ewk_color_picker.h"
 #include "ewk_context.h"
+#include "ewk_context_menu.h"
+#include "ewk_context_menu_item.h"
 #include "ewk_cookie_manager.h"
 #include "ewk_database_manager.h"
 #include "ewk_download_job.h"
index 0044341..9b89ee5 100644 (file)
@@ -21,6 +21,7 @@
 #include "config.h"
 #include "EwkViewImpl.h"
 
+#include "ContextMenuClientEfl.h"
 #include "EflScreenUtilities.h"
 #include "FindClientEfl.h"
 #include "FormClientEfl.h"
@@ -45,6 +46,7 @@
 #include "WebPreferences.h"
 #include "ewk_back_forward_list_private.h"
 #include "ewk_color_picker_private.h"
+#include "ewk_context_menu_private.h"
 #include "ewk_context_private.h"
 #include "ewk_favicon_database_private.h"
 #include "ewk_popup_menu_item_private.h"
@@ -115,6 +117,7 @@ EwkViewImpl::EwkViewImpl(Evas_Object* view, PassRefPtr<EwkContext> context, Pass
     , m_pagePolicyClient(PagePolicyClientEfl::create(this))
     , m_pageUIClient(PageUIClientEfl::create(this))
     , m_resourceLoadClient(ResourceLoadClientEfl::create(this))
+    , m_contextMenuClient(ContextMenuClientEfl::create(this))
     , m_findClient(FindClientEfl::create(this))
     , m_formClient(FormClientEfl::create(this))
 #if ENABLE(VIBRATION)
@@ -733,6 +736,38 @@ void EwkViewImpl::informContentsSizeChange(const IntSize& size)
 COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, RTL);
 COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, LTR);
 
+void EwkViewImpl::showContextMenu(WebContextMenuProxyEfl* contextMenuProxy, const WebCore::IntPoint& position, const Vector<WebContextMenuItemData>& items)
+{
+    Ewk_View_Smart_Data* sd = smartData();
+    ASSERT(sd->api);
+
+    ASSERT(contextMenuProxy);
+
+    if (!sd->api->context_menu_show)
+        return;
+
+    if (m_contextMenu)
+        hideContextMenu();
+
+    m_contextMenu = Ewk_Context_Menu::create(this, contextMenuProxy, items);
+
+    sd->api->context_menu_show(sd, position.x(), position.y(), m_contextMenu.get());
+}
+
+void EwkViewImpl::hideContextMenu()
+{
+    if (!m_contextMenu)
+        return;
+
+    Ewk_View_Smart_Data* sd = smartData();
+    ASSERT(sd->api);
+
+    if (sd->api->context_menu_hide)
+        sd->api->context_menu_hide(sd);
+
+    m_contextMenu.clear();
+}
+
 void EwkViewImpl::requestPopupMenu(WebPopupMenuProxyEfl* popupMenuProxy, const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector<WebPopupItem>& items, int32_t selectedIndex)
 {
     Ewk_View_Smart_Data* sd = smartData();
index c0b97a8..545c5ab 100644 (file)
@@ -47,6 +47,7 @@
 #endif
 
 namespace WebKit {
+class ContextMenuClientEfl;
 class FindClientEfl;
 class FormClientEfl;
 class InputMethodContextEfl;
@@ -55,6 +56,8 @@ class PageLoadClientEfl;
 class PagePolicyClientEfl;
 class PageUIClientEfl;
 class ResourceLoadClientEfl;
+class WebContextMenuItemData;
+class WebContextMenuProxyEfl;
 class WebPageGroup;
 class WebPageProxy;
 class WebPopupItem;
@@ -79,6 +82,7 @@ class IntSize;
 class EwkContext;
 class EwkBackForwardList;
 class EwkColorPicker;
+class EwkContextMenu;
 class EwkPopupMenu;
 class EwkSettings;
 class EwkWindowFeatures;
@@ -168,6 +172,9 @@ public:
 
     void requestPopupMenu(WebKit::WebPopupMenuProxyEfl*, const WebCore::IntRect&, WebCore::TextDirection, double pageScaleFactor, const Vector<WebKit::WebPopupItem>& items, int32_t selectedIndex);
     void closePopupMenu();
+    
+    void showContextMenu(WebKit::WebContextMenuProxyEfl*, const WebCore::IntPoint& position, const Vector<WebKit::WebContextMenuItemData>& items);
+    void hideContextMenu();
 
     void updateTextInputState();
 
@@ -244,6 +251,7 @@ private:
     OwnPtr<WebKit::PagePolicyClientEfl> m_pagePolicyClient;
     OwnPtr<WebKit::PageUIClientEfl> m_pageUIClient;
     OwnPtr<WebKit::ResourceLoadClientEfl> m_resourceLoadClient;
+    OwnPtr<WebKit::ContextMenuClientEfl> m_contextMenuClient;
     OwnPtr<WebKit::FindClientEfl> m_findClient;
     OwnPtr<WebKit::FormClientEfl> m_formClient;
 #if ENABLE(VIBRATION)
@@ -267,6 +275,7 @@ private:
     bool m_touchEventsEnabled;
 #endif
     WebCore::Timer<EwkViewImpl> m_displayTimer;
+    OwnPtr<EwkContextMenu> m_contextMenu;
     OwnPtr<EwkPopupMenu> m_popupMenu;
     OwnPtr<WebKit::InputMethodContextEfl> m_inputMethodContext;
     OwnPtr<EwkColorPicker> m_colorPicker;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_menu.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu.cpp
new file mode 100644 (file)
index 0000000..0a4e547
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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 "config.h"
+#include "ewk_context_menu.h"
+
+#include "APIObject.h"
+#include "EwkViewImpl.h"
+#include "WebContextMenuItemData.h"
+#include "WebContextMenuProxyEfl.h"
+#include "ewk_context_menu_item.h"
+#include "ewk_context_menu_item_private.h"
+#include "ewk_context_menu_private.h"
+
+using namespace WebKit;
+
+EwkContextMenu::EwkContextMenu(EwkViewImpl* viewImpl, WebContextMenuProxyEfl* contextMenuProxy, const Vector<WebKit::WebContextMenuItemData>& items)
+    : m_viewImpl(viewImpl)
+    , m_contextMenuProxy(contextMenuProxy)
+    , m_contextMenuItems(0)
+{
+    const size_t size = items.size();
+    for (size_t i = 0; i < size; ++i)
+        m_contextMenuItems = eina_list_append(m_contextMenuItems, Ewk_Context_Menu_Item::create(items[i]).leakPtr());
+}
+
+EwkContextMenu::EwkContextMenu()
+    : m_viewImpl(0)
+    , m_contextMenuProxy(0)
+    , m_contextMenuItems(0)
+{
+}
+
+EwkContextMenu::EwkContextMenu(Eina_List* items)
+    : m_viewImpl(0)
+    , m_contextMenuProxy(0)
+    , m_contextMenuItems(0)
+{
+    Eina_List* l;
+    void* data;
+    EINA_LIST_FOREACH(items, l, data)
+        m_contextMenuItems = eina_list_append(m_contextMenuItems, static_cast<EwkContextMenuItem*>(data));
+}
+
+EwkContextMenu::~EwkContextMenu()
+{
+    void* data;
+    EINA_LIST_FREE(m_contextMenuItems, data)
+        delete static_cast<Ewk_Context_Menu_Item*>(data);
+}
+
+void EwkContextMenu::hide()
+{
+    m_viewImpl->hideContextMenu();
+}
+
+void Ewk_Context_Menu::appendItem(EwkContextMenuItem* item)
+{
+    m_contextMenuItems = eina_list_append(m_contextMenuItems, item);
+}
+
+void Ewk_Context_Menu::removeItem(EwkContextMenuItem* item)
+{
+    m_contextMenuItems = eina_list_remove(m_contextMenuItems, item);
+}
+
+void EwkContextMenu::contextMenuItemSelected(const WebKit::WebContextMenuItemData& item)
+{
+    m_contextMenuProxy->contextMenuItemSelected(item); 
+} 
+
+Ewk_Context_Menu* ewk_context_menu_new()
+{
+    return EwkContextMenu::create().leakPtr();
+}
+
+Ewk_Context_Menu* ewk_context_menu_new_with_items(Eina_List* items)
+{
+    return EwkContextMenu::create(items).leakPtr();
+}
+
+Eina_Bool ewk_context_menu_item_append(Ewk_Context_Menu* menu, Ewk_Context_Menu_Item* item)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(menu, false);
+
+    menu->appendItem(item);
+
+    return true;
+}
+
+Eina_Bool ewk_context_menu_item_remove(Ewk_Context_Menu* menu, Ewk_Context_Menu_Item* item)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(menu, false);
+
+    menu->removeItem(item);
+
+    return true;
+}
+
+Eina_Bool ewk_context_menu_hide(Ewk_Context_Menu* menu)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(menu, false);
+
+    menu->hide();
+
+    return true;
+}
+
+const Eina_List* ewk_context_menu_items_get(const Ewk_Context_Menu* menu)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(menu, 0);
+
+    return menu->items();
+}
+
+Eina_Bool ewk_context_menu_item_select(Ewk_Context_Menu* menu, Ewk_Context_Menu_Item* item)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(menu, false);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+    WebCore::ContextMenuItemType type = static_cast<WebCore::ContextMenuItemType>(item->type());
+    WebCore::ContextMenuAction action = static_cast<WebCore::ContextMenuAction>(item->action());
+
+    menu->contextMenuItemSelected(WebContextMenuItemData(type, action, item->title(), item->enabled(), item->checked()));
+
+    return true;
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_menu.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu.h
new file mode 100644 (file)
index 0000000..ad35619
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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.
+ */
+
+/**
+ * @file    ewk_context_menu.h
+ * @brief   Describes the Ewk Context Menu API.
+ */
+
+#ifndef ewk_context_menu_h
+#define ewk_context_menu_h
+
+#include "ewk_defines.h"
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Creates a new Ewk_Context_Menu to be used as a submenu of an existing
+ * Ewk_Context_Menu. The context menu is created by the ewk_view and
+ * passed as an argument of ewk_view smart callback.
+ *
+ * @return the pointer to the new context menu
+ *
+ * @see ewk_context_menu_new_with_items
+ */
+EAPI Ewk_Context_Menu *ewk_context_menu_new(void);
+
+/**
+ * Creates a new Ewk_Context_Menu to be used as a submenu of an existing
+ * Ewk_Context_Menu with the given initial items. The context menu is
+ * created by the ewk_view and passed as an argument of ewk_view smart callback.
+ *
+ * @param items the list of initial items
+ * @return the pointer to the new context menu
+ *
+ * @see ewk_context_menu_new
+ */
+EAPI Ewk_Context_Menu *ewk_context_menu_new_with_items(Eina_List *items);
+
+/**
+ * Appends the item of the context menu.
+ *
+ * @param menu the context menu 
+ * @param item the item to append
+ * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_context_menu_item_append(Ewk_Context_Menu *menu, Ewk_Context_Menu_Item *item);
+
+/**
+ * Removes the item of the context menu.
+ *
+ * @param menu the context menu 
+ * @param item the item to remove
+ * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_context_menu_item_remove(Ewk_Context_Menu *menu, Ewk_Context_Menu_Item *item);
+
+/**
+ * Hides the context menu.
+ *
+ * @param menu the context menu to hide
+ * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_context_menu_hide(Ewk_Context_Menu *menu);
+
+/**
+ * Gets the list of items.
+ *
+ * @param o the context menu to get list of the items
+ * @return the list of the items on success or @c NULL on failure
+ */
+EAPI const Eina_List *ewk_context_menu_items_get(const Ewk_Context_Menu *o);
+
+/**
+ * Selects the item from the context menu.
+ *
+ * @param menu the context menu
+ * @param item the item is selected
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_context_menu_item_select(Ewk_Context_Menu *menu, Ewk_Context_Menu_Item *item);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ewk_context_menu_h */
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.cpp
new file mode 100644 (file)
index 0000000..d57dbf6
--- /dev/null
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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 "config.h"
+#include "ewk_context_menu_item.h"
+
+#include "ewk_context_menu_item_private.h"
+#include "ewk_private.h"
+#include <wtf/text/CString.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+EwkContextMenuItem::EwkContextMenuItem(const WebContextMenuItemData& item)
+    : m_type(static_cast<Ewk_Context_Menu_Item_Type>(item.type()))
+    , m_action(static_cast<Ewk_Context_Menu_Item_Action>(item.action()))
+    , m_title(item.title().utf8().data())
+    , m_isChecked(item.checked())
+    , m_isEnabled(item.enabled())
+    , m_parentMenu(0)
+    , m_subMenu(0)
+{
+}
+
+EwkContextMenuItem::EwkContextMenuItem(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled, Ewk_Context_Menu* subMenu)
+    : m_type(type)
+    , m_action(action)
+    , m_title(title)
+    , m_isChecked(checked)
+    , m_isEnabled(enabled)
+    , m_parentMenu(0)
+    , m_subMenu(subMenu)
+{
+}
+
+Ewk_Context_Menu_Item* ewk_context_menu_item_new(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled)
+{
+    return Ewk_Context_Menu_Item::create(type, action, title, checked, enabled, 0).leakPtr();
+}
+
+Ewk_Context_Menu_Item* ewk_context_menu_item_new_with_submenu(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled, Ewk_Context_Menu* subMenu)
+{
+    return Ewk_Context_Menu_Item::create(type, action, title, checked, enabled, subMenu).leakPtr();
+}
+
+Ewk_Context_Menu_Item_Type ewk_context_menu_item_type_get(const Ewk_Context_Menu_Item* item)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(item, EWK_ACTION_TYPE);
+
+    return item->type();
+}
+
+Eina_Bool ewk_context_menu_item_type_set(Ewk_Context_Menu_Item* item, Ewk_Context_Menu_Item_Type type)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+    item->setType(type);
+
+    return true;
+}
+
+Ewk_Context_Menu_Item_Action ewk_context_menu_item_action_get(const Ewk_Context_Menu_Item* item)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(item, EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION);
+
+    return item->action();
+}
+
+Eina_Bool ewk_context_menu_item_action_set(Ewk_Context_Menu_Item* item, Ewk_Context_Menu_Item_Action action)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+    item->setAction(action);
+
+    return true;
+}
+
+const char* ewk_context_menu_item_title_get(const Ewk_Context_Menu_Item* item)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0);
+
+    return item->title();
+}
+
+Eina_Bool ewk_context_menu_item_title_set(Ewk_Context_Menu_Item* item, const char* title)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+    item->setTitle(title);
+
+    return true;
+}
+
+Eina_Bool ewk_context_menu_item_checked_get(const Ewk_Context_Menu_Item* item)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+    return item->checked();
+}
+
+Eina_Bool ewk_context_menu_item_checked_set(Ewk_Context_Menu_Item* item, Eina_Bool checked)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+    item->setChecked(checked);
+
+    return true;
+}
+
+Eina_Bool ewk_context_menu_item_enabled_get(const Ewk_Context_Menu_Item* item)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+    
+    return item->enabled();
+}
+
+Eina_Bool ewk_context_menu_item_enabled_set(Ewk_Context_Menu_Item* item, Eina_Bool enabled)
+{
+    EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+    item->setEnabled(enabled);
+
+    return true;
+}
+
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION, WebCore::ContextMenuItemTagNoAction);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW, WebCore::ContextMenuItemTagOpenLinkInNewWindow);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_LINK_TO_DISK, WebCore::ContextMenuItemTagDownloadLinkToDisk);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD, WebCore::ContextMenuItemTagCopyLinkToClipboard);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW, WebCore::ContextMenuItemTagOpenImageInNewWindow);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK, WebCore::ContextMenuItemTagDownloadImageToDisk);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD, WebCore::ContextMenuItemTagCopyImageToClipboard);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_URL_TO_CLIPBOARD, WebCore::ContextMenuItemTagCopyImageUrlToClipboard);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW, WebCore::ContextMenuItemTagOpenFrameInNewWindow);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY, WebCore::ContextMenuItemTagCopy);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK, WebCore::ContextMenuItemTagGoBack);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD, WebCore::ContextMenuItemTagGoForward);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_STOP, WebCore::ContextMenuItemTagStop);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_RELOAD, WebCore::ContextMenuItemTagReload);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_CUT, WebCore::ContextMenuItemTagCut);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_PASTE, WebCore::ContextMenuItemTagPaste);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL, WebCore::ContextMenuItemTagSelectAll);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_GUESS, WebCore::ContextMenuItemTagSpellingGuess);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND, WebCore::ContextMenuItemTagNoGuessesFound);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING, WebCore::ContextMenuItemTagIgnoreSpelling);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING, WebCore::ContextMenuItemTagLearnSpelling);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OTHER, WebCore::ContextMenuItemTagOther);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_IN_SPOTLIGHT, WebCore::ContextMenuItemTagSearchInSpotlight);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB, WebCore::ContextMenuItemTagSearchWeb);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_LOOK_UP_IN_DICTIONARY, WebCore::ContextMenuItemTagLookUpInDictionary);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_WITH_DEFAULT_APPLICATION, WebCore::ContextMenuItemTagOpenWithDefaultApplication);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFACTUAL_SIZE, WebCore::ContextMenuItemPDFActualSize);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFZOOM_IN, WebCore::ContextMenuItemPDFZoomIn);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFZOOM_OUT, WebCore::ContextMenuItemPDFZoomOut);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFAUTO_SIZE, WebCore::ContextMenuItemPDFAutoSize);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFSINGLE_PAGE, WebCore::ContextMenuItemPDFSinglePage);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFFACING_PAGES, WebCore::ContextMenuItemPDFFacingPages);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFCONTINUOUS, WebCore::ContextMenuItemPDFContinuous);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFNEXT_PAGE, WebCore::ContextMenuItemPDFNextPage);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFPREVIOUS_PAGE, WebCore::ContextMenuItemPDFPreviousPage);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK, WebCore::ContextMenuItemTagOpenLink);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR, WebCore::ContextMenuItemTagIgnoreGrammar);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU, WebCore::ContextMenuItemTagSpellingMenu);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SPELLING_PANEL, WebCore::ContextMenuItemTagShowSpellingPanel);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING, WebCore::ContextMenuItemTagCheckSpelling);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING, WebCore::ContextMenuItemTagCheckSpellingWhileTyping);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING, WebCore::ContextMenuItemTagCheckGrammarWithSpelling);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU, WebCore::ContextMenuItemTagFontMenu);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SHOW_FONTS, WebCore::ContextMenuItemTagShowFonts);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_BOLD, WebCore::ContextMenuItemTagBold);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_ITALIC, WebCore::ContextMenuItemTagItalic);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_UNDERLINE, WebCore::ContextMenuItemTagUnderline);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OUTLINE, WebCore::ContextMenuItemTagOutline);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_STYLES, WebCore::ContextMenuItemTagStyles);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SHOW_COLORS, WebCore::ContextMenuItemTagShowColors);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SPEECH_MENU, WebCore::ContextMenuItemTagSpeechMenu);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_START_SPEAKING, WebCore::ContextMenuItemTagStartSpeaking);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_STOP_SPEAKING, WebCore::ContextMenuItemTagStopSpeaking);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_WRITING_DIRECTION_MENU, WebCore::ContextMenuItemTagWritingDirectionMenu);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_DEFAULT_DIRECTION, WebCore::ContextMenuItemTagDefaultDirection);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_LEFT_TO_RIGHT, WebCore::ContextMenuItemTagLeftToRight);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_RIGHT_TO_LEFT, WebCore::ContextMenuItemTagRightToLeft);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_PDFSINGLE_PAGE_SCROLLING, WebCore::ContextMenuItemTagPDFSinglePageScrolling);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_PDFFACING_PAGES_SCROLLING, WebCore::ContextMenuItemTagPDFFacingPagesScrolling);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT, WebCore::ContextMenuItemTagInspectElement);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_MENU, WebCore::ContextMenuItemTagTextDirectionMenu);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT, WebCore::ContextMenuItemTagTextDirectionDefault);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT, WebCore::ContextMenuItemTagTextDirectionLeftToRight);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT, WebCore::ContextMenuItemTagTextDirectionRightToLeft);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW, WebCore::ContextMenuItemTagOpenMediaInNewWindow);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD, WebCore::ContextMenuItemTagCopyMediaLinkToClipboard);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS, WebCore::ContextMenuItemTagToggleMediaControls);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP, WebCore::ContextMenuItemTagToggleMediaLoop);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN, WebCore::ContextMenuItemTagEnterVideoFullscreen);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE, WebCore::ContextMenuItemTagMediaPlayPause);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE, WebCore::ContextMenuItemTagMediaMute);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_BASE_CUSTOM_TAG, WebCore::ContextMenuItemBaseCustomTag);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_CUSTOM_TAG_NO_ACTION, WebCore::ContextMenuItemCustomTagNoAction);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_LAST_CUSTOM_TAG, WebCore::ContextMenuItemLastCustomTag);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, WebCore::ContextMenuItemBaseApplicationTag);
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.h
new file mode 100644 (file)
index 0000000..9612a21
--- /dev/null
@@ -0,0 +1,270 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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.
+ */
+
+/**
+ * @file    ewk_context_menu_item.h
+ * @brief   Describes the Ewk Context Menu Item API.
+ */
+
+#ifndef ewk_context_menu_item_h
+#define ewk_context_menu_item_h
+
+#include "ewk_defines.h"
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \enum    Ewk_Context_Menu_Item_Type
+ * @brief   Defines the types of the items for the context menu.
+ * @info    Keep this in sync with ContextMenuItem.h
+ */
+typedef enum {
+    EWK_ACTION_TYPE,
+    EWK_CHECKABLE_ACTION_TYPE,
+    EWK_SEPARATOR_TYPE,
+    EWK_SUBMENU_TYPE
+} Ewk_Context_Menu_Item_Type;
+
+/**
+ * \enum    Ewk_Context_Menu_Action
+ * @brief   Provides the actions of items for the context menu.
+ * @info    Keep this in sync with ContextMenuItem.h
+ */
+typedef enum {
+    EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION,
+    EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW,
+    EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_LINK_TO_DISK,
+    EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD,
+    EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW,
+    EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK,
+    EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD,
+    EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_URL_TO_CLIPBOARD,
+    EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW,
+    EWK_CONTEXT_MENU_ITEM_TAG_COPY,
+    EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK,
+    EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD,
+    EWK_CONTEXT_MENU_ITEM_TAG_STOP,
+    EWK_CONTEXT_MENU_ITEM_TAG_RELOAD,
+    EWK_CONTEXT_MENU_ITEM_TAG_CUT,
+    EWK_CONTEXT_MENU_ITEM_TAG_PASTE,
+    EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL,
+    EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_GUESS,
+    EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND,
+    EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING,
+    EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING,
+    EWK_CONTEXT_MENU_ITEM_TAG_OTHER,
+    EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_IN_SPOTLIGHT,
+    EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB,
+    EWK_CONTEXT_MENU_ITEM_TAG_LOOK_UP_IN_DICTIONARY,
+    EWK_CONTEXT_MENU_ITEM_TAG_OPEN_WITH_DEFAULT_APPLICATION,
+    EWK_CONTEXT_MENU_ITEM_PDFACTUAL_SIZE,
+    EWK_CONTEXT_MENU_ITEM_PDFZOOM_IN,
+    EWK_CONTEXT_MENU_ITEM_PDFZOOM_OUT,
+    EWK_CONTEXT_MENU_ITEM_PDFAUTO_SIZE,
+    EWK_CONTEXT_MENU_ITEM_PDFSINGLE_PAGE,
+    EWK_CONTEXT_MENU_ITEM_PDFFACING_PAGES,
+    EWK_CONTEXT_MENU_ITEM_PDFCONTINUOUS,
+    EWK_CONTEXT_MENU_ITEM_PDFNEXT_PAGE,
+    EWK_CONTEXT_MENU_ITEM_PDFPREVIOUS_PAGE,
+    EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK = 2000,
+    EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR,
+    EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU, /**< spelling or spelling/grammar sub-menu */
+    EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SPELLING_PANEL,
+    EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING,
+    EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING,
+    EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING,
+    EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU, /**< font sub-menu */
+    EWK_CONTEXT_MENU_ITEM_TAG_SHOW_FONTS,
+    EWK_CONTEXT_MENU_ITEM_TAG_BOLD,
+    EWK_CONTEXT_MENU_ITEM_TAG_ITALIC,
+    EWK_CONTEXT_MENU_ITEM_TAG_UNDERLINE,
+    EWK_CONTEXT_MENU_ITEM_TAG_OUTLINE,
+    EWK_CONTEXT_MENU_ITEM_TAG_STYLES,
+    EWK_CONTEXT_MENU_ITEM_TAG_SHOW_COLORS,
+    EWK_CONTEXT_MENU_ITEM_TAG_SPEECH_MENU, /**< speech sub-menu */
+    EWK_CONTEXT_MENU_ITEM_TAG_START_SPEAKING,
+    EWK_CONTEXT_MENU_ITEM_TAG_STOP_SPEAKING,
+    EWK_CONTEXT_MENU_ITEM_TAG_WRITING_DIRECTION_MENU, /**< writing direction sub-menu */
+    EWK_CONTEXT_MENU_ITEM_TAG_DEFAULT_DIRECTION,
+    EWK_CONTEXT_MENU_ITEM_TAG_LEFT_TO_RIGHT,
+    EWK_CONTEXT_MENU_ITEM_TAG_RIGHT_TO_LEFT,
+    EWK_CONTEXT_MENU_ITEM_TAG_PDFSINGLE_PAGE_SCROLLING,
+    EWK_CONTEXT_MENU_ITEM_TAG_PDFFACING_PAGES_SCROLLING,
+    EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT,
+    EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_MENU, /**< text direction sub-menu */
+    EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT,
+    EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT,
+    EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT,
+    EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW,
+    EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD,
+    EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS,
+    EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP,
+    EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN,
+    EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE,
+    EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE,
+    EWK_CONTEXT_MENU_ITEM_BASE_CUSTOM_TAG = 5000,
+    EWK_CONTEXT_MENU_ITEM_CUSTOM_TAG_NO_ACTION = 5998,
+    EWK_CONTEXT_MENU_ITEM_LAST_CUSTOM_TAG = 5999,
+    EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG = 10000
+} Ewk_Context_Menu_Item_Action;
+
+/**
+ * Creates a new item of the context menu.
+ *
+ * @param type specifies a type of the item
+ * @param action specifies a action of the item
+ * @param title specifies a title of the item
+ * @param checked @c EINA_TRUE if the item should be toggled or @c EINA_FALSE if not
+ * @param enabled @c EINA_TRUE to enable the item or @c EINA_FALSE to disable
+ * @return the pointer to the new item
+ *
+ * @see ewk_context_menu_item_new_with_submenu
+ */
+EAPI Ewk_Context_Menu_Item *ewk_context_menu_item_new(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char *title, Eina_Bool checked, Eina_Bool enabled);
+
+/**
+ * Creates a new item of the context menu.
+ *
+ * @param type specifies a type of the item
+ * @param action specifies a action of the item
+ * @param title specifies a title of the item
+ * @param checked @c EINA_TRUE if the item should be toggled or @c EINA_FALSE if not
+ * @param enabled @c EINA_TRUE to enable the item or @c EINA_FALSE to disable
+ * @param submenu specifies a submenu of the item
+ * @return the pointer to the new item
+ *
+ * @see ewk_context_menu_item_new
+ */
+EAPI Ewk_Context_Menu_Item *ewk_context_menu_item_new_with_submenu(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char *title, Eina_Bool checked, Eina_Bool enabled, Ewk_Context_Menu *submenu);
+
+/**
+ * Gets type of the item.
+ *
+ * @param o the item to get the type
+ * @return type of the item on success or @c EWK_ACTION_TYPE on failure
+ *
+ * @see ewk_context_menu_item_type_set
+ */
+EAPI Ewk_Context_Menu_Item_Type ewk_context_menu_item_type_get(const Ewk_Context_Menu_Item *o);
+
+/**
+ * Sets the type of item.
+ *
+ * @param o the item to set the type
+ * @param type a new type for the item object
+ * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
+ *
+ * @see ewk_context_menu_item_type_get
+ */
+EAPI Eina_Bool ewk_context_menu_item_type_set(Ewk_Context_Menu_Item *o, Ewk_Context_Menu_Item_Type type);
+
+/**
+ * Gets an action of the item.
+ *
+ * @param o the item to get the action
+ * @return an action of the item on success or @c EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION on failure
+ *
+ * @see ewk_context_menu_item_action_set
+ */
+EAPI Ewk_Context_Menu_Item_Action ewk_context_menu_item_action_get(const Ewk_Context_Menu_Item *o);
+
+/**
+ * Sets an action of the item.
+ *
+ * @param o the item to set the action
+ * @param action a new action for the item object
+ * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
+ *
+ * @see ewk_context_menu_item_action_get
+ */
+EAPI Eina_Bool ewk_context_menu_item_action_set(Ewk_Context_Menu_Item *o, Ewk_Context_Menu_Item_Action action);
+
+/**
+ * Gets a title of the item.
+ *
+ * @param o the item to get the title
+ * @return a title of the item on success, or @c NULL on failure
+ *
+ * @see ewk_context_menu_item_title_set
+ */
+EAPI const char *ewk_context_menu_item_title_get(const Ewk_Context_Menu_Item *o);
+
+/**
+ * Sets a title of the item.
+ *
+ * @param o the item to set the title
+ * @param title a new title for the item object
+ * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
+ *
+ * @see ewk_context_menu_item_title_get
+ */
+EAPI Eina_Bool ewk_context_menu_item_title_set(Ewk_Context_Menu_Item *o, const char *title);
+
+/**
+ * Queries if the item is toggled.
+ *
+ * @param o the item to query if the item is toggled
+ * @return @c EINA_TRUE if the item is toggled or @c EINA_FALSE if not or on failure
+ */
+EAPI Eina_Bool ewk_context_menu_item_checked_get(const Ewk_Context_Menu_Item *o);
+
+/**
+ * Sets if the item should be toggled.
+ *
+ * @param o the item to be toggled
+ * @param checked @c EINA_TRUE if the item should be toggled or @c EINA_FALSE if not
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_context_menu_item_checked_set(Ewk_Context_Menu_Item *o, Eina_Bool checked);
+
+/**
+ * Gets if the item is enabled.
+ *
+ * @param o the item to get enabled state
+ * @return @c EINA_TRUE if it's enabled, @c EINA_FALSE if not or on failure
+ *
+ * @see ewk_context_menu_item_enabled_set
+ */
+EAPI Eina_Bool ewk_context_menu_item_enabled_get(const Ewk_Context_Menu_Item *o);
+
+/**
+ * Enables/disables the item.
+ *
+ * @param o the item to enable/disable
+ * @param enabled @c EINA_TRUE to enable the item or @c EINA_FALSE to disable
+ * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
+ *
+ * @see ewk_context_menu_item_enabled_get
+ */
+EAPI Eina_Bool ewk_context_menu_item_enabled_set(Ewk_Context_Menu_Item *o, Eina_Bool enabled);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ewk_context_menu_item_h */
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item_private.h
new file mode 100644 (file)
index 0000000..62f2790
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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 ewk_context_menu_item_private_h
+#define ewk_context_menu_item_private_h
+
+#include "WKEinaSharedString.h"
+#include "WebContextMenuItemData.h"
+#include "ewk_context_menu.h"
+#include "ewk_context_menu_item.h"
+#include <wtf/PassOwnPtr.h>
+
+/**
+ * \struct  Ewk_Context_Menu_Item
+ * @brief   Contains the context menu item data.
+ */
+class EwkContextMenuItem {
+public:
+    static PassOwnPtr<EwkContextMenuItem> create(const WebKit::WebContextMenuItemData& item)
+    {
+        return adoptPtr(new EwkContextMenuItem(item));
+    }
+
+    static PassOwnPtr<EwkContextMenuItem> create(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled, EwkContextMenu* subMenu)
+    {
+        return adoptPtr(new EwkContextMenuItem(type, action, title, checked, enabled, subMenu));
+    }
+
+    Ewk_Context_Menu_Item_Action action() const { return m_action; }
+    void setAction(Ewk_Context_Menu_Item_Action action) { m_action = action; }
+
+    const char* title() const { return m_title; }
+    void setTitle(const char* title) { m_title = title; }
+
+    Ewk_Context_Menu_Item_Type type() const { return m_type; }
+    void setType(Ewk_Context_Menu_Item_Type type) { m_type = type; }
+
+    bool checked() const { return m_isChecked; }
+    void setChecked(bool checked) { m_isChecked = checked; }
+
+    bool enabled() const { return m_isEnabled; }
+    void setEnabled(bool enabled) { m_isEnabled = enabled; }
+
+private:
+    explicit EwkContextMenuItem(const WebKit::WebContextMenuItemData&);
+    EwkContextMenuItem(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled, EwkContextMenu* subMenu);
+
+    Ewk_Context_Menu_Item_Type m_type;
+    Ewk_Context_Menu_Item_Action m_action;
+
+    WKEinaSharedString m_title;
+    
+    bool m_isChecked;
+    bool m_isEnabled;
+
+    Ewk_Context_Menu* m_parentMenu;
+    Ewk_Context_Menu* m_subMenu;
+};
+
+#endif // ewk_context_menu_item_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_private.h
new file mode 100644 (file)
index 0000000..29f5c90
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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 ewk_context_menu_private_h
+#define ewk_context_menu_private_h
+
+#include "WebContextMenuItemData.h"
+#include "ewk_context_menu_item.h"
+#include <Eina.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebKit {
+class WebContextMenuItemData;
+class WebContextMenuProxyEfl;
+}
+
+class EwkViewImpl;
+
+class EwkContextMenu {
+public:
+    static PassOwnPtr<EwkContextMenu> create(EwkViewImpl* viewImpl, WebKit::WebContextMenuProxyEfl* contextMenuProxy, const Vector<WebKit::WebContextMenuItemData>& items)
+    {
+        return adoptPtr(new EwkContextMenu(viewImpl, contextMenuProxy, items));
+    }
+
+    static PassOwnPtr<EwkContextMenu> create()
+    {
+        return adoptPtr(new EwkContextMenu());
+    }
+
+    static PassOwnPtr<EwkContextMenu> create(Eina_List* items)
+    {
+        return adoptPtr(new EwkContextMenu(items));
+    }
+
+    ~EwkContextMenu();
+
+    void hide();
+    void appendItem(EwkContextMenuItem*);
+    void removeItem(EwkContextMenuItem*);
+
+    const Eina_List* items() const { return m_contextMenuItems; }
+    void contextMenuItemSelected(const WebKit::WebContextMenuItemData& item);
+
+private:
+    EwkContextMenu();
+    EwkContextMenu(Eina_List* items);
+    EwkContextMenu(EwkViewImpl* viewImpl, WebKit::WebContextMenuProxyEfl*, const Vector<WebKit::WebContextMenuItemData>& items);
+
+    EwkViewImpl* m_viewImpl;
+    WebKit::WebContextMenuProxyEfl* m_contextMenuProxy;
+    Eina_List* m_contextMenuItems;
+};
+
+#endif // ewk_context_menu_private_h
+
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_defines.h b/Source/WebKit2/UIProcess/API/efl/ewk_defines.h
new file mode 100644 (file)
index 0000000..97320fb
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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.
+ */
+
+/**
+ * @file    ewk_defines.h
+ * @brief   Defines the Ewk Structs
+ */
+
+#ifndef ewk_defines_h
+#define ewk_defines_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for Ewk_Context_Menu */
+typedef struct EwkContextMenu Ewk_Context_Menu;
+
+/** Creates a type name for Ewk_Context_Menu_Item */
+typedef struct EwkContextMenuItem Ewk_Context_Menu_Item;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ewk_defines_h */
index 481778d..9a408ab 100644 (file)
@@ -82,6 +82,7 @@
 #include "ewk_back_forward_list.h"
 #include "ewk_color_picker.h"
 #include "ewk_context.h"
+#include "ewk_context_menu.h"
 #include "ewk_download_job.h"
 #include "ewk_error.h"
 #include "ewk_intent.h"
@@ -113,6 +114,9 @@ struct Ewk_View_Smart_Class {
     Evas_Smart_Class sc; /**< all but 'data' is free to be changed. */
     unsigned long version;
 
+    Eina_Bool (*context_menu_show)(Ewk_View_Smart_Data *sd, Evas_Coord x, Evas_Coord y, Ewk_Context_Menu *menu);
+    Eina_Bool (*context_menu_hide)(Ewk_View_Smart_Data *sd);
+
     Eina_Bool (*popup_menu_show)(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Ewk_Popup_Menu *menu);
     Eina_Bool (*popup_menu_hide)(Ewk_View_Smart_Data *sd);
 
@@ -169,7 +173,7 @@ struct Ewk_View_Smart_Class {
  * @see EWK_VIEW_SMART_CLASS_INIT_VERSION
  * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION
  */
-#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
 
 /**
  * Initializer to zero a whole Ewk_View_Smart_Class structure.
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_menu.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_menu.cpp
new file mode 100644 (file)
index 0000000..78858af
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+    Copyright (C) 2012 Samsung Electronics
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public License
+    along with this library; if not, write to the Free Software Foundation,
+    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "config.h"
+
+#include "UnitTestUtils/EWK2UnitTestBase.h"
+#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
+#include <EWebKit2.h>
+#include <Ecore.h>
+
+using namespace EWK2UnitTest;
+
+extern EWK2UnitTestEnvironment* environment;
+
+static inline void checkBasicContextMenuItem(Ewk_Context_Menu_Item* item, Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled)
+{
+    ASSERT_TRUE(item);
+
+    EXPECT_EQ(type, ewk_context_menu_item_type_get(item));
+    EXPECT_EQ(action, ewk_context_menu_item_action_get(item));
+    EXPECT_STREQ(title, ewk_context_menu_item_title_get(item));
+    EXPECT_EQ(checked, ewk_context_menu_item_checked_get(item));
+    EXPECT_EQ(enabled, ewk_context_menu_item_enabled_get(item));
+}
+
+static Eina_Bool showContextMenu(Ewk_View_Smart_Data* smartData, Evas_Coord x, Evas_Coord y, Ewk_Context_Menu* contextMenu)
+{
+    const Eina_List* list = ewk_context_menu_items_get(contextMenu);
+    EXPECT_EQ(4, eina_list_count(list));
+
+    Ewk_Context_Menu_Item* item = static_cast<Ewk_Context_Menu_Item*>(eina_list_nth(list, 0));
+    checkBasicContextMenuItem(item, EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK, "Go Back", false, true);
+
+    item = static_cast<Ewk_Context_Menu_Item*>(eina_list_nth(list, 1));
+    checkBasicContextMenuItem(item, EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD, "Go Forward", false, true);
+    ewk_context_menu_item_enabled_set(item, false);
+    EXPECT_FALSE(ewk_context_menu_item_enabled_get(item));
+
+    item = static_cast<Ewk_Context_Menu_Item*>(eina_list_nth(list, 2));
+    checkBasicContextMenuItem(item, EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_STOP, "Stop", false, true);
+    ewk_context_menu_item_checked_set(item, true);
+    EXPECT_TRUE(ewk_context_menu_item_checked_get(item));
+
+    item = static_cast<Ewk_Context_Menu_Item*>(eina_list_nth(list, 3));
+    checkBasicContextMenuItem(item, EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_RELOAD, "Reload", false, true);
+    ewk_context_menu_item_title_set(item, "Refresh");
+    EXPECT_STREQ("Refresh", ewk_context_menu_item_title_get(item));
+
+    // Makes new context menu items.
+    Ewk_Context_Menu_Item* newItem = ewk_context_menu_item_new(EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_OTHER, "New Custom Item", false, true);
+    ewk_context_menu_item_append(contextMenu, newItem);
+
+    Eina_List* subMenuItemList = 0;
+    Ewk_Context_Menu_Item* subMenuItem1 = ewk_context_menu_item_new(EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_OTHER, "New SubMenu Item 1", false, true);
+    Ewk_Context_Menu_Item* subMenuItem2 = ewk_context_menu_item_new(EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_OTHER, "New SubMenu Item 2", false, true);
+    Ewk_Context_Menu_Item* subMenuItem3 = ewk_context_menu_item_new(EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_OTHER, "New SubMenu Item 3", false, true);
+    subMenuItemList = eina_list_append(subMenuItemList, subMenuItem1);
+    subMenuItemList = eina_list_append(subMenuItemList, subMenuItem2);
+    subMenuItemList = eina_list_append(subMenuItemList, subMenuItem3);
+    Ewk_Context_Menu* subMenu = ewk_context_menu_new_with_items(subMenuItemList);
+    Ewk_Context_Menu_Item* newItem2 = ewk_context_menu_item_new_with_submenu(EWK_SUBMENU_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_OTHER, "New Custom Item 2", false, true, subMenu);
+    ewk_context_menu_item_append(contextMenu, newItem2);
+
+    Ewk_Context_Menu* subMenu2 = ewk_context_menu_new();
+    Ewk_Context_Menu_Item* newItem3 = ewk_context_menu_item_new_with_submenu(EWK_SUBMENU_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_OTHER, "New Custom Item 3", false, true, subMenu2);
+    ewk_context_menu_item_append(contextMenu, newItem3);
+
+    list = ewk_context_menu_items_get(contextMenu);
+    EXPECT_EQ(7, eina_list_count(list));
+
+    ewk_context_menu_item_remove(contextMenu, newItem);
+    ewk_context_menu_item_remove(contextMenu, newItem2);
+    ewk_context_menu_item_remove(contextMenu, newItem3);
+    list = ewk_context_menu_items_get(contextMenu);
+    EXPECT_EQ(4, eina_list_count(list));
+
+    EXPECT_TRUE(ewk_context_menu_item_select(contextMenu, item));
+
+    return true;
+}
+
+TEST_F(EWK2UnitTestBase, ewk_context_menu_item_select)
+{
+    const char* itemSelectHTML =
+        "<html>"
+        "<body><a href=http://www.google.com>Test Link</a></body>"
+        "</body></html>"; 
+
+    ewkViewClass()->context_menu_show = showContextMenu;
+
+    ewk_view_html_string_load(webView(), itemSelectHTML, "file:///", 0);
+    mouseClick(20, 30, /*Right*/ 3);
+    ASSERT_TRUE(waitUntilLoadFinished());
+}
diff --git a/Source/WebKit2/UIProcess/efl/ContextMenuClientEfl.cpp b/Source/WebKit2/UIProcess/efl/ContextMenuClientEfl.cpp
new file mode 100644 (file)
index 0000000..7a86028
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 "config.h"
+#include "ContextMenuClientEfl.h"
+
+#include "EwkViewImpl.h"
+#include "NotImplemented.h"
+#include "WKArray.h"
+#include "WKPage.h"
+#include "WebContextMenuItem.h"   
+#include <Evas.h>
+
+using namespace WebKit;
+
+static inline ContextMenuClientEfl* toContextClientEfl(const void* clientInfo)
+{
+    return static_cast<ContextMenuClientEfl*>(const_cast<void*>(clientInfo));
+}
+
+ContextMenuClientEfl::ContextMenuClientEfl(EwkViewImpl* viewImpl)
+    : m_viewImpl(viewImpl)
+{
+    WKPageRef pageRef = m_viewImpl->wkPage();
+    ASSERT(pageRef);
+
+    WKPageContextMenuClient contextMenuClient;
+    memset(&contextMenuClient, 0, sizeof(WKPageContextMenuClient));
+    contextMenuClient.version = kWKPageContextMenuClientCurrentVersion;
+    contextMenuClient.clientInfo = this;
+    contextMenuClient.getContextMenuFromProposedMenu_deprecatedForUseWithV0 = 0;
+    contextMenuClient.customContextMenuItemSelected = 0;
+    contextMenuClient.contextMenuDismissed = 0;
+    contextMenuClient.getContextMenuFromProposedMenu = 0;
+
+    WKPageSetPageContextMenuClient(pageRef, &contextMenuClient);
+}
+
+void ContextMenuClientEfl::getContextMenuFromProposedMenu(WKPageRef, WKArrayRef, WKArrayRef*, WKHitTestResultRef, WKTypeRef, const void*)
+{
+    notImplemented();
+}
diff --git a/Source/WebKit2/UIProcess/efl/ContextMenuClientEfl.h b/Source/WebKit2/UIProcess/efl/ContextMenuClientEfl.h
new file mode 100644 (file)
index 0000000..b29e4ed
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 ContextMenuClientEfl_h
+#define ContextMenuClientEfl_h
+
+#include "WKRetainPtr.h"
+#include "ewk_context.h"
+#include <WebKit2/WKBase.h>
+#include <wtf/HashMap.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/text/WTFString.h>
+
+class EwkViewImpl;
+
+namespace WebKit {
+
+class ContextMenuClientEfl {
+public:
+    static PassOwnPtr<ContextMenuClientEfl> create(EwkViewImpl* viewImpl)
+    {
+        return adoptPtr(new ContextMenuClientEfl(viewImpl));
+    }
+
+    static void getContextMenuFromProposedMenu(WKPageRef, WKArrayRef proposedMenu, WKArrayRef* newMenu, WKHitTestResultRef, WKTypeRef userData, const void* clientInfo);
+
+private:
+    explicit ContextMenuClientEfl(EwkViewImpl*);
+
+    EwkViewImpl* m_viewImpl;
+};
+
+} // namespace WebKit
+
+#endif // ContextMenuClientEfl_h
index 97a85f5..0ce82aa 100644 (file)
@@ -35,7 +35,7 @@
 #include "NotImplemented.h"
 #include "TextureMapper.h"
 #include "WebContext.h"
-#include "WebContextMenuProxy.h"
+#include "WebContextMenuProxyEfl.h"
 #include "WebPageGroup.h"
 #include "WebPageProxy.h"
 #include "WebPopupMenuProxyEfl.h"
@@ -221,10 +221,9 @@ PassRefPtr<WebPopupMenuProxy> PageClientBase::createPopupMenuProxy(WebPageProxy*
     return WebPopupMenuProxyEfl::create(m_viewImpl, page);
 }
 
-PassRefPtr<WebContextMenuProxy> PageClientBase::createContextMenuProxy(WebPageProxy*)
+PassRefPtr<WebContextMenuProxy> PageClientBase::createContextMenuProxy(WebPageProxy* page)
 {
-    notImplemented();
-    return 0;
+    return WebContextMenuProxyEfl::create(m_viewImpl, page);
 }
 
 #if ENABLE(INPUT_TYPE_COLOR)
diff --git a/Source/WebKit2/UIProcess/efl/WebContextMenuProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebContextMenuProxyEfl.cpp
new file mode 100644 (file)
index 0000000..ec7e0eb
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics.
+ *
+ * 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 "config.h"
+#include "WebContextMenuProxyEfl.h"
+
+#if ENABLE(CONTEXT_MENUS)
+
+#include "EwkViewImpl.h"
+#include "WebContextMenuItemData.h"
+#include "WebPageProxy.h"
+#include <wtf/text/CString.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebContextMenuProxyEfl::WebContextMenuProxyEfl(EwkViewImpl* viewImpl, WebPageProxy* page)
+    : m_viewImpl(viewImpl)
+    , m_page(page)
+{
+}
+
+WebContextMenuProxyEfl::~WebContextMenuProxyEfl()
+{
+}
+
+void WebContextMenuProxyEfl::showContextMenu(const WebCore::IntPoint& position, const Vector<WebContextMenuItemData>& items)
+{
+    m_viewImpl->showContextMenu(this, position, items);
+}
+
+void WebContextMenuProxyEfl::hideContextMenu()
+{
+    m_viewImpl->hideContextMenu();
+}
+
+void WebContextMenuProxyEfl::contextMenuItemSelected(const WebContextMenuItemData& item)
+{
+    m_page->contextMenuItemSelected(item);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(CONTEXT_MENUS)
diff --git a/Source/WebKit2/UIProcess/efl/WebContextMenuProxyEfl.h b/Source/WebKit2/UIProcess/efl/WebContextMenuProxyEfl.h
new file mode 100644 (file)
index 0000000..e7be2ab
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics.
+ *
+ * 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 WebContextMenuProxyEfl_h
+#define WebContextMenuProxyEfl_h
+
+#if ENABLE(CONTEXT_MENUS)
+
+#include "WebContextMenuProxy.h"
+#include <WebCore/ContextMenu.h>
+#include <WebCore/IntPoint.h>
+
+class EwkViewImpl;
+
+namespace WebKit {
+
+class WebContextMenuItemData;
+class WebPageProxy;
+
+class WebContextMenuProxyEfl : public WebContextMenuProxy {
+public:
+    static PassRefPtr<WebContextMenuProxyEfl> create(EwkViewImpl* viewImpl, WebPageProxy* page)
+    {
+        return adoptRef(new WebContextMenuProxyEfl(viewImpl, page));
+    }
+
+    ~WebContextMenuProxyEfl();
+
+    void showContextMenu(const WebCore::IntPoint&, const Vector<WebContextMenuItemData>&);
+    void hideContextMenu();
+
+    void contextMenuItemSelected(const WebContextMenuItemData&);
+
+private:
+    WebContextMenuProxyEfl(EwkViewImpl*, WebPageProxy*);
+
+    EwkViewImpl* m_viewImpl;
+    WebPageProxy* m_page;
+};
+
+
+} // namespace WebKit
+
+#endif // ENABLE(CONTEXT_MENUS)
+#endif // WebContextMenuProxyEfl_h