[GTK] [WK2] TestContextMenu default-menu fails
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Sep 2013 16:51:03 +0000 (16:51 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Sep 2013 16:51:03 +0000 (16:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=120459

Patch by Brian Holt <brian.holt@samsung.com> on 2013-09-03
Reviewed by Gustavo Noronha Silva.

Add context menu items for downloading media elements.

* UIProcess/API/gtk/WebKitContextMenuActions.cpp:
(webkitContextMenuActionGetActionTag):
(webkitContextMenuActionGetForContextMenuItem):
(webkitContextMenuActionGetLabel):
* UIProcess/API/gtk/WebKitContextMenuActions.h:
* UIProcess/API/gtk/tests/TestContextMenu.cpp:

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuActions.h
Source/WebKit2/UIProcess/API/gtk/tests/TestContextMenu.cpp

index a0ff01d9e7f1550ac930c1832d3d544670c7ff64..3970d08aeb656c8250ef0435fcf2a2991bd2dc33 100644 (file)
@@ -1,3 +1,19 @@
+2013-09-03  Brian Holt  <brian.holt@samsung.com>
+
+        [GTK] [WK2] TestContextMenu default-menu fails
+        https://bugs.webkit.org/show_bug.cgi?id=120459
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Add context menu items for downloading media elements.
+
+        * UIProcess/API/gtk/WebKitContextMenuActions.cpp:
+        (webkitContextMenuActionGetActionTag):
+        (webkitContextMenuActionGetForContextMenuItem):
+        (webkitContextMenuActionGetLabel):
+        * UIProcess/API/gtk/WebKitContextMenuActions.h:
+        * UIProcess/API/gtk/tests/TestContextMenu.cpp:
+
 2013-09-02  Darin Adler  <darin@apple.com>
 
         Cut down on double hashing and code needlessly using hash table iterators
index 3793d7c0f77675f28b3dada75d746d7dbe280e81..e8cdffd04f1b225acc7ea53489646bbaf14adef7 100644 (file)
@@ -123,6 +123,9 @@ ContextMenuAction webkitContextMenuActionGetActionTag(WebKitContextMenuAction ac
         return ContextMenuItemTagMediaPlayPause;
     case WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE:
         return ContextMenuItemTagMediaMute;
+    case WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_VIDEO_TO_DISK:
+    case WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_AUDIO_TO_DISK:
+        return ContextMenuItemTagDownloadMediaToDisk;
     case WEBKIT_CONTEXT_MENU_ACTION_CUSTOM:
         return ContextMenuItemBaseApplicationTag;
     default:
@@ -214,6 +217,9 @@ WebKitContextMenuAction webkitContextMenuActionGetForContextMenuItem(ContextMenu
             WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PLAY : WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PAUSE;
     case ContextMenuItemTagMediaMute:
         return WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE;
+    case ContextMenuItemTagDownloadMediaToDisk:
+        return menuItem->title() == contextMenuItemTagDownloadVideoToDisk() ?
+            WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_VIDEO_TO_DISK : WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_AUDIO_TO_DISK;
     case ContextMenuItemBaseApplicationTag:
         return WEBKIT_CONTEXT_MENU_ACTION_CUSTOM;
     default:
@@ -306,6 +312,10 @@ String webkitContextMenuActionGetLabel(WebKitContextMenuAction action)
         return contextMenuItemTagMediaPause();
     case WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE:
         return contextMenuItemTagMediaMute();
+    case WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_VIDEO_TO_DISK:
+        return contextMenuItemTagDownloadVideoToDisk();
+    case WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_AUDIO_TO_DISK:
+        return contextMenuItemTagDownloadAudioToDisk();
     case WEBKIT_CONTEXT_MENU_ACTION_NO_ACTION:
     case WEBKIT_CONTEXT_MENU_ACTION_CUSTOM:
     case WEBKIT_CONTEXT_MENU_ACTION_SPELLING_GUESS:
index 185bd251fc0f48c134bd7134ef1e6327deda6001..5a179dfa5ec04a3ddf5062d8d300b7a0c5027638 100644 (file)
@@ -72,6 +72,8 @@ G_BEGIN_DECLS
  * @WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PLAY: Play current media element.
  * @WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PAUSE: Pause current media element.
  * @WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE: Mute current media element.
+ * @WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_VIDEO_TO_DISK: Download video to disk.
+ * @WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_AUDIO_TO_DISK: Download audio to disk.
  * @WEBKIT_CONTEXT_MENU_ACTION_CUSTOM: Custom action defined by applications.
  *
  * Enum values used to denote the stock actions for
@@ -121,6 +123,8 @@ typedef enum {
     WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PLAY,
     WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PAUSE,
     WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE,
+    WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_VIDEO_TO_DISK,
+    WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_AUDIO_TO_DISK,
 
     WEBKIT_CONTEXT_MENU_ACTION_CUSTOM = 10000
 } WebKitContextMenuAction;
index c361f8baf26c2bc186b838f0f862e961f69b2526..d3e42af41eda20b9c8d189199a37e9252a8078b1 100644 (file)
@@ -309,6 +309,7 @@ public:
             iter = checkCurrentItemIsSeparatorAndGetNext(iter);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_COPY_VIDEO_LINK_TO_CLIPBOARD, Visible | Enabled);
             iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_OPEN_VIDEO_IN_NEW_WINDOW, Visible | Enabled);
+            iter = checkCurrentItemIsStockActionAndGetNext(iter, WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_VIDEO_TO_DISK, Visible | Enabled);
             break;
         case Editable:
             g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));