Diff
Modified: trunk/Source/WebKit2/ChangeLog (137805 => 137806)
--- trunk/Source/WebKit2/ChangeLog 2012-12-15 21:02:52 UTC (rev 137805)
+++ trunk/Source/WebKit2/ChangeLog 2012-12-15 21:08:46 UTC (rev 137806)
@@ -1,3 +1,18 @@
+2012-12-15 Andy Estes <[email protected]>
+
+ [WebKit2] Move CustomProtocolManager to Shared/
+ https://bugs.webkit.org/show_bug.cgi?id=105103
+
+ Reviewed by Sam Weinig.
+
+ CustomProtocolManager can be instantiated either in the NetworkProcess or the WebProcess, so it should live in Shared/.
+
+ * DerivedSources.make: Update the path where CustomProtocolManager.messages.in can be found.
+ * Shared/Network/CustomProtocols/CustomProtocolManager.h: Renamed from Source/WebKit2/WebProcess/Network/CustomProtocols/CustomProtocolManager.h.
+ * Shared/Network/CustomProtocols/CustomProtocolManager.messages.in: Renamed from Source/WebKit2/WebProcess/Network/CustomProtocols/CustomProtocolManager.messages.in.
+ * Shared/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm: Renamed from Source/WebKit2/WebProcess/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm.
+ * WebKit2.xcodeproj/project.pbxproj:
+
2012-12-15 Sam Weinig <[email protected]>
Try to fix the Qt build.
Modified: trunk/Source/WebKit2/DerivedSources.make (137805 => 137806)
--- trunk/Source/WebKit2/DerivedSources.make 2012-12-15 21:02:52 UTC (rev 137805)
+++ trunk/Source/WebKit2/DerivedSources.make 2012-12-15 21:08:46 UTC (rev 137806)
@@ -27,6 +27,7 @@
$(WebKit2)/PluginProcess/mac \
$(WebKit2)/Shared/Plugins \
$(WebKit2)/Shared \
+ $(WebKit2)/Shared/Network/CustomProtocols \
$(WebKit2)/SharedWorkerProcess \
$(WebKit2)/WebProcess/ApplicationCache \
$(WebKit2)/WebProcess/Authentication \
@@ -37,7 +38,6 @@
$(WebKit2)/WebProcess/KeyValueStorage \
$(WebKit2)/WebProcess/MediaCache \
$(WebKit2)/WebProcess/Network \
- $(WebKit2)/WebProcess/Network/CustomProtocols \
$(WebKit2)/WebProcess/Notifications \
$(WebKit2)/WebProcess/Plugins \
$(WebKit2)/WebProcess/ResourceCache \
Copied: trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h (from rev 137805, trunk/Source/WebKit2/WebProcess/Network/CustomProtocols/CustomProtocolManager.h) (0 => 137806)
--- trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h (rev 0)
+++ trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.h 2012-12-15 21:08:46 UTC (rev 137806)
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 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 CustomProtocolManager_h
+#define CustomProtocolManager_h
+
+#if ENABLE(CUSTOM_PROTOCOLS)
+
+#include "MessageID.h"
+#include <wtf/HashSet.h>
+#include <wtf/text/WTFString.h>
+
+#if PLATFORM(MAC)
+#include <wtf/HashMap.h>
+#include <wtf/RetainPtr.h>
+OBJC_CLASS WKCustomProtocol;
+#endif
+
+
+namespace CoreIPC {
+class Connection;
+class DataReference;
+class MessageDecoder;
+} // namespace CoreIPC
+
+namespace WebCore {
+class ResourceError;
+class ResourceResponse;
+} // namespace WebCore
+
+namespace WebKit {
+
+class CustomProtocolManager {
+ WTF_MAKE_NONCOPYABLE(CustomProtocolManager);
+
+public:
+ static CustomProtocolManager& shared();
+
+ void registerScheme(const String&);
+ void unregisterScheme(const String&);
+ bool supportsScheme(const String&);
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
+ void didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&);
+ void didLoadData(uint64_t customProtocolID, const CoreIPC::DataReference&);
+ void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&, uint32_t cacheStoragePolicy);
+ void didFinishLoading(uint64_t customProtocolID);
+
+#if PLATFORM(MAC)
+ static void registerCustomProtocolClass();
+ void addCustomProtocol(WKCustomProtocol *);
+ void removeCustomProtocol(WKCustomProtocol *);
+#endif
+
+private:
+ CustomProtocolManager() { }
+ void didReceiveCustomProtocolManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
+
+ HashSet<String> m_registeredSchemes;
+
+#if PLATFORM(MAC)
+ typedef HashMap<uint64_t, RetainPtr<WKCustomProtocol> > CustomProtocolMap;
+ CustomProtocolMap m_customProtocolMap;
+ WKCustomProtocol *protocolForID(uint64_t customProtocolID);
+#endif
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(CUSTOM_PROTOCOLS)
+
+#endif // CustomProtocolManager_h
Copied: trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.messages.in (from rev 137805, trunk/Source/WebKit2/WebProcess/Network/CustomProtocols/CustomProtocolManager.messages.in) (0 => 137806)
--- trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.messages.in (rev 0)
+++ trunk/Source/WebKit2/Shared/Network/CustomProtocols/CustomProtocolManager.messages.in 2012-12-15 21:08:46 UTC (rev 137806)
@@ -0,0 +1,32 @@
+# Copyright (C) 2012 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.
+
+#if ENABLE(CUSTOM_PROTOCOLS)
+
+messages -> CustomProtocolManager {
+ DidFailWithError(uint64_t customProtocolID, WebCore::ResourceError error)
+ DidLoadData(uint64_t customProtocolID, CoreIPC::DataReference data)
+ DidReceiveResponse(uint64_t customProtocolID, WebCore::ResourceResponse response, uint32_t cacheStoragePolicy)
+ DidFinishLoading(uint64_t customProtocolID)
+}
+
+#endif // ENABLE(CUSTOM_PROTOCOLS)
Copied: trunk/Source/WebKit2/Shared/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm (from rev 137805, trunk/Source/WebKit2/WebProcess/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm) (0 => 137806)
--- trunk/Source/WebKit2/Shared/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm (rev 0)
+++ trunk/Source/WebKit2/Shared/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm 2012-12-15 21:08:46 UTC (rev 137806)
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2012 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 "CustomProtocolManager.h"
+
+#if ENABLE(CUSTOM_PROTOCOLS)
+
+#import "CustomProtocolManagerProxyMessages.h"
+#import "DataReference.h"
+#import "WebCoreArgumentCoders.h"
+#import "WebProcess.h"
+#import <WebCore/KURL.h>
+
+using namespace WebKit;
+
+static uint64_t generateCustomProtocolID()
+{
+ static uint64_t uniqueCustomProtocolID = 0;
+ return ++uniqueCustomProtocolID;
+}
+
+@interface WKCustomProtocol : NSURLProtocol {
+@private
+ uint64_t _customProtocolID;
+}
+@property (nonatomic, readonly) uint64_t customProtocolID;
+@end
+
+@implementation WKCustomProtocol
+
+@synthesize customProtocolID = _customProtocolID;
+
++ (BOOL)canInitWithRequest:(NSURLRequest *)request
+{
+ return WebKit::CustomProtocolManager::shared().supportsScheme([[[request URL] scheme] lowercaseString]);
+}
+
++ (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request
+{
+ return request;
+}
+
++ (BOOL)requestIsCacheEquivalent:(NSURLRequest *)a toRequest:(NSURLRequest *)b
+{
+ return NO;
+}
+
+- (id)initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLResponse *)cachedResponse client:(id<NSURLProtocolClient>)client
+{
+ self = [super initWithRequest:request cachedResponse:cachedResponse client:client];
+ if (!self)
+ return nil;
+
+ _customProtocolID = generateCustomProtocolID();
+ WebKit::CustomProtocolManager::shared().addCustomProtocol(self);
+ return self;
+}
+
+- (void)startLoading
+{
+ WebProcess::shared().connection()->send(Messages::CustomProtocolManagerProxy::StartLoading(self.customProtocolID, [self request]), 0);
+}
+
+- (void)stopLoading
+{
+ WebProcess::shared().connection()->send(Messages::CustomProtocolManagerProxy::StopLoading(self.customProtocolID), 0);
+ WebKit::CustomProtocolManager::shared().removeCustomProtocol(self);
+}
+
+@end
+
+namespace WebKit {
+
+CustomProtocolManager& CustomProtocolManager::shared()
+{
+ DEFINE_STATIC_LOCAL(CustomProtocolManager, customProtocolManager, ());
+ return customProtocolManager;
+}
+
+void CustomProtocolManager::registerCustomProtocolClass()
+{
+ [NSURLProtocol registerClass:[WKCustomProtocol class]];
+}
+
+void CustomProtocolManager::addCustomProtocol(WKCustomProtocol *customProtocol)
+{
+ ASSERT(customProtocol);
+ m_customProtocolMap.add(customProtocol.customProtocolID, customProtocol);
+}
+
+void CustomProtocolManager::removeCustomProtocol(WKCustomProtocol *customProtocol)
+{
+ ASSERT(customProtocol);
+ m_customProtocolMap.remove(customProtocol.customProtocolID);
+}
+
+void CustomProtocolManager::registerScheme(const String& scheme)
+{
+ m_registeredSchemes.add(scheme);
+}
+
+void CustomProtocolManager::unregisterScheme(const String& scheme)
+{
+ m_registeredSchemes.remove(scheme);
+}
+
+bool CustomProtocolManager::supportsScheme(const String& scheme)
+{
+ return m_registeredSchemes.contains(scheme);
+}
+
+void CustomProtocolManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder)
+{
+ didReceiveCustomProtocolManagerMessage(connection, messageID, decoder);
+}
+
+void CustomProtocolManager::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError& error)
+{
+ WKCustomProtocol *protocol = protocolForID(customProtocolID);
+ if (!protocol)
+ return;
+
+ [[protocol client] URLProtocol:protocol didFailWithError:error.nsError()];
+ removeCustomProtocol(protocol);
+}
+
+void CustomProtocolManager::didLoadData(uint64_t customProtocolID, const CoreIPC::DataReference& data)
+{
+ WKCustomProtocol *protocol = protocolForID(customProtocolID);
+ if (!protocol)
+ return;
+
+ [[protocol client] URLProtocol:protocol didLoadData:[NSData dataWithBytes:(void*)data.data() length:data.size()]];
+}
+
+void CustomProtocolManager::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse& response, uint32_t cacheStoragePolicy)
+{
+ WKCustomProtocol *protocol = protocolForID(customProtocolID);
+ if (!protocol)
+ return;
+
+ [[protocol client] URLProtocol:protocol didReceiveResponse:response.nsURLResponse() cacheStoragePolicy:static_cast<NSURLCacheStoragePolicy>(cacheStoragePolicy)];
+}
+
+void CustomProtocolManager::didFinishLoading(uint64_t customProtocolID)
+{
+ WKCustomProtocol *protocol = protocolForID(customProtocolID);
+ if (!protocol)
+ return;
+
+ [[protocol client] URLProtocolDidFinishLoading:protocol];
+ removeCustomProtocol(protocol);
+}
+
+WKCustomProtocol *CustomProtocolManager::protocolForID(uint64_t customProtocolID)
+{
+ CustomProtocolMap::const_iterator it = m_customProtocolMap.find(customProtocolID);
+ if (it == m_customProtocolMap.end())
+ return nil;
+
+ ASSERT(it->value);
+ return it->value.get();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(CUSTOM_PROTOCOLS)
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (137805 => 137806)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2012-12-15 21:02:52 UTC (rev 137805)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2012-12-15 21:08:46 UTC (rev 137806)
@@ -284,10 +284,10 @@
296BD85E15019BC30071F424 /* StringUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 296BD85C15019BC30071F424 /* StringUtilities.mm */; };
2984F57C164B915F004BC0C6 /* CustomProtocolManagerProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2984F57A164B915F004BC0C6 /* CustomProtocolManagerProxyMessageReceiver.cpp */; };
2984F57D164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 2984F57B164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h */; };
- 2984F581164B9BBD004BC0C6 /* CustomProtocolManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2984F580164B9BBD004BC0C6 /* CustomProtocolManager.h */; };
- 2984F583164B9BD9004BC0C6 /* CustomProtocolManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2984F582164B9BD9004BC0C6 /* CustomProtocolManagerMac.mm */; };
2984F588164BA095004BC0C6 /* CustomProtocolManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2984F586164BA095004BC0C6 /* CustomProtocolManagerMessageReceiver.cpp */; };
2984F589164BA095004BC0C6 /* CustomProtocolManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 2984F587164BA095004BC0C6 /* CustomProtocolManagerMessages.h */; };
+ 2989A411167D1834004F96D2 /* CustomProtocolManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2989A410167D1834004F96D2 /* CustomProtocolManagerMac.mm */; };
+ 2989A414167D184B004F96D2 /* CustomProtocolManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2989A412167D184B004F96D2 /* CustomProtocolManager.h */; };
29AD3093164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 29AD3092164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h */; };
29AD3096164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29AD3095164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm */; };
29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObject.h */; };
@@ -1505,11 +1505,11 @@
296BD85C15019BC30071F424 /* StringUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringUtilities.mm; sourceTree = "<group>"; };
2984F57A164B915F004BC0C6 /* CustomProtocolManagerProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomProtocolManagerProxyMessageReceiver.cpp; sourceTree = "<group>"; };
2984F57B164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomProtocolManagerProxyMessages.h; sourceTree = "<group>"; };
- 2984F580164B9BBD004BC0C6 /* CustomProtocolManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomProtocolManager.h; path = Network/CustomProtocols/CustomProtocolManager.h; sourceTree = "<group>"; };
- 2984F582164B9BD9004BC0C6 /* CustomProtocolManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CustomProtocolManagerMac.mm; path = Network/CustomProtocols/mac/CustomProtocolManagerMac.mm; sourceTree = "<group>"; };
- 2984F584164B9ED9004BC0C6 /* CustomProtocolManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CustomProtocolManager.messages.in; path = Network/CustomProtocols/CustomProtocolManager.messages.in; sourceTree = "<group>"; };
2984F586164BA095004BC0C6 /* CustomProtocolManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomProtocolManagerMessageReceiver.cpp; sourceTree = "<group>"; };
2984F587164BA095004BC0C6 /* CustomProtocolManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomProtocolManagerMessages.h; sourceTree = "<group>"; };
+ 2989A410167D1834004F96D2 /* CustomProtocolManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CustomProtocolManagerMac.mm; path = Network/CustomProtocols/mac/CustomProtocolManagerMac.mm; sourceTree = "<group>"; };
+ 2989A412167D184B004F96D2 /* CustomProtocolManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomProtocolManager.h; path = Network/CustomProtocols/CustomProtocolManager.h; sourceTree = "<group>"; };
+ 2989A413167D184B004F96D2 /* CustomProtocolManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CustomProtocolManager.messages.in; path = Network/CustomProtocols/CustomProtocolManager.messages.in; sourceTree = "<group>"; };
29AD3092164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomProtocolManagerProxy.h; path = CustomProtocols/CustomProtocolManagerProxy.h; sourceTree = "<group>"; };
29AD3095164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CustomProtocolManagerProxyMac.mm; path = CustomProtocols/mac/CustomProtocolManagerProxyMac.mm; sourceTree = "<group>"; };
29AD3097164B4E210072DEA9 /* CustomProtocolManagerProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CustomProtocolManagerProxy.messages.in; path = CustomProtocols/CustomProtocolManagerProxy.messages.in; sourceTree = "<group>"; };
@@ -3017,20 +3017,20 @@
path = mac;
sourceTree = "<group>";
};
- 2984F57E164B9B56004BC0C6 /* CustomProtocols */ = {
+ 2989A40E167D1813004F96D2 /* CustomProtocols */ = {
isa = PBXGroup;
children = (
- 2984F57F164B9B5D004BC0C6 /* mac */,
- 2984F580164B9BBD004BC0C6 /* CustomProtocolManager.h */,
- 2984F584164B9ED9004BC0C6 /* CustomProtocolManager.messages.in */,
+ 2989A40F167D181B004F96D2 /* mac */,
+ 2989A412167D184B004F96D2 /* CustomProtocolManager.h */,
+ 2989A413167D184B004F96D2 /* CustomProtocolManager.messages.in */,
);
name = CustomProtocols;
sourceTree = "<group>";
};
- 2984F57F164B9B5D004BC0C6 /* mac */ = {
+ 2989A40F167D181B004F96D2 /* mac */ = {
isa = PBXGroup;
children = (
- 2984F582164B9BD9004BC0C6 /* CustomProtocolManagerMac.mm */,
+ 2989A410167D1834004F96D2 /* CustomProtocolManagerMac.mm */,
);
name = mac;
sourceTree = "<group>";
@@ -3137,7 +3137,6 @@
5105B0D2162F7A5E00E27709 /* Network */ = {
isa = PBXGroup;
children = (
- 2984F57E164B9B56004BC0C6 /* CustomProtocols */,
5105B0D4162F7A7A00E27709 /* NetworkProcessConnection.cpp */,
5105B0D5162F7A7A00E27709 /* NetworkProcessConnection.h */,
51FB0902163A3B1C00EC324A /* NetworkProcessConnection.messages.in */,
@@ -3264,6 +3263,7 @@
51A8A60D1627F2AC000D90E9 /* Network */ = {
isa = PBXGroup;
children = (
+ 2989A40E167D1813004F96D2 /* CustomProtocols */,
51A8A6121627F325000D90E9 /* NetworkProcessCreationParameters.cpp */,
51A8A60F1627F2BD000D90E9 /* NetworkProcessCreationParameters.h */,
51CBBA0D165219B6005BE8FD /* NetworkResourceLoadParameters.cpp */,
@@ -5016,7 +5016,6 @@
510AFFBA16542048001BA05E /* WebResourceLoader.h in Headers */,
29AD3093164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h in Headers */,
2984F57D164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h in Headers */,
- 2984F581164B9BBD004BC0C6 /* CustomProtocolManager.h in Headers */,
2984F589164BA095004BC0C6 /* CustomProtocolManagerMessages.h in Headers */,
51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */,
5175944B1657080400DD771D /* NetworkResourceLoaderMessages.h in Headers */,
@@ -5026,6 +5025,7 @@
31A67E0D165B2A99006CBA66 /* PlugInAutoStartProvider.h in Headers */,
31D5929F166E060000E6BF02 /* WebPlugInClient.h in Headers */,
1AD25E96167AB08100EA9BCD /* DownloadProxyMap.h in Headers */,
+ 2989A414167D184B004F96D2 /* CustomProtocolManager.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -5973,7 +5973,6 @@
510AFFB916542048001BA05E /* WebResourceLoader.cpp in Sources */,
29AD3096164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm in Sources */,
2984F57C164B915F004BC0C6 /* CustomProtocolManagerProxyMessageReceiver.cpp in Sources */,
- 2984F583164B9BD9004BC0C6 /* CustomProtocolManagerMac.mm in Sources */,
2984F588164BA095004BC0C6 /* CustomProtocolManagerMessageReceiver.cpp in Sources */,
51F060E11654318500F3281B /* WebResourceLoaderMessageReceiver.cpp in Sources */,
5175944A1657080400DD771D /* NetworkResourceLoaderMessageReceiver.cpp in Sources */,
@@ -5984,6 +5983,7 @@
31D5929E166E060000E6BF02 /* WebPlugInClient.cpp in Sources */,
1AD25E95167AB08100EA9BCD /* DownloadProxyMap.cpp in Sources */,
BCF18638167D071E00A1A85A /* CacheModel.cpp in Sources */,
+ 2989A411167D1834004F96D2 /* CustomProtocolManagerMac.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Deleted: trunk/Source/WebKit2/WebProcess/Network/CustomProtocols/CustomProtocolManager.h (137805 => 137806)
--- trunk/Source/WebKit2/WebProcess/Network/CustomProtocols/CustomProtocolManager.h 2012-12-15 21:02:52 UTC (rev 137805)
+++ trunk/Source/WebKit2/WebProcess/Network/CustomProtocols/CustomProtocolManager.h 2012-12-15 21:08:46 UTC (rev 137806)
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2012 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 CustomProtocolManager_h
-#define CustomProtocolManager_h
-
-#if ENABLE(CUSTOM_PROTOCOLS)
-
-#include "MessageID.h"
-#include <wtf/HashSet.h>
-#include <wtf/text/WTFString.h>
-
-#if PLATFORM(MAC)
-#include <wtf/HashMap.h>
-#include <wtf/RetainPtr.h>
-OBJC_CLASS WKCustomProtocol;
-#endif
-
-
-namespace CoreIPC {
-class Connection;
-class DataReference;
-class MessageDecoder;
-} // namespace CoreIPC
-
-namespace WebCore {
-class ResourceError;
-class ResourceResponse;
-} // namespace WebCore
-
-namespace WebKit {
-
-class CustomProtocolManager {
- WTF_MAKE_NONCOPYABLE(CustomProtocolManager);
-
-public:
- static CustomProtocolManager& shared();
-
- void registerScheme(const String&);
- void unregisterScheme(const String&);
- bool supportsScheme(const String&);
-
- void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
- void didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError&);
- void didLoadData(uint64_t customProtocolID, const CoreIPC::DataReference&);
- void didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse&, uint32_t cacheStoragePolicy);
- void didFinishLoading(uint64_t customProtocolID);
-
-#if PLATFORM(MAC)
- static void registerCustomProtocolClass();
- void addCustomProtocol(WKCustomProtocol *);
- void removeCustomProtocol(WKCustomProtocol *);
-#endif
-
-private:
- CustomProtocolManager() { }
- void didReceiveCustomProtocolManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
-
- HashSet<String> m_registeredSchemes;
-
-#if PLATFORM(MAC)
- typedef HashMap<uint64_t, RetainPtr<WKCustomProtocol> > CustomProtocolMap;
- CustomProtocolMap m_customProtocolMap;
- WKCustomProtocol *protocolForID(uint64_t customProtocolID);
-#endif
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(CUSTOM_PROTOCOLS)
-
-#endif // CustomProtocolManager_h
Deleted: trunk/Source/WebKit2/WebProcess/Network/CustomProtocols/CustomProtocolManager.messages.in (137805 => 137806)
--- trunk/Source/WebKit2/WebProcess/Network/CustomProtocols/CustomProtocolManager.messages.in 2012-12-15 21:02:52 UTC (rev 137805)
+++ trunk/Source/WebKit2/WebProcess/Network/CustomProtocols/CustomProtocolManager.messages.in 2012-12-15 21:08:46 UTC (rev 137806)
@@ -1,32 +0,0 @@
-# Copyright (C) 2012 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.
-
-#if ENABLE(CUSTOM_PROTOCOLS)
-
-messages -> CustomProtocolManager {
- DidFailWithError(uint64_t customProtocolID, WebCore::ResourceError error)
- DidLoadData(uint64_t customProtocolID, CoreIPC::DataReference data)
- DidReceiveResponse(uint64_t customProtocolID, WebCore::ResourceResponse response, uint32_t cacheStoragePolicy)
- DidFinishLoading(uint64_t customProtocolID)
-}
-
-#endif // ENABLE(CUSTOM_PROTOCOLS)
Deleted: trunk/Source/WebKit2/WebProcess/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm (137805 => 137806)
--- trunk/Source/WebKit2/WebProcess/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm 2012-12-15 21:02:52 UTC (rev 137805)
+++ trunk/Source/WebKit2/WebProcess/Network/CustomProtocols/mac/CustomProtocolManagerMac.mm 2012-12-15 21:08:46 UTC (rev 137806)
@@ -1,190 +0,0 @@
-/*
- * Copyright (C) 2012 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 "CustomProtocolManager.h"
-
-#if ENABLE(CUSTOM_PROTOCOLS)
-
-#import "CustomProtocolManagerProxyMessages.h"
-#import "DataReference.h"
-#import "WebCoreArgumentCoders.h"
-#import "WebProcess.h"
-#import <WebCore/KURL.h>
-
-using namespace WebKit;
-
-static uint64_t generateCustomProtocolID()
-{
- static uint64_t uniqueCustomProtocolID = 0;
- return ++uniqueCustomProtocolID;
-}
-
-@interface WKCustomProtocol : NSURLProtocol {
-@private
- uint64_t _customProtocolID;
-}
-@property (nonatomic, readonly) uint64_t customProtocolID;
-@end
-
-@implementation WKCustomProtocol
-
-@synthesize customProtocolID = _customProtocolID;
-
-+ (BOOL)canInitWithRequest:(NSURLRequest *)request
-{
- return WebKit::CustomProtocolManager::shared().supportsScheme([[[request URL] scheme] lowercaseString]);
-}
-
-+ (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request
-{
- return request;
-}
-
-+ (BOOL)requestIsCacheEquivalent:(NSURLRequest *)a toRequest:(NSURLRequest *)b
-{
- return NO;
-}
-
-- (id)initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLResponse *)cachedResponse client:(id<NSURLProtocolClient>)client
-{
- self = [super initWithRequest:request cachedResponse:cachedResponse client:client];
- if (!self)
- return nil;
-
- _customProtocolID = generateCustomProtocolID();
- WebKit::CustomProtocolManager::shared().addCustomProtocol(self);
- return self;
-}
-
-- (void)startLoading
-{
- WebProcess::shared().connection()->send(Messages::CustomProtocolManagerProxy::StartLoading(self.customProtocolID, [self request]), 0);
-}
-
-- (void)stopLoading
-{
- WebProcess::shared().connection()->send(Messages::CustomProtocolManagerProxy::StopLoading(self.customProtocolID), 0);
- WebKit::CustomProtocolManager::shared().removeCustomProtocol(self);
-}
-
-@end
-
-namespace WebKit {
-
-CustomProtocolManager& CustomProtocolManager::shared()
-{
- DEFINE_STATIC_LOCAL(CustomProtocolManager, customProtocolManager, ());
- return customProtocolManager;
-}
-
-void CustomProtocolManager::registerCustomProtocolClass()
-{
- [NSURLProtocol registerClass:[WKCustomProtocol class]];
-}
-
-void CustomProtocolManager::addCustomProtocol(WKCustomProtocol *customProtocol)
-{
- ASSERT(customProtocol);
- m_customProtocolMap.add(customProtocol.customProtocolID, customProtocol);
-}
-
-void CustomProtocolManager::removeCustomProtocol(WKCustomProtocol *customProtocol)
-{
- ASSERT(customProtocol);
- m_customProtocolMap.remove(customProtocol.customProtocolID);
-}
-
-void CustomProtocolManager::registerScheme(const String& scheme)
-{
- m_registeredSchemes.add(scheme);
-}
-
-void CustomProtocolManager::unregisterScheme(const String& scheme)
-{
- m_registeredSchemes.remove(scheme);
-}
-
-bool CustomProtocolManager::supportsScheme(const String& scheme)
-{
- return m_registeredSchemes.contains(scheme);
-}
-
-void CustomProtocolManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder)
-{
- didReceiveCustomProtocolManagerMessage(connection, messageID, decoder);
-}
-
-void CustomProtocolManager::didFailWithError(uint64_t customProtocolID, const WebCore::ResourceError& error)
-{
- WKCustomProtocol *protocol = protocolForID(customProtocolID);
- if (!protocol)
- return;
-
- [[protocol client] URLProtocol:protocol didFailWithError:error.nsError()];
- removeCustomProtocol(protocol);
-}
-
-void CustomProtocolManager::didLoadData(uint64_t customProtocolID, const CoreIPC::DataReference& data)
-{
- WKCustomProtocol *protocol = protocolForID(customProtocolID);
- if (!protocol)
- return;
-
- [[protocol client] URLProtocol:protocol didLoadData:[NSData dataWithBytes:(void*)data.data() length:data.size()]];
-}
-
-void CustomProtocolManager::didReceiveResponse(uint64_t customProtocolID, const WebCore::ResourceResponse& response, uint32_t cacheStoragePolicy)
-{
- WKCustomProtocol *protocol = protocolForID(customProtocolID);
- if (!protocol)
- return;
-
- [[protocol client] URLProtocol:protocol didReceiveResponse:response.nsURLResponse() cacheStoragePolicy:static_cast<NSURLCacheStoragePolicy>(cacheStoragePolicy)];
-}
-
-void CustomProtocolManager::didFinishLoading(uint64_t customProtocolID)
-{
- WKCustomProtocol *protocol = protocolForID(customProtocolID);
- if (!protocol)
- return;
-
- [[protocol client] URLProtocolDidFinishLoading:protocol];
- removeCustomProtocol(protocol);
-}
-
-WKCustomProtocol *CustomProtocolManager::protocolForID(uint64_t customProtocolID)
-{
- CustomProtocolMap::const_iterator it = m_customProtocolMap.find(customProtocolID);
- if (it == m_customProtocolMap.end())
- return nil;
-
- ASSERT(it->value);
- return it->value.get();
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(CUSTOM_PROTOCOLS)