[haiku-webkit-commits] r567 - webkit/trunk/WebKit/haiku/WebCoreSupport

  • From: noreply@xxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Thu, 30 Dec 2010 08:11:19 +0100 (CET)

Author: leavengood
Date: Thu Dec 30 08:11:19 2010
New Revision: 567
URL: http://webpositive.haiku-os.org/changeset/567

Log:
Fix Haiku bug #6943 (partially) by implementing the code for handling the
"Search web" context menu. This code was borrowed from the Windows port but
will likely be changed when support for OpenSearch is added.

Modified:
   webkit/trunk/WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.cpp

Modified: webkit/trunk/WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.cpp Thu Dec 
30 07:34:45 2010        (r566)
+++ webkit/trunk/WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.cpp Thu Dec 
30 08:11:19 2010        (r567)
@@ -31,6 +31,10 @@
 #include "HitTestResult.h"
 #include "KURL.h"
 #include "NotImplemented.h"
+#include "Frame.h"
+#include "FrameLoader.h"
+#include "FrameLoadRequest.h"
+#include "Page.h"
 #include "ResourceRequest.h"
 #include "WebPage.h"
 
@@ -68,6 +72,22 @@
     BWebPage::requestDownload(request);
 }
 
+void ContextMenuClientHaiku::searchWithGoogle(const Frame* frame)
+{
+    String searchString = frame->selectedText();
+    searchString.stripWhiteSpace();
+    String encoded = encodeWithURLEscapeSequences(searchString);
+    encoded.replace("%20", "+");
+    
+    String url("http://www.google.com/search?q=";);
+    url.append(encoded);
+    url.append("&ie=UTF-8&oe=UTF-8");
+
+    ResourceRequest request = ResourceRequest(url);
+    if (Page* page = frame->page())
+        page->mainFrame()->loader()->urlSelected(request, String(), 0, false, 
false, true, SendReferrer);
+}
+
 void ContextMenuClientHaiku::lookUpInDictionary(Frame*)
 {
     notImplemented();
@@ -88,11 +108,6 @@
 {
     notImplemented();
 }
-
-void ContextMenuClientHaiku::searchWithGoogle(const Frame*)
-{
-    notImplemented();
-}
 
 } // namespace WebCore
 

Other related posts:

  • » [haiku-webkit-commits] r567 - webkit/trunk/WebKit/haiku/WebCoreSupport - noreply