Title: [86793] trunk/Source
Revision
86793
Author
[email protected]
Date
2011-05-18 14:47:33 -0700 (Wed, 18 May 2011)

Log Message

Update the the context menu to reflect the system search provider on Mac.

<rdar://problem/9198419>

Reviewed by Sam Weinig.

Source/WebCore:

* English.lproj/Localizable.strings: Updated.
* Source/WebCore/WebCore.exp.in: Added _wkCopyDefaultSearchProviderDisplayName.
* platform/DefaultLocalizationStrategy.cpp:
(WebCore::DefaultLocalizationStrategy::contextMenuItemTagSearchWeb): Use wkCopyDefaultSearchProviderDisplayName to
create the string.
* platform/mac/WebCoreSystemInterface.h: Added wkCopyDefaultSearchProviderDisplayName.
* platform/mac/WebCoreSystemInterface.mm: Ditto.

Source/WebKit/mac:

* DefaultDelegates/WebDefaultContextMenuDelegate.mm:
(-[WebDefaultUIDelegate menuItemWithTag:target:representedObject:]): Use wkCopyDefaultSearchProviderDisplayName to
create the web search context menu title.
* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Added CopyDefaultSearchProviderDisplayName.

Source/WebKit2:

* WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
(WebKit::WebContextMenuClient::searchWithGoogle): Add a FIXME about using NSPerformService on Mac.
* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Added CopyDefaultSearchProviderDisplayName.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (86792 => 86793)


--- trunk/Source/WebCore/ChangeLog	2011-05-18 21:46:33 UTC (rev 86792)
+++ trunk/Source/WebCore/ChangeLog	2011-05-18 21:47:33 UTC (rev 86793)
@@ -1,3 +1,19 @@
+2011-05-17  Timothy Hatcher  <[email protected]>
+
+        Update the the context menu to reflect the system search provider on Mac.
+
+        <rdar://problem/9198419>
+
+        Reviewed by Sam Weinig.
+
+        * English.lproj/Localizable.strings: Updated.
+        * Source/WebCore/WebCore.exp.in: Added _wkCopyDefaultSearchProviderDisplayName.
+        * platform/DefaultLocalizationStrategy.cpp:
+        (WebCore::DefaultLocalizationStrategy::contextMenuItemTagSearchWeb): Use wkCopyDefaultSearchProviderDisplayName to
+        create the string.
+        * platform/mac/WebCoreSystemInterface.h: Added wkCopyDefaultSearchProviderDisplayName.
+        * platform/mac/WebCoreSystemInterface.mm: Ditto.
+
 2011-05-18  Rob Buis  <[email protected]>
 
         Reviewed by Nikolas Zimmermann.

Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (86792 => 86793)


--- trunk/Source/WebCore/English.lproj/Localizable.strings	2011-05-18 21:46:33 UTC (rev 86792)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings	2011-05-18 21:47:33 UTC (rev 86793)
@@ -310,12 +310,15 @@
 /* Right to Left context menu item */
 "Right to Left" = "Right to Left";
 
-/* Search in Google context menu item */
-"Search in Google" = "Search in Google";
-
 /* Search in Spotlight context menu item */
 "Search in Spotlight" = "Search in Spotlight";
 
+/* Search with search provider context menu item with provider name inserted */
+"Search with %@" = "Search with %@";
+
+/* Search with Google context menu item */
+"Search with Google" = "Search with Google";
+
 /* Selection direction context sub-menu item */
 "Selection Direction" = "Selection Direction";
 

Modified: trunk/Source/WebCore/WebCore.exp.in (86792 => 86793)


--- trunk/Source/WebCore/WebCore.exp.in	2011-05-18 21:46:33 UTC (rev 86792)
+++ trunk/Source/WebCore/WebCore.exp.in	2011-05-18 21:47:33 UTC (rev 86793)
@@ -1421,6 +1421,7 @@
 _wkContentAreaResized
 _wkContentAreaScrolled
 _wkContentAreaWillPaint
+_wkCopyDefaultSearchProviderDisplayName
 _wkCreateCTTypesetterWithUniCharProviderAndOptions
 _wkDidBeginScrollGesture
 _wkDidEndScrollGesture

Modified: trunk/Source/WebCore/platform/DefaultLocalizationStrategy.cpp (86792 => 86793)


--- trunk/Source/WebCore/platform/DefaultLocalizationStrategy.cpp	2011-05-18 21:46:33 UTC (rev 86792)
+++ trunk/Source/WebCore/platform/DefaultLocalizationStrategy.cpp	2011-05-18 21:47:33 UTC (rev 86793)
@@ -41,6 +41,10 @@
 #include <wtf/RetainPtr.h>
 #endif
 
