Commit 9e83eb71 authored by bdakin's avatar bdakin

WebCore:

        Reviewed by John.

        Fix for <rdar://problem/4914258> REGRESSION: Search in Google now 
        operates on the current WebView instead of invoking Safari's 
        service

        * page/ContextMenuClient.h: New call to the client to search in 
        google.
        * page/ContextMenuController.cpp:
        (WebCore::ContextMenuController::contextMenuItemSelected): Call 
        into the client instead of forming a new url string and loading it.
        * platform/graphics/svg/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyContextMenuClient::searchWithGoogle): New call.

WebKit:
        Reviewed by John.

        Fix for <rdar://problem/4914258> REGRESSION: Search in Google now 
        operates on the current WebView instead of invoking Safari's 
        service

        * WebCoreSupport/WebContextMenuClient.h:
        * WebCoreSupport/WebContextMenuClient.mm:
        (WebContextMenuClient::searchWithGoogle): Call into WebView to 
        search in Google.
        * WebView/WebViewInternal.h: Make _searchWithGoogleFromMenu 
        available.


git-svn-id: svn://svn.chromium.org/blink/trunk@18748 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8423169b
2007-01-10 Beth Dakin <bdakin@apple.com>
Reviewed by John.
Fix for <rdar://problem/4914258> REGRESSION: Search in Google now
operates on the current WebView instead of invoking Safari's
service
* page/ContextMenuClient.h: New call to the client to search in
google.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected): Call
into the client instead of forming a new url string and loading it.
* platform/graphics/svg/SVGImageEmptyClients.h:
(WebCore::SVGEmptyContextMenuClient::searchWithGoogle): New call.
2007-01-10 Adam Roben <aroben@apple.com> 2007-01-10 Adam Roben <aroben@apple.com>
Rubberstamped by Darin. Rubberstamped by Darin.
......
...@@ -46,6 +46,7 @@ namespace WebCore { ...@@ -46,6 +46,7 @@ namespace WebCore {
virtual void downloadURL(const KURL& url) = 0; virtual void downloadURL(const KURL& url) = 0;
virtual void copyImageToClipboard(const HitTestResult&) = 0; virtual void copyImageToClipboard(const HitTestResult&) = 0;
virtual void searchWithGoogle(const Frame*) = 0;
virtual void lookUpInDictionary(Frame*) = 0; virtual void lookUpInDictionary(Frame*) = 0;
virtual void speak(const String&) = 0; virtual void speak(const String&) = 0;
virtual void stopSpeaking() = 0; virtual void stopSpeaking() = 0;
......
...@@ -92,18 +92,6 @@ void ContextMenuController::handleContextMenuEvent(Event* event) ...@@ -92,18 +92,6 @@ void ContextMenuController::handleContextMenuEvent(Event* event)
event->setDefaultHandled(); event->setDefaultHandled();
} }
static String makeGoogleSearchURL(String searchString)
{
searchString.stripWhiteSpace();
DeprecatedString encoded = KURL::encode_string(searchString.deprecatedString());
encoded.replace(DeprecatedString("%20"), DeprecatedString("+"));
String url("http://www.google.com/search?client=safari&q=");
url.append(String(encoded));
url.append("&ie=UTF-8&oe=UTF-8");
return url;
}
static void openNewWindow(const KURL& urlToLoad, const Frame* frame) static void openNewWindow(const KURL& urlToLoad, const Frame* frame)
{ {
Page* newPage = frame->page()->chrome()->createWindow(FrameLoadRequest(ResourceRequest(urlToLoad, Page* newPage = frame->page()->chrome()->createWindow(FrameLoadRequest(ResourceRequest(urlToLoad,
...@@ -199,13 +187,9 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item) ...@@ -199,13 +187,9 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
case ContextMenuItemTagLearnSpelling: case ContextMenuItemTagLearnSpelling:
frame->editor()->learnSpelling(); frame->editor()->learnSpelling();
break; break;
case ContextMenuItemTagSearchWeb: { case ContextMenuItemTagSearchWeb:
String url = makeGoogleSearchURL(frame->selectedText()); m_client->searchWithGoogle(frame);
ResourceRequest request = ResourceRequest(url);
if (Page* page = frame->page())
page->mainFrame()->loader()->urlSelected(FrameLoadRequest(request), 0);
break; break;
}
case ContextMenuItemTagLookUpInDictionary: case ContextMenuItemTagLookUpInDictionary:
// FIXME: Some day we may be able to do this from within WebCore. // FIXME: Some day we may be able to do this from within WebCore.
m_client->lookUpInDictionary(frame); m_client->lookUpInDictionary(frame);
......
...@@ -333,6 +333,7 @@ public: ...@@ -333,6 +333,7 @@ public:
virtual void downloadURL(const KURL& url) { } virtual void downloadURL(const KURL& url) { }
virtual void copyImageToClipboard(const HitTestResult&) { } virtual void copyImageToClipboard(const HitTestResult&) { }
virtual void searchWithGoogle(const Frame*) { }
virtual void lookUpInDictionary(Frame*) { } virtual void lookUpInDictionary(Frame*) { }
virtual void speak(const String&) { } virtual void speak(const String&) { }
virtual void stopSpeaking() { } virtual void stopSpeaking() { }
......
2007-01-10 Beth Dakin <bdakin@apple.com>
Reviewed by John.
Fix for <rdar://problem/4914258> REGRESSION: Search in Google now
operates on the current WebView instead of invoking Safari's
service
* WebCoreSupport/WebContextMenuClient.h:
* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::searchWithGoogle): Call into WebView to
search in Google.
* WebView/WebViewInternal.h: Make _searchWithGoogleFromMenu
available.
2007-01-09 Timothy Hatcher <timothy@apple.com> 2007-01-09 Timothy Hatcher <timothy@apple.com>
Reviewed by Darin. Reviewed by Darin.
......
...@@ -43,6 +43,7 @@ public: ...@@ -43,6 +43,7 @@ public:
virtual void downloadURL(const WebCore::KURL&); virtual void downloadURL(const WebCore::KURL&);
virtual void copyImageToClipboard(const WebCore::HitTestResult&); virtual void copyImageToClipboard(const WebCore::HitTestResult&);
virtual void searchWithGoogle(const WebCore::Frame*);
virtual void lookUpInDictionary(WebCore::Frame*); virtual void lookUpInDictionary(WebCore::Frame*);
virtual void speak(const WebCore::String&); virtual void speak(const WebCore::String&);
virtual void stopSpeaking(); virtual void stopSpeaking();
......
...@@ -117,6 +117,11 @@ void WebContextMenuClient::searchWithSpotlight() ...@@ -117,6 +117,11 @@ void WebContextMenuClient::searchWithSpotlight()
[m_webView _searchWithSpotlightFromMenu:nil]; [m_webView _searchWithSpotlightFromMenu:nil];
} }
void WebContextMenuClient::searchWithGoogle(const Frame*)
{
[m_webView _searchWithGoogleFromMenu:nil];
}
void WebContextMenuClient::lookUpInDictionary(Frame* frame) void WebContextMenuClient::lookUpInDictionary(Frame* frame)
{ {
WebHTMLView* htmlView = (WebHTMLView*)[[kit(frame) frameView] documentView]; WebHTMLView* htmlView = (WebHTMLView*)[[kit(frame) frameView] documentView];
......
...@@ -96,6 +96,7 @@ WebResourceDelegateImplementationCache WebViewGetResourceLoadDelegateImplementat ...@@ -96,6 +96,7 @@ WebResourceDelegateImplementationCache WebViewGetResourceLoadDelegateImplementat
- (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request; - (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request;
- (void)_writeImageForElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard; - (void)_writeImageForElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
- (void)_writeLinkElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard; - (void)_writeLinkElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
- (void)_searchWithGoogleFromMenu:(id)sender;
- (void)_searchWithSpotlightFromMenu:(id)sender; - (void)_searchWithSpotlightFromMenu:(id)sender;
- (void)_progressCompleted:(WebFrame *)frame; - (void)_progressCompleted:(WebFrame *)frame;
- (void)_didCommitLoadForFrame:(WebFrame *)frame; - (void)_didCommitLoadForFrame:(WebFrame *)frame;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment