summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-12 20:42:51 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-12 20:42:51 +0000
commit35be7ecb614853d450ea138e2c97cae9633a40a8 (patch)
tree4ac9b3433b0ab401b8fdff8f32bd5f973fd140f7 /webkit
parentc9ec57f7bcc1fb9f8fddfc89e2746b0206691711 (diff)
downloadchromium_src-35be7ecb614853d450ea138e2c97cae9633a40a8.zip
chromium_src-35be7ecb614853d450ea138e2c97cae9633a40a8.tar.gz
chromium_src-35be7ecb614853d450ea138e2c97cae9633a40a8.tar.bz2
Move ContextMenuParams struct from webkit/glue to content/public/common. The reasons are:
-this struct wasn't used at all in webkit layer, so no need to have it there -we can avoid exposing content layer's serialization of SSLInfo to embedders -avoid mentioning routing_ids in the webkit layer BUG=98716 Review URL: https://chromiumcodereview.appspot.com/9382037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121673 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/context_menu.cc75
-rw-r--r--webkit/glue/context_menu.h141
-rw-r--r--webkit/glue/context_menu_unittest.cc68
-rw-r--r--webkit/glue/webkit_glue.gypi2
-rw-r--r--webkit/tools/test_shell/test_shell.gypi1
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc13
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h9
7 files changed, 0 insertions, 309 deletions
diff --git a/webkit/glue/context_menu.cc b/webkit/glue/context_menu.cc
deleted file mode 100644
index 634bfd9..0000000
--- a/webkit/glue/context_menu.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "webkit/glue/context_menu.h"
-#include "webkit/glue/glue_serialize.h"
-
-namespace webkit_glue {
-
-const int32 CustomContextMenuContext::kCurrentRenderWidget = kint32max;
-
-CustomContextMenuContext::CustomContextMenuContext()
- : is_pepper_menu(false),
- request_id(0),
- render_widget_id(kCurrentRenderWidget) {
-}
-
-} // namespace webkit_glue
-
-ContextMenuParams::ContextMenuParams()
- : media_type(WebKit::WebContextMenuData::MediaTypeNone),
- x(0),
- y(0),
- is_image_blocked(false),
- frame_id(0),
- media_flags(0),
- speech_input_enabled(false),
- spellcheck_enabled(false),
- is_editable(false),
- edit_flags(0),
- referrer_policy(WebKit::WebReferrerPolicyDefault) {
-}
-
-ContextMenuParams::ContextMenuParams(const WebKit::WebContextMenuData& data)
- : media_type(data.mediaType),
- x(data.mousePosition.x),
- y(data.mousePosition.y),
- link_url(data.linkURL),
- unfiltered_link_url(data.linkURL),
- src_url(data.srcURL),
- is_image_blocked(data.isImageBlocked),
- page_url(data.pageURL),
- keyword_url(data.keywordURL),
- frame_url(data.frameURL),
- frame_id(0),
- media_flags(data.mediaFlags),
- selection_text(data.selectedText),
- misspelled_word(data.misspelledWord),
- speech_input_enabled(data.isSpeechInputEnabled),
- spellcheck_enabled(data.isSpellCheckingEnabled),
- is_editable(data.isEditable),
-#if defined(OS_MACOSX)
- writing_direction_default(data.writingDirectionDefault),
- writing_direction_left_to_right(data.writingDirectionLeftToRight),
- writing_direction_right_to_left(data.writingDirectionRightToLeft),
-#endif // OS_MACOSX
- edit_flags(data.editFlags),
- security_info(data.securityInfo),
- frame_charset(data.frameEncoding.utf8()),
- referrer_policy(data.referrerPolicy) {
- for (size_t i = 0; i < data.dictionarySuggestions.size(); ++i)
- dictionary_suggestions.push_back(data.dictionarySuggestions[i]);
-
- custom_context.is_pepper_menu = false;
- for (size_t i = 0; i < data.customItems.size(); ++i)
- custom_items.push_back(WebMenuItem(data.customItems[i]));
-
- if (!data.frameHistoryItem.isNull()) {
- frame_content_state =
- webkit_glue::HistoryItemToString(data.frameHistoryItem);
- }
-}
-
-ContextMenuParams::~ContextMenuParams() {
-}
diff --git a/webkit/glue/context_menu.h b/webkit/glue/context_menu.h
deleted file mode 100644
index 895d689..0000000
--- a/webkit/glue/context_menu.h
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_GLUE_CONTEXT_MENU_H_
-#define WEBKIT_GLUE_CONTEXT_MENU_H_
-
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/string16.h"
-#include "googleurl/src/gurl.h"
-#include "webkit/glue/webkit_glue_export.h"
-#include "webkit/glue/webmenuitem.h"
-
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h"
-
-namespace webkit_glue {
-
-struct CustomContextMenuContext {
- bool is_pepper_menu;
- int request_id;
- // The routing ID of the render widget on which the context menu is shown.
- // It could also be |kCurrentRenderWidget|, which means the render widget that
- // the corresponding ViewHostMsg_ContextMenu is sent to.
- int32 render_widget_id;
- WEBKIT_GLUE_EXPORT static const int32 kCurrentRenderWidget;
-
- WEBKIT_GLUE_EXPORT CustomContextMenuContext();
-};
-
-} // namespace webkit_glue
-
-// TODO(viettrungluu): Put this in the webkit_glue namespace.
-// Parameters structure for ViewHostMsg_ContextMenu.
-// FIXME(beng): This would be more useful in the future and more efficient
-// if the parameters here weren't so literally mapped to what
-// they contain for the ContextMenu task. It might be better
-// to make the string fields more generic so that this object
-// could be used for more contextual actions.
-struct WEBKIT_GLUE_EXPORT ContextMenuParams {
- // This is the type of Context Node that the context menu was invoked on.
- WebKit::WebContextMenuData::MediaType media_type;
-
- // These values represent the coordinates of the mouse when the context menu
- // was invoked. Coords are relative to the associated RenderView's origin.
- int x;
- int y;
-
- // This is the URL of the link that encloses the node the context menu was
- // invoked on.
- GURL link_url;
-
- // The link URL to be used ONLY for "copy link address". We don't validate
- // this field in the frontend process.
- GURL unfiltered_link_url;
-
- // This is the source URL for the element that the context menu was
- // invoked on. Example of elements with source URLs are img, audio, and
- // video.
- GURL src_url;
-
- // This is true if the context menu was invoked on a blocked image.
- bool is_image_blocked;
-
- // This is the URL of the top level page that the context menu was invoked
- // on.
- GURL page_url;
-
- // This is the absolute keyword search URL including the %s search tag when
- // the "Add as search engine..." option is clicked (left empty if not used).
- GURL keyword_url;
-
- // This is the URL of the subframe that the context menu was invoked on.
- GURL frame_url;
-
- // This is the ID of the subframe that the context menu was invoked on.
- int64 frame_id;
-
- // This is the history item state of the subframe that the context menu was
- // invoked on.
- std::string frame_content_state;
-
- // These are the parameters for the media element that the context menu
- // was invoked on.
- int media_flags;
-
- // This is the text of the selection that the context menu was invoked on.
- string16 selection_text;
-
- // The misspelled word under the cursor, if any. Used to generate the
- // |dictionary_suggestions| list.
- string16 misspelled_word;
-
- // Suggested replacements for a misspelled word under the cursor.
- // This vector gets populated in the render process host
- // by intercepting ViewHostMsg_ContextMenu in ResourceMessageFilter
- // and populating dictionary_suggestions if the type is EDITABLE
- // and the misspelled_word is not empty.
- std::vector<string16> dictionary_suggestions;
-
- // If editable, flag for whether node is speech-input enabled.
- bool speech_input_enabled;
-
- // If editable, flag for whether spell check is enabled or not.
- bool spellcheck_enabled;
-
- // Whether context is editable.
- bool is_editable;
-
-#if defined(OS_MACOSX)
- // Writing direction menu items.
- // Currently only used on OS X.
- int writing_direction_default;
- int writing_direction_left_to_right;
- int writing_direction_right_to_left;
-#endif // OS_MACOSX
-
- // These flags indicate to the browser whether the renderer believes it is
- // able to perform the corresponding action.
- int edit_flags;
-
- // The security info for the resource we are showing the menu on.
- std::string security_info;
-
- // The character encoding of the frame on which the menu is invoked.
- std::string frame_charset;
-
- // The referrer policy of the frame on which the menu is invoked.
- WebKit::WebReferrerPolicy referrer_policy;
-
- webkit_glue::CustomContextMenuContext custom_context;
- std::vector<WebMenuItem> custom_items;
-
- ContextMenuParams();
- ContextMenuParams(const WebKit::WebContextMenuData& data);
- ~ContextMenuParams();
-};
-
-#endif // WEBKIT_GLUE_CONTEXT_MENU_H_
diff --git a/webkit/glue/context_menu_unittest.cc b/webkit/glue/context_menu_unittest.cc
deleted file mode 100644
index 7f54afd..0000000
--- a/webkit/glue/context_menu_unittest.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Tests for displaying context menus in corner cases (and swallowing context
-// menu events when appropriate)
-
-#include <vector>
-
-#include "base/file_path.h"
-#include "base/file_util.h"
-#include "base/message_loop.h"
-#include "googleurl/src/gurl.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
-#include "webkit/glue/webkit_glue.h"
-#include "webkit/tools/test_shell/test_shell_test.h"
-#include "webkit/tools/test_shell/test_webview_delegate.h"
-
-using WebKit::WebInputEvent;
-using WebKit::WebMouseEvent;
-using WebKit::WebView;
-
-// Right clicking inside on an iframe should produce a context menu
-class ContextMenuCapturing : public TestShellTest {
- protected:
- void SetUp() {
- TestShellTest::SetUp();
-
- iframes_data_dir_ = data_dir_;
- iframes_data_dir_ = iframes_data_dir_.AppendASCII("test_shell");
- iframes_data_dir_ = iframes_data_dir_.AppendASCII("iframes");
- ASSERT_TRUE(file_util::PathExists(iframes_data_dir_));
- }
-
- FilePath iframes_data_dir_;
-};
-
-
-TEST_F(ContextMenuCapturing, ContextMenuCapturing) {
- // Make sure we have no stored mouse event state
- TestWebViewDelegate* test_delegate = test_shell_->delegate();
- test_delegate->clear_captured_context_menu_events();
- EXPECT_EQ(0U, test_delegate->captured_context_menu_events().size());
-
- GURL test_url = GetTestURL(iframes_data_dir_, "testiframe.html");
- test_shell_->LoadURL(test_url);
- test_shell_->WaitTestFinished();
-
- // Create a right click in the center of the iframe. (I'm hoping this will
- // make this a bit more robust in case of some other formatting or other bug.)
- WebMouseEvent mouse_event;
- mouse_event.type = WebInputEvent::MouseDown;
- mouse_event.button = WebMouseEvent::ButtonRight;
- mouse_event.x = 250;
- mouse_event.y = 250;
- mouse_event.globalX = 250;
- mouse_event.globalY = 250;
-
- WebView* webview = test_shell_->webView();
- webview->handleInputEvent(mouse_event);
-
- // Now simulate the corresponding up event which should display the menu
- mouse_event.type = WebInputEvent::MouseUp;
- webview->handleInputEvent(mouse_event);
-
- EXPECT_EQ(1U, test_delegate->captured_context_menu_events().size());
-}
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 0d53a4f..bd66b1b 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -346,8 +346,6 @@
'../plugins/webview_plugin.h',
'alt_error_page_resource_fetcher.cc',
'alt_error_page_resource_fetcher.h',
- 'context_menu.cc',
- 'context_menu.h',
'cpp_binding_example.cc',
'cpp_binding_example.h',
'cpp_bound_class.cc',
diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi
index 787b403..6f49b9b 100644
--- a/webkit/tools/test_shell/test_shell.gypi
+++ b/webkit/tools/test_shell/test_shell.gypi
@@ -429,7 +429,6 @@
'../../fileapi/test_file_set.h',
'../../fileapi/webfilewriter_base_unittest.cc',
'../../glue/bookmarklet_unittest.cc',
- '../../glue/context_menu_unittest.cc',
'../../glue/cpp_bound_class_unittest.cc',
'../../glue/cpp_variant_unittest.cc',
'../../glue/dom_operations_unittest.cc',
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 36040cf..01c2b68 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -495,19 +495,6 @@ bool TestWebViewDelegate::runModalBeforeUnloadDialog(
return true; // Allow window closure.
}
-void TestWebViewDelegate::showContextMenu(
- WebFrame* frame, const WebContextMenuData& data) {
- CapturedContextMenuEvent context(data.mediaType,
- data.mousePosition.x,
- data.mousePosition.y);
- captured_context_menu_events_.push_back(context);
- last_context_menu_data_.reset(new WebContextMenuData(data));
-}
-
-void TestWebViewDelegate::ClearContextMenuData() {
- last_context_menu_data_.reset();
-}
-
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index 7bd34df..793f3c0 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -131,8 +131,6 @@ class TestWebViewDelegate : public WebKit::WebViewClient,
const WebKit::WebString& default_value, WebKit::WebString* actual_value);
virtual bool runModalBeforeUnloadDialog(
WebKit::WebFrame* frame, const WebKit::WebString& message);
- virtual void showContextMenu(
- WebKit::WebFrame* frame, const WebKit::WebContextMenuData& data);
virtual void setStatusText(const WebKit::WebString& text);
virtual void startDragging(
const WebKit::WebDragData& data, WebKit::WebDragOperationsMask mask,
@@ -265,12 +263,6 @@ class TestWebViewDelegate : public WebKit::WebViewClient,
#if defined(OS_WIN)
IDropTarget* drop_delegate() { return drop_delegate_.get(); }
#endif
- const CapturedContextMenuEvents& captured_context_menu_events() const {
- return captured_context_menu_events_;
- }
- void clear_captured_context_menu_events() {
- captured_context_menu_events_.clear();
- }
void set_pending_extra_data(TestShellExtraData* extra_data) {
pending_extra_data_.reset(extra_data);
@@ -403,7 +395,6 @@ class TestWebViewDelegate : public WebKit::WebViewClient,
ResourceMap resource_identifier_map_;
std::string GetResourceDescription(uint32 identifier);
- CapturedContextMenuEvents captured_context_menu_events_;
scoped_ptr<WebKit::WebContextMenuData> last_context_menu_data_;
WebCursor current_cursor_;