+#if PLATFORM(MAC)
+#include "WebCoreSystemInterface.h"
+#endif
+
 namespace WebCore {
 
 // We can't use String::format for two reasons:
@@ -311,7 +315,12 @@
 
 String DefaultLocalizationStrategy::contextMenuItemTagSearchWeb()
 {
-    return WEB_UI_STRING("Search in Google", "Search in Google context menu item");
+#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+    RetainPtr<CFStringRef> searchProviderName(AdoptCF, wkCopyDefaultSearchProviderDisplayName());
+    return formatLocalizedString(WEB_UI_STRING("Search with %@", "Search with search provider context menu item with provider name inserted"), searchProviderName.get());
+#else
+    return WEB_UI_STRING("Search with Google", "Search with Google context menu item");
+#endif
 }
 
 String DefaultLocalizationStrategy::contextMenuItemTagLookUpInDictionary(const String& selectedString)

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (86792 => 86793)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2011-05-18 21:46:33 UTC (rev 86792)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2011-05-18 21:47:33 UTC (rev 86793)
@@ -261,6 +261,8 @@
 extern bool (*wkScrollbarPainterUsesOverlayScrollers)(void);
 
 extern bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
+
+extern CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
 #endif
 
 extern void (*wkUnregisterUniqueIdForElement)(id element);

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (86792 => 86793)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2011-05-18 21:46:33 UTC (rev 86792)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2011-05-18 21:47:33 UTC (rev 86793)
@@ -157,6 +157,8 @@
 bool (*wkScrollbarPainterUsesOverlayScrollers)(void);
 
 bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
+
+CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
 #endif
 
 void (*wkUnregisterUniqueIdForElement)(id element);

Modified: trunk/Source/WebKit/mac/ChangeLog (86792 => 86793)


--- trunk/Source/WebKit/mac/ChangeLog	2011-05-18 21:46:33 UTC (rev 86792)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-05-18 21:47:33 UTC (rev 86793)
@@ -1,3 +1,17 @@
+2011-05-17  Timothy Hatcher  <[email protected]>
+
+        Update the the context menu to reflect the system search provider on Mac.
+
+        <rdar://problem/9198419>
+
+        Reviewed by Sam Weinig.
+
+        * DefaultDelegates/WebDefaultContextMenuDelegate.mm:
+        (-[WebDefaultUIDelegate menuItemWithTag:target:representedObject:]): Use wkCopyDefaultSearchProviderDisplayName to
+        create the web search context menu title.
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface): Added CopyDefaultSearchProviderDisplayName.
+
 2011-05-16  Emil A Eklund  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm (86792 => 86793)


--- trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm	2011-05-18 21:46:33 UTC (rev 86792)
+++ trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm	2011-05-18 21:47:33 UTC (rev 86793)
@@ -48,6 +48,7 @@
 #import <WebCore/FrameLoader.h>
 #import <WebKit/DOM.h>
 #import <WebKit/DOMPrivate.h>
+#import <WebKitSystemInterface.h>
 #import <wtf/Assertions.h>
 
 @implementation WebDefaultUIDelegate (WebContextMenu)
@@ -87,10 +88,16 @@
             title = UI_STRING_INTERNAL("Search in Spotlight", "Search in Spotlight context menu item");
             action = ""
             break;
-        case WebMenuItemTagSearchWeb:
-            title = UI_STRING_INTERNAL("Search in Google", "Search in Google context menu item");
+        case WebMenuItemTagSearchWeb: {
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+            RetainPtr<CFStringRef> searchProviderName(AdoptCF, WKCopyDefaultSearchProviderDisplayName());
+            title = [NSString stringWithFormat:UI_STRING_INTERNAL("Search with %@", "Search with search provider context menu item with provider name inserted"), searchProviderName.get()];
+#else
+            title = UI_STRING_INTERNAL("Search with Google", "Search with Google context menu item");
+#endif
             action = ""
             break;
+        }
         case WebMenuItemTagLookUpInDictionary:
             title = UI_STRING_INTERNAL("Look Up in Dictionary", "Look Up in Dictionary context menu item");
             action = ""

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (86792 => 86793)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2011-05-18 21:46:33 UTC (rev 86792)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2011-05-18 21:47:33 UTC (rev 86793)
@@ -152,6 +152,7 @@
     INIT(DidEndScrollGesture);
     INIT(ScrollbarPainterUsesOverlayScrollers);
     INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
+    INIT(CopyDefaultSearchProviderDisplayName);
 #endif
 
     INIT(GetAXTextMarkerTypeID);

Modified: trunk/Source/WebKit2/ChangeLog (86792 => 86793)


--- trunk/Source/WebKit2/ChangeLog	2011-05-18 21:46:33 UTC (rev 86792)
+++ trunk/Source/WebKit2/ChangeLog	2011-05-18 21:47:33 UTC (rev 86793)
@@ -1,3 +1,16 @@
+2011-05-17  Timothy Hatcher  <[email protected]>
+
+        Update the the context menu to reflect the system search provider on Mac.
+
+        <rdar://problem/9198419>
+
+        Reviewed by Sam Weinig.
+
+        * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
+        (WebKit::WebContextMenuClient::searchWithGoogle): Add a FIXME about using NSPerformService on Mac.
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface): Added CopyDefaultSearchProviderDisplayName.
+
 2011-05-18  Brady Eidson  <[email protected]>
 
         Reviewed by Anders Carlsson.

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp (86792 => 86793)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp	2011-05-18 21:46:33 UTC (rev 86792)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp	2011-05-18 21:47:33 UTC (rev 86793)
@@ -70,6 +70,8 @@
 
 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);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (86792 => 86793)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2011-05-18 21:46:33 UTC (rev 86792)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2011-05-18 21:47:33 UTC (rev 86793)
@@ -146,6 +146,7 @@
         INIT(DidEndScrollGesture);
         INIT(ScrollbarPainterUsesOverlayScrollers);
         INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
+        INIT(CopyDefaultSearchProviderDisplayName);
 #else
         INIT(GetHyphenationLocationBeforeIndex);
         INIT(GetNSEventMomentumPhase);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to