Title: [145390] trunk/Source/WebKit2
Revision
145390
Author
[email protected]
Date
2013-03-11 12:59:07 -0700 (Mon, 11 Mar 2013)

Log Message

[wk2] Search With [your search provider here] should use NSPerformService in WebKit2/Mac
https://bugs.webkit.org/show_bug.cgi?id=111995
<rdar://problem/12975669>

Reviewed by Sam Weinig.

* UIProcess/WebPageProxy.h:
(WebPageProxy): Add searchTheWeb().
* UIProcess/WebPageProxy.messages.in: Add SearchTheWeb message.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::searchTheWeb): Added. Call out to NSPerformService to search with the system default
search provider, in the browser.

* WebProcess/Plugins/PDF/PDFPlugin.h:
(PDFPlugin): Add performWebSearch().
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(-[WKPDFLayerControllerDelegate performWebSearch:]): Added, forward the delegate callback to PDFPlugin.
(WebKit::PDFPlugin::performWebSearch): Added, forward the search string to WebPageProxy.
* WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
(WebKit::WebContextMenuClient::searchWithGoogle): Don't build the old load-Google-in-the-main-frame code on Mac.
* WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
(WebKit::WebContextMenuClient::searchWithGoogle): Instead, send the search string to WebPageProxy.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (145389 => 145390)


--- trunk/Source/WebKit2/ChangeLog	2013-03-11 19:57:23 UTC (rev 145389)
+++ trunk/Source/WebKit2/ChangeLog	2013-03-11 19:59:07 UTC (rev 145390)
@@ -1,3 +1,28 @@
+2013-03-11  Tim Horton  <[email protected]>
+
+        [wk2] Search With [your search provider here] should use NSPerformService in WebKit2/Mac
+        https://bugs.webkit.org/show_bug.cgi?id=111995
+        <rdar://problem/12975669>
+
+        Reviewed by Sam Weinig.
+
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy): Add searchTheWeb().
+        * UIProcess/WebPageProxy.messages.in: Add SearchTheWeb message.
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::searchTheWeb): Added. Call out to NSPerformService to search with the system default
+        search provider, in the browser.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.h:
+        (PDFPlugin): Add performWebSearch().
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (-[WKPDFLayerControllerDelegate performWebSearch:]): Added, forward the delegate callback to PDFPlugin.
+        (WebKit::PDFPlugin::performWebSearch): Added, forward the search string to WebPageProxy.
+        * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
+        (WebKit::WebContextMenuClient::searchWithGoogle): Don't build the old load-Google-in-the-main-frame code on Mac.
+        * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
+        (WebKit::WebContextMenuClient::searchWithGoogle): Instead, send the search string to WebPageProxy.
+
 2013-03-11  Helder Correia  <[email protected]>
 
         [WK2] Add C API preference: accelerated compositing for overflow scroll

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (145389 => 145390)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-03-11 19:57:23 UTC (rev 145389)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-03-11 19:59:07 UTC (rev 145390)
@@ -953,6 +953,8 @@
 
     // Spotlight.
     void searchWithSpotlight(const String&);
+        
+    void searchTheWeb(const String&);
 
     // Dictionary.
     void didPerformDictionaryLookup(const AttributedString&, const DictionaryPopupInfo&);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (145389 => 145390)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-03-11 19:57:23 UTC (rev 145389)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-03-11 19:59:07 UTC (rev 145390)
@@ -271,6 +271,8 @@
 
     # Spotlight
     SearchWithSpotlight(WTF::String string)
+
+    SearchTheWeb(WTF::String string)
 #endif
 
 #if PLATFORM(MAC)

Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (145389 => 145390)


--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2013-03-11 19:57:23 UTC (rev 145389)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2013-03-11 19:59:07 UTC (rev 145390)
@@ -117,6 +117,15 @@
     [[NSWorkspace sharedWorkspace] showSearchResultsForQueryString:nsStringFromWebCoreString(string)];
 }
     
+void WebPageProxy::searchTheWeb(const String& string)
+{
+    NSPasteboard *pasteboard = [NSPasteboard pasteboardWithUniqueName];
+    [pasteboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
+    [pasteboard setString:string forType:NSStringPboardType];
+    
+    NSPerformService(@"Search With %WebSearchProvider@", pasteboard);
+}
+    
 CGContextRef WebPageProxy::containingWindowGraphicsContext()
 {
     return m_pageClient->containingWindowGraphicsContext();

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h (145389 => 145390)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h	2013-03-11 19:57:23 UTC (rev 145389)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h	2013-03-11 19:59:07 UTC (rev 145390)
@@ -79,6 +79,7 @@
     void openWithNativeApplication();
     void writeItemsToPasteboard(NSArray *items, NSArray *types);
     void showDefinitionForAttributedString(NSAttributedString *, CGPoint);
+    void performWebSearch(NSString *);
 
     void focusNextAnnotation();
     void focusPreviousAnnotation();

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm (145389 => 145390)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2013-03-11 19:57:23 UTC (rev 145389)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2013-03-11 19:59:07 UTC (rev 145390)
@@ -160,7 +160,7 @@
 
 - (void)performWebSearch:(NSString *)string
 {
-    // FIXME: Implement.
+    _pdfPlugin->performWebSearch(string);
 }
 
 - (void)openWithNativeApplication
@@ -975,6 +975,11 @@
     return [[m_pdfLayerController.get() currentSelection] string];
 }
 
+void PDFPlugin::performWebSearch(NSString *string)
+{
+    webFrame()->page()->send(Messages::WebPageProxy::SearchTheWeb(string));
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(PDFKIT_PLUGIN)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp (145389 => 145390)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp	2013-03-11 19:57:23 UTC (rev 145389)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp	2013-03-11 19:59:07 UTC (rev 145390)
@@ -74,10 +74,9 @@
     ASSERT_NOT_REACHED();
 }
 
+#if !PLATFORM(MAC)
 void WebContextMenuClient::searchWithGoogle(const Frame* frame)
 {
-    // FIXME: this should use NSPerformService on Mac to support the system default search provider.
-
     String searchString = frame->editor()->selectedText();
     searchString.stripWhiteSpace();
     String encoded = encodeWithURLEscapeSequences(searchString);
@@ -90,6 +89,7 @@
         page->mainFrame()->loader()->urlSelected(KURL(ParsedURLString, url), String(), 0, false, false, MaybeSendReferrer);
     }
 }
+#endif
 
 #if USE(ACCESSIBILITY_CONTEXT_MENUS)
 void WebContextMenuClient::showContextMenu()

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm (145389 => 145390)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm	2013-03-11 19:57:23 UTC (rev 145389)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm	2013-03-11 19:59:07 UTC (rev 145390)
@@ -61,6 +61,14 @@
     m_page->stopSpeaking();
 }
 
+void WebContextMenuClient::searchWithGoogle(const Frame* frame)
+{
+    String searchString = frame->editor()->selectedText();
+    searchString.stripWhiteSpace();
+    
+    m_page->send(Messages::WebPageProxy::SearchTheWeb(searchString));
+}
+
 void WebContextMenuClient::searchWithSpotlight()
 {
     // FIXME: Why do we need to search all the frames like this?
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to