Diff
Modified: trunk/Source/WebKit2/ChangeLog (168073 => 168074)
--- trunk/Source/WebKit2/ChangeLog 2014-05-01 01:04:52 UTC (rev 168073)
+++ trunk/Source/WebKit2/ChangeLog 2014-05-01 01:18:52 UTC (rev 168074)
@@ -1,3 +1,57 @@
+2014-04-30 Brady Eidson <beid...@apple.com>
+
+ If there are no services available, do not show the service controls UI
+ <rdar://problem/16735665> and https://bugs.webkit.org/show_bug.cgi?id=132410
+
+ Reviewed by Tim Horton.
+
+ Add a lightweight class that lazily polls the appropriate APIs for whether or not appropriate services
+ are installed and usable on the system:
+ * UIProcess/mac/ServicesController.h: Added.
+ (WebKit::ServicesController::imageServicesExist):
+ (WebKit::ServicesController::selectionServicesExist):
+ * UIProcess/mac/ServicesController.mm: Added.
+ (WebKit::ServicesController::shared):
+ (WebKit::ServicesController::ServicesController):
+ (WebKit::ServicesController::refreshExistingServices):
+ (WebKit::ServicesController::refreshExistingServicesTimerFired):
+
+ Add "image services exist" and "selection services exist" parameters:
+ * Shared/WebProcessCreationParameters.cpp:
+ (WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
+ (WebKit::WebProcessCreationParameters::encode):
+ (WebKit::WebProcessCreationParameters::decode):
+ * Shared/WebProcessCreationParameters.h:
+
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::createNewWebProcess):
+ (WebKit::WebContext::refreshExistingServices): Called when the context menu proxy realizes that
+ services no longer exist.
+ * UIProcess/WebContext.h:
+
+ Each WebProcess hangs on to its own copy of the flags for whether or not the services exist:
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::WebProcess):
+ (WebKit::WebProcess::initializeWebProcess):
+ (WebKit::WebProcess::setEnabledServices):
+ * WebProcess/WebProcess.h:
+ (WebKit::WebProcess::imageServicesExist):
+ (WebKit::WebProcess::selectionServicesExist):
+
+ * UIProcess/mac/WebContextMenuProxyMac.mm:
+ (WebKit::WebContextMenuProxyMac::setupServicesMenu): If the menu creation failed, the set of services
+ on the system must have changed. So ask the WebContext to refresh them.
+
+ * WebProcess/WebPage/SelectionOverlayController.cpp:
+ (WebKit::SelectionOverlayController::selectionRectsDidChange): If services don't exist, don't create an
+ overlay (and destroy any existing overlay!)
+
+ * WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm:
+ (WebKit::SelectionOverlayController::drawRect): If services don't exist, don't draw, and destroy the overlay.
+
+ * WebProcess/WebProcess.messages.in:
+ * WebKit2.xcodeproj/project.pbxproj:
+
2014-04-30 Gavin Barraclough <baraclo...@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=132415
Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (168073 => 168074)
--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp 2014-05-01 01:04:52 UTC (rev 168073)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp 2014-05-01 01:18:52 UTC (rev 168074)
@@ -48,6 +48,10 @@
, usesNetworkProcess(false)
#endif
, memoryCacheDisabled(false)
+#if ENABLE(SERVICE_CONTROLS)
+ , hasImageServices(false)
+ , hasSelectionServices(false)
+#endif
{
}
@@ -129,6 +133,11 @@
encoder << plugInAutoStartOriginHashes;
encoder << plugInAutoStartOrigins;
encoder << memoryCacheDisabled;
+
+#if ENABLE(SERVICE_CONTROLS)
+ encoder << hasImageServices;
+ encoder << hasSelectionServices;
+#endif
}
bool WebProcessCreationParameters::decode(IPC::ArgumentDecoder& decoder, WebProcessCreationParameters& parameters)
@@ -274,6 +283,13 @@
if (!decoder.decode(parameters.memoryCacheDisabled))
return false;
+#if ENABLE(SERVICE_CONTROLS)
+ if (!decoder.decode(parameters.hasImageServices))
+ return false;
+ if (!decoder.decode(parameters.hasSelectionServices))
+ return false;
+#endif
+
return true;
}
Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (168073 => 168074)
--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h 2014-05-01 01:04:52 UTC (rev 168073)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h 2014-05-01 01:18:52 UTC (rev 168074)
@@ -155,6 +155,11 @@
Vector<String> plugInAutoStartOrigins;
bool memoryCacheDisabled;
+
+#if ENABLE(SERVICE_CONTROLS)
+ bool hasImageServices;
+ bool hasSelectionServices;
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (168073 => 168074)
--- trunk/Source/WebKit2/UIProcess/WebContext.cpp 2014-05-01 01:04:52 UTC (rev 168073)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp 2014-05-01 01:18:52 UTC (rev 168074)
@@ -85,6 +85,10 @@
#include "NetworkProcessProxy.h"
#endif
+#if ENABLE(SERVICE_CONTROLS)
+#include "ServicesController.h"
+#endif
+
#if ENABLE(CUSTOM_PROTOCOLS)
#include "CustomProtocolManagerMessages.h"
#endif
@@ -616,6 +620,12 @@
parameters.memoryCacheDisabled = m_memoryCacheDisabled;
+#if ENABLE(SERVICE_CONTROLS)
+ parameters.hasImageServices = ServicesController::shared().hasImageServices();
+ parameters.hasSelectionServices = ServicesController::shared().hasSelectionServices();
+ ServicesController::shared().refreshExistingServices(this);
+#endif
+
// Add any platform specific parameters
platformInitializeWebProcess(parameters);
@@ -1292,6 +1302,14 @@
request->completedRequest(requestID, statisticsData);
}
+
+#if ENABLE(SERVICE_CONTROLS)
+void WebContext::refreshExistingServices()
+{
+ ServicesController::shared().refreshExistingServices(this);
+}
+#endif
+
void WebContext::garbageCollectJavaScriptObjects()
{
Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (168073 => 168074)
--- trunk/Source/WebKit2/UIProcess/WebContext.h 2014-05-01 01:04:52 UTC (rev 168073)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h 2014-05-01 01:18:52 UTC (rev 168074)
@@ -338,6 +338,10 @@
void setMemoryCacheDisabled(bool);
+#if ENABLE(SERVICE_CONTROLS)
+ void refreshExistingServices();
+#endif
+
private:
void platformInitialize();
@@ -386,7 +390,7 @@
#endif
void didGetStatistics(const StatisticsData&, uint64_t callbackID);
-
+
// Implemented in generated WebContextMessageReceiver.cpp
void didReceiveWebContextMessage(IPC::Connection*, IPC::MessageDecoder&);
void didReceiveSyncWebContextMessage(IPC::Connection*, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&);
Added: trunk/Source/WebKit2/UIProcess/mac/ServicesController.h (0 => 168074)
--- trunk/Source/WebKit2/UIProcess/mac/ServicesController.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/ServicesController.h 2014-05-01 01:18:52 UTC (rev 168074)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ServicesController_h
+#define ServicesController_h
+
+#if ENABLE(SERVICE_CONTROLS)
+
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/RefPtr.h>
+#include <wtf/RunLoop.h>
+
+namespace WebKit {
+
+class WebContext;
+
+class ServicesController {
+ WTF_MAKE_NONCOPYABLE(ServicesController);
+ friend class NeverDestroyed<ServicesController>;
+public:
+ static ServicesController& shared();
+
+ bool hasImageServices() const { return m_hasImageServices; }
+ bool hasSelectionServices() const { return m_hasSelectionServices; }
+
+ void refreshExistingServices(WebContext*);
+
+private:
+ ServicesController();
+
+ void refreshExistingServicesTimerFired();
+
+ RunLoop::Timer<ServicesController> m_refreshExistingServicesTimer;
+
+ bool m_hasImageServices;
+ bool m_hasSelectionServices;
+
+ HashSet<RefPtr<WebContext>> m_contextsToNotify;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_CONTROLS)
+#endif // ServicesController_h
Added: trunk/Source/WebKit2/UIProcess/mac/ServicesController.mm (0 => 168074)
--- trunk/Source/WebKit2/UIProcess/mac/ServicesController.mm (rev 0)
+++ trunk/Source/WebKit2/UIProcess/mac/ServicesController.mm 2014-05-01 01:18:52 UTC (rev 168074)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "ServicesController.h"
+
+#if ENABLE(SERVICE_CONTROLS)
+
+#import "WebContext.h"
+#import "WebProcessMessages.h"
+#import <wtf/NeverDestroyed.h>
+
+#if __has_include(<AppKit/NSSharingService_Private.h>)
+#import <AppKit/NSSharingService_Private.h>
+#else
+typedef enum {
+ NSSharingServicePickerStyleMenu = 0,
+ NSSharingServicePickerStyleRollover = 1,
+ NSSharingServicePickerStyleTextSelection = 2,
+ NSSharingServicePickerStyleDataDetector = 3
+} NSSharingServicePickerStyle;
+
+@interface NSSharingServicePicker (Details)
+@property NSSharingServicePickerStyle style;
+- (NSMenu *)menu;
+@end
+#endif
+
+namespace WebKit {
+
+ServicesController& ServicesController::shared()
+{
+ static NeverDestroyed<ServicesController> sharedController;
+ return sharedController;
+}
+
+ServicesController::ServicesController()
+ : m_refreshExistingServicesTimer(RunLoop::main(), this, &ServicesController::refreshExistingServicesTimerFired)
+ , m_hasImageServices(false)
+ , m_hasSelectionServices(false)
+{
+ m_refreshExistingServicesTimer.startOneShot(0);
+}
+
+void ServicesController::refreshExistingServices(WebContext* context)
+{
+ ASSERT(context);
+
+ m_contextsToNotify.add(context);
+ m_refreshExistingServicesTimer.startOneShot(0);
+}
+
+void ServicesController::refreshExistingServicesTimerFired()
+{
+ static NeverDestroyed<NSImage *> image([[NSImage alloc] init]);
+ RetainPtr<NSSharingServicePicker> picker = adoptNS([[NSSharingServicePicker alloc] initWithItems:@[ image ]]);
+ [picker setStyle:NSSharingServicePickerStyleRollover];
+
+ bool hasImageServices = picker.get().menu;
+
+ static NeverDestroyed<NSAttributedString *> attributedString([[NSAttributedString alloc] initWithString:@"a"]);
+ picker = adoptNS([[NSSharingServicePicker alloc] initWithItems:@[ attributedString ]]);
+ [picker setStyle:NSSharingServicePickerStyleTextSelection];
+
+ bool hasSelectionServices = picker.get().menu;
+
+ bool notifyContexts = (hasImageServices != m_hasImageServices) || (hasSelectionServices != m_hasSelectionServices);
+ m_hasSelectionServices = hasSelectionServices;
+ m_hasImageServices = hasImageServices;
+
+ if (notifyContexts) {
+ for (const RefPtr<WebContext>& context : m_contextsToNotify)
+ context->sendToAllProcesses(Messages::WebProcess::SetEnabledServices(m_hasImageServices, m_hasSelectionServices));
+ }
+
+ m_contextsToNotify.clear();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_CONTROLS)
Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm (168073 => 168074)
--- trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm 2014-05-01 01:04:52 UTC (rev 168073)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm 2014-05-01 01:18:52 UTC (rev 168074)
@@ -32,7 +32,9 @@
#import "PageClientImpl.h"
#import "ShareableBitmap.h"
#import "StringUtilities.h"
+#import "WebContext.h"
#import "WebContextMenuItemData.h"
+#import "WebProcessProxy.h"
#import "WKView.h"
#import <WebCore/GraphicsContext.h>
#import <WebCore/IntRect.h>
@@ -396,6 +398,12 @@
[[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate] setIncludeEditorServices:includeEditorServices];
m_servicesMenu = [picker menu];
+
+ // If there is no services menu, then the existing services on the system have changed.
+ // Ask the UIProcess to refresh that list of services.
+ // If <rdar://problem/16776831> is resolved then we can more accurately keep the list up to date without this call.
+ if (!m_servicesMenu)
+ m_page->process().context().refreshExistingServices();
}
void WebContextMenuProxyMac::clearServicesMenu()
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (168073 => 168074)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-05-01 01:04:52 UTC (rev 168073)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-05-01 01:18:52 UTC (rev 168074)
@@ -790,6 +790,8 @@
513A164C1630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513A16491630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp */; };
513A164D1630A9BF005D7D22 /* NetworkConnectionToWebProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = 513A164A1630A9BF005D7D22 /* NetworkConnectionToWebProcess.h */; };
514BDED316C98EDD00E4E25E /* StatisticsRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 514BDED216C98EDD00E4E25E /* StatisticsRequest.h */; };
+ 514D9F5719119D35000063A7 /* ServicesController.h in Headers */ = {isa = PBXBuildFile; fileRef = 514D9F5519119D35000063A7 /* ServicesController.h */; };
+ 514D9F5819119D35000063A7 /* ServicesController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514D9F5619119D35000063A7 /* ServicesController.mm */; };
5153569C1291B1D2000749DC /* WebPageContextMenuClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5153569A1291B1D2000749DC /* WebPageContextMenuClient.cpp */; };
5153569D1291B1D2000749DC /* WebPageContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 5153569B1291B1D2000749DC /* WebPageContextMenuClient.h */; };
51578B831209ECEF00A37C4A /* APIData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51578B821209ECEF00A37C4A /* APIData.h */; };
@@ -2640,6 +2642,8 @@
513A164A1630A9BF005D7D22 /* NetworkConnectionToWebProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkConnectionToWebProcess.h; path = NetworkProcess/NetworkConnectionToWebProcess.h; sourceTree = "<group>"; };
513A164B1630A9BF005D7D22 /* NetworkConnectionToWebProcess.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = NetworkConnectionToWebProcess.messages.in; path = NetworkProcess/NetworkConnectionToWebProcess.messages.in; sourceTree = "<group>"; };
514BDED216C98EDD00E4E25E /* StatisticsRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatisticsRequest.h; sourceTree = "<group>"; };
+ 514D9F5519119D35000063A7 /* ServicesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServicesController.h; sourceTree = "<group>"; };
+ 514D9F5619119D35000063A7 /* ServicesController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ServicesController.mm; sourceTree = "<group>"; };
5153569A1291B1D2000749DC /* WebPageContextMenuClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageContextMenuClient.cpp; sourceTree = "<group>"; };
5153569B1291B1D2000749DC /* WebPageContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageContextMenuClient.h; sourceTree = "<group>"; };
51578B821209ECEF00A37C4A /* APIData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIData.h; sourceTree = "<group>"; };
@@ -6215,6 +6219,8 @@
E18E6909169B563F009B6670 /* SecItemShimProxy.cpp */,
E18E690A169B563F009B6670 /* SecItemShimProxy.h */,
E18E690D169B57DF009B6670 /* SecItemShimProxy.messages.in */,
+ 514D9F5519119D35000063A7 /* ServicesController.h */,
+ 514D9F5619119D35000063A7 /* ServicesController.mm */,
1AA417ED12C00D87002BE67B /* TextCheckerMac.mm */,
1AF05D8514688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.h */,
1AF05D8414688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.mm */,
@@ -6708,6 +6714,7 @@
BC032DAB10F437D10058C15A /* Connection.h in Headers */,
5136183E163126DA00A99DDE /* ConnectionStack.h in Headers */,
1AC1415118AC47EE006C602C /* WKWebViewConfigurationPrivate.h in Headers */,
+ 514D9F5719119D35000063A7 /* ServicesController.h in Headers */,
CDC3830C17212282008A2FC3 /* CookieStorageShimLibrary.h in Headers */,
515E7730184015800007203F /* UniqueIDBDatabase.h in Headers */,
B878B615133428DC006888E9 /* CorrectionPanel.h in Headers */,
@@ -8500,6 +8507,7 @@
BC111A5D112F4FBB00337BAB /* WebDragClient.cpp in Sources */,
C574A37712E6099D002DFE98 /* WebDragClientMac.mm in Sources */,
BCA0EFA012332642007D3CFB /* WebEditCommandProxy.cpp in Sources */,
+ 514D9F5819119D35000063A7 /* ServicesController.mm in Sources */,
BC111A5E112F4FBB00337BAB /* WebEditorClient.cpp in Sources */,
C5237F6012441CA300780472 /* WebEditorClientMac.mm in Sources */,
BC575613126E0138006F0F12 /* APIError.cpp in Sources */,
Modified: trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.cpp (168073 => 168074)
--- trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.cpp 2014-05-01 01:04:52 UTC (rev 168073)
+++ trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.cpp 2014-05-01 01:18:52 UTC (rev 168074)
@@ -29,6 +29,7 @@
#if ENABLE(SERVICE_CONTROLS)
#include "WebPage.h"
+#include "WebProcess.h"
#include <WebCore/NotImplemented.h>
using namespace WebCore;
@@ -91,10 +92,11 @@
m_currentSelectionRects = rects;
- if (m_currentSelectionRects.isEmpty())
+ if (WebProcess::shared().hasSelectionServices() && !m_currentSelectionRects.isEmpty())
+ createOverlayIfNeeded();
+ else
destroyOverlay();
- else
- createOverlayIfNeeded();
+
#else
UNUSED_PARAM(rects);
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm (168073 => 168074)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm 2014-05-01 01:04:52 UTC (rev 168073)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm 2014-05-01 01:18:52 UTC (rev 168074)
@@ -28,6 +28,7 @@
#if ENABLE(SERVICE_CONTROLS)
+#import "WebProcess.h"
#import <WebCore/FrameView.h>
#import <WebCore/GraphicsContext.h>
#import <WebCore/MainFrame.h>
@@ -59,6 +60,11 @@
if (m_currentSelectionRects.isEmpty())
return;
+ if (!WebProcess::shared().hasSelectionServices()) {
+ destroyOverlay();
+ return;
+ }
+
if (!m_currentHighlight) {
Vector<CGRect> cgRects;
cgRects.reserveCapacity(m_currentSelectionRects.size());
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (168073 => 168074)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2014-05-01 01:04:52 UTC (rev 168073)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2014-05-01 01:18:52 UTC (rev 168074)
@@ -167,6 +167,10 @@
#if ENABLE(NETSCAPE_PLUGIN_API)
, m_pluginProcessConnectionManager(PluginProcessConnectionManager::create())
#endif
+#if ENABLE(SERVICE_CONTROLS)
+ , m_hasImageServices(false)
+ , m_hasSelectionServices(false)
+#endif
, m_nonVisibleProcessCleanupTimer(this, &WebProcess::nonVisibleProcessCleanupTimerFired)
{
// Initialize our platform strategies.
@@ -359,6 +363,10 @@
m_plugInAutoStartOrigins.add(parameters.plugInAutoStartOrigins[i]);
setMemoryCacheDisabled(parameters.memoryCacheDisabled);
+
+#if ENABLE(SERVICE_CONTROLS)
+ setEnabledServices(parameters.hasImageServices, parameters.hasSelectionServices);
+#endif
}
#if ENABLE(NETWORK_PROCESS)
@@ -1173,4 +1181,12 @@
memoryCache()->setDisabled(disabled);
}
+#if ENABLE(SERVICE_CONTROLS)
+void WebProcess::setEnabledServices(bool hasImageServices, bool hasSelectionServices)
+{
+ m_hasImageServices = hasImageServices;
+ m_hasSelectionServices = hasSelectionServices;
+}
+#endif
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (168073 => 168074)
--- trunk/Source/WebKit2/WebProcess/WebProcess.h 2014-05-01 01:04:52 UTC (rev 168073)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h 2014-05-01 01:18:52 UTC (rev 168074)
@@ -183,6 +183,11 @@
RefPtr<API::Object> apiObjectByConvertingFromHandles(API::Object*);
+#if ENABLE(SERVICE_CONTROLS)
+ bool hasImageServices() const { return m_hasImageServices; }
+ bool hasSelectionServices() const { return m_hasSelectionServices; }
+#endif
+
private:
WebProcess();
@@ -242,6 +247,10 @@
void setMemoryCacheDisabled(bool);
+#if ENABLE(SERVICE_CONTROLS)
+ void setEnabledServices(bool hasImageServices, bool hasSelectionServices);
+#endif
+
void postInjectedBundleMessage(const IPC::DataReference& messageData);
void setInjectedBundleParameter(const String& key, const IPC::DataReference&);
@@ -325,6 +334,11 @@
RefPtr<PluginProcessConnectionManager> m_pluginProcessConnectionManager;
#endif
+#if ENABLE(SERVICE_CONTROLS)
+ bool m_hasImageServices;
+ bool m_hasSelectionServices;
+#endif
+
HashSet<uint64_t> m_pagesInWindows;
WebCore::Timer<WebProcess> m_nonVisibleProcessCleanupTimer;
};
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.messages.in (168073 => 168074)
--- trunk/Source/WebKit2/WebProcess/WebProcess.messages.in 2014-05-01 01:04:52 UTC (rev 168073)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.messages.in 2014-05-01 01:18:52 UTC (rev 168074)
@@ -88,4 +88,8 @@
#endif
SetMemoryCacheDisabled(bool disabled);
+
+#if ENABLE(SERVICE_CONTROLS)
+ SetEnabledServices(bool hasImageServices, bool hasSelectionServices)
+#endif
}