diff options
author | yaar@chromium.org <yaar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-09 18:17:44 +0000 |
---|---|---|
committer | yaar@chromium.org <yaar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-09 18:17:44 +0000 |
commit | 79e3744bbbb0867f4e356eab96703d425b3fad40 (patch) | |
tree | 790f3464f1636e542b15b2a5de852cbb6c5f9c41 /webkit/tools/test_shell | |
parent | 9068747c5591866480bd0888e571cc548d6be546 (diff) | |
download | chromium_src-79e3744bbbb0867f4e356eab96703d425b3fad40.zip chromium_src-79e3744bbbb0867f4e356eab96703d425b3fad40.tar.gz chromium_src-79e3744bbbb0867f4e356eab96703d425b3fad40.tar.bz2 |
Moving ShowContextMenu out of WebView_delegate and into WebViewClient
(Part of the Webkit API refactoring effort).
Review URL: http://codereview.chromium.org/265011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28567 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell')
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 30 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.h | 24 |
2 files changed, 16 insertions, 38 deletions
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 7b74866..68fc4af 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -21,6 +21,7 @@ #include "base/trace_event.h" #include "net/base/net_errors.h" #include "webkit/api/public/WebConsoleMessage.h" +#include "webkit/api/public/WebContextMenuData.h" #include "webkit/api/public/WebCString.h" #include "webkit/api/public/WebData.h" #include "webkit/api/public/WebDataSource.h" @@ -63,6 +64,7 @@ #endif using WebKit::WebConsoleMessage; +using WebKit::WebContextMenuData; using WebKit::WebData; using WebKit::WebDataSource; using WebKit::WebDragData; @@ -274,25 +276,6 @@ std::string TestWebViewDelegate::GetResourceDescription(uint32 identifier) { return it != resource_identifier_map_.end() ? it->second : "<unknown>"; } -void TestWebViewDelegate::ShowContextMenu( - WebView* webview, - ContextNodeType node_type, - int x, - int y, - const GURL& link_url, - const GURL& image_url, - const GURL& page_url, - const GURL& frame_url, - const ContextMenuMediaParams& media_params, - const std::wstring& selection_text, - const std::wstring& misspelled_word, - int edit_flags, - const std::string& security_info, - const std::string& frame_charset) { - CapturedContextMenuEvent context(node_type, x, y); - captured_context_menu_events_.push_back(context); -} - void TestWebViewDelegate::SetUserStyleSheetEnabled(bool is_enabled) { WebPreferences* prefs = shell_->GetWebPreferences(); prefs->user_style_sheet_enabled = is_enabled; @@ -502,6 +485,15 @@ 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); +} + + void TestWebViewDelegate::setStatusText(const WebString& text) { if (WebKit::layoutTestMode() && shell_->layout_test_controller()->ShouldDumpStatusCallbacks()) { diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index ff51b8b..a5fba55 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -24,6 +24,7 @@ #include "base/basictypes.h" #include "base/scoped_ptr.h" #include "base/weak_ptr.h" +#include "webkit/api/public/WebContextMenuData.h" #include "webkit/api/public/WebFrameClient.h" #include "webkit/api/public/WebRect.h" #if defined(OS_MACOSX) @@ -38,7 +39,6 @@ #endif #include "webkit/tools/test_shell/test_navigation_controller.h" -struct ContextMenuMediaParams; struct WebPreferences; class GURL; class TestShell; @@ -50,7 +50,7 @@ class TestWebViewDelegate : public WebViewDelegate, public base::SupportsWeakPtr<TestWebViewDelegate> { public: struct CapturedContextMenuEvent { - CapturedContextMenuEvent(ContextNodeType in_node_type, + CapturedContextMenuEvent(int in_node_type, int in_x, int in_y) : node_type(in_node_type), @@ -58,29 +58,13 @@ class TestWebViewDelegate : public WebViewDelegate, y(in_y) { } - ContextNodeType node_type; + int node_type; int x; int y; }; typedef std::vector<CapturedContextMenuEvent> CapturedContextMenuEvents; - // WebViewDelegate - virtual void ShowContextMenu(WebView* webview, - ContextNodeType node_type, - int x, - int y, - const GURL& link_url, - const GURL& image_url, - const GURL& page_url, - const GURL& frame_url, - const ContextMenuMediaParams& media_params, - const std::wstring& selection_text, - const std::wstring& misspelled_word, - int edit_flags, - const std::string& security_info, - const std::string& frame_charset); - // WebKit::WebViewClient virtual WebView* createView(WebKit::WebFrame* creator); virtual WebKit::WebWidget* createPopupMenu(bool activatable); @@ -139,6 +123,8 @@ class TestWebViewDelegate : public WebViewDelegate, 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 setMouseOverURL(const WebKit::WebURL& url) {} virtual void setToolTipText( |