summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/Shared/win
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-13 16:23:25 +0100
committerBen Murdoch <benm@google.com>2011-05-16 11:35:02 +0100
commit65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch)
treef478babb801e720de7bfaee23443ffe029f58731 /Source/WebKit2/Shared/win
parent47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff)
downloadexternal_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip
external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz
external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'Source/WebKit2/Shared/win')
-rw-r--r--Source/WebKit2/Shared/win/CommandLineWin.cpp63
-rw-r--r--Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp42
-rw-r--r--Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp150
-rw-r--r--Source/WebKit2/Shared/win/PlatformCertificateInfo.h64
-rw-r--r--Source/WebKit2/Shared/win/UpdateChunk.cpp76
-rw-r--r--Source/WebKit2/Shared/win/UpdateChunk.h58
-rw-r--r--Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp103
-rw-r--r--Source/WebKit2/Shared/win/WebEventFactory.cpp463
-rw-r--r--Source/WebKit2/Shared/win/WebEventFactory.h45
-rw-r--r--Source/WebKit2/Shared/win/WebURLRequestWin.cpp40
-rw-r--r--Source/WebKit2/Shared/win/WebURLResponseWin.cpp40
11 files changed, 1144 insertions, 0 deletions
diff --git a/Source/WebKit2/Shared/win/CommandLineWin.cpp b/Source/WebKit2/Shared/win/CommandLineWin.cpp
new file mode 100644
index 0000000..7d6c9e3
--- /dev/null
+++ b/Source/WebKit2/Shared/win/CommandLineWin.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#include "CommandLine.h"
+
+namespace WebKit {
+
+bool CommandLine::parse(LPTSTR commandLineString)
+{
+ m_args.clear();
+
+ // Check if this is an empty command line.
+ if (!commandLineString || !commandLineString[0])
+ return true;
+
+ int argumentCount;
+ LPWSTR* commandLineArgs = ::CommandLineToArgvW(commandLineString, &argumentCount);
+ if (!commandLineArgs)
+ return false;
+
+ if (argumentCount % 2) {
+ ::LocalFree(commandLineArgs);
+ return false;
+ }
+
+ for (int i = 0; i < argumentCount ; i += 2) {
+ LPWSTR key = commandLineArgs[i];
+
+ if (key[0] != '-') {
+ ::LocalFree(commandLineArgs);
+ return false;
+ }
+
+ m_args.set(&key[1], commandLineArgs[i + 1]);
+ }
+
+ ::LocalFree(commandLineArgs);
+ return true;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp b/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp
new file mode 100644
index 0000000..d947b87
--- /dev/null
+++ b/Source/WebKit2/Shared/win/NativeWebKeyboardEventWin.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#include "NativeWebKeyboardEvent.h"
+
+#include "WebEventFactory.h"
+
+namespace WebKit {
+
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+ : WebKeyboardEvent(WebEventFactory::createWebKeyboardEvent(hwnd, message, wParam, lParam))
+ , m_nativeEvent()
+{
+ m_nativeEvent.hwnd = hwnd;
+ m_nativeEvent.message = message;
+ m_nativeEvent.wParam = wParam;
+ m_nativeEvent.lParam = lParam;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp b/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp
new file mode 100644
index 0000000..b88a7ef
--- /dev/null
+++ b/Source/WebKit2/Shared/win/PlatformCertificateInfo.cpp
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#include "PlatformCertificateInfo.h"
+
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+#include <WebCore/ResourceResponse.h>
+
+#if PLATFORM(CG)
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#endif
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PlatformCertificateInfo::PlatformCertificateInfo()
+{
+}
+
+PlatformCertificateInfo::PlatformCertificateInfo(const ResourceResponse& response)
+{
+ CFURLResponseRef cfResponse = response.cfURLResponse();
+ if (!cfResponse)
+ return;
+
+#if PLATFORM(CG)
+ CFDictionaryRef certificateInfo = wkGetSSLCertificateInfo(cfResponse);
+ if (!certificateInfo)
+ return;
+
+ void* data = wkGetSSLCertificateChainContext(certificateInfo);
+ if (!data)
+ return;
+
+ PCCERT_CHAIN_CONTEXT chainContext = static_cast<PCCERT_CHAIN_CONTEXT>(data);
+ if (chainContext->cChain < 1)
+ return;
+
+ // The first simple chain starts with the leaf certificate and ends with a trusted root or self-signed certificate.
+ PCERT_SIMPLE_CHAIN firstSimpleChain = chainContext->rgpChain[0];
+ for (unsigned i = 0; i < firstSimpleChain->cElement; ++i) {
+ PCCERT_CONTEXT certificateContext = firstSimpleChain->rgpElement[i]->pCertContext;
+ ::CertDuplicateCertificateContext(certificateContext);
+ m_certificateChain.append(certificateContext);
+ }
+#else
+ // FIXME: WinCairo implementation
+#endif
+}
+
+PlatformCertificateInfo::~PlatformCertificateInfo()
+{
+ clearCertificateChain();
+}
+
+PlatformCertificateInfo::PlatformCertificateInfo(const PlatformCertificateInfo& other)
+{
+ for (size_t i = 0; i < other.m_certificateChain.size(); ++i) {
+ ::CertDuplicateCertificateContext(other.m_certificateChain[i]);
+ m_certificateChain.append(other.m_certificateChain[i]);
+ }
+}
+
+PlatformCertificateInfo& PlatformCertificateInfo::operator=(const PlatformCertificateInfo& other)
+{
+ clearCertificateChain();
+ for (size_t i = 0; i < other.m_certificateChain.size(); ++i) {
+ ::CertDuplicateCertificateContext(other.m_certificateChain[i]);
+ m_certificateChain.append(other.m_certificateChain[i]);
+ }
+ return *this;
+}
+
+void PlatformCertificateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+ // Special case no certificates
+ if (m_certificateChain.isEmpty()) {
+ encoder->encodeUInt64(std::numeric_limits<uint64_t>::max());
+ return;
+ }
+
+ uint64_t length = m_certificateChain.size();
+ encoder->encodeUInt64(length);
+
+ for (size_t i = 0; i < length; ++i)
+ encoder->encodeBytes(static_cast<uint8_t*>(m_certificateChain[i]->pbCertEncoded), m_certificateChain[i]->cbCertEncoded);
+}
+
+bool PlatformCertificateInfo::decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& c)
+{
+ uint64_t length;
+ if (!decoder->decode(length))
+ return false;
+
+ if (length == std::numeric_limits<uint64_t>::max()) {
+ // This is the no certificates case.
+ return true;
+ }
+
+ for (size_t i = 0; i < length; ++i) {
+ Vector<uint8_t> bytes;
+ if (!decoder->decodeBytes(bytes)) {
+ c.clearCertificateChain();
+ return false;
+ }
+
+ PCCERT_CONTEXT certificateContext = ::CertCreateCertificateContext(PKCS_7_ASN_ENCODING | X509_ASN_ENCODING, bytes.data(), bytes.size());
+ if (!certificateContext) {
+ c.clearCertificateChain();
+ return false;
+ }
+
+ c.m_certificateChain.append(certificateContext);
+ }
+
+ return true;
+}
+
+void PlatformCertificateInfo::clearCertificateChain()
+{
+ for (size_t i = 0; i < m_certificateChain.size(); ++i)
+ ::CertFreeCertificateContext(m_certificateChain[i]);
+ m_certificateChain.clear();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/win/PlatformCertificateInfo.h b/Source/WebKit2/Shared/win/PlatformCertificateInfo.h
new file mode 100644
index 0000000..e483d37
--- /dev/null
+++ b/Source/WebKit2/Shared/win/PlatformCertificateInfo.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2010 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 PlatformCertificateInfo_h
+#define PlatformCertificateInfo_h
+
+#include <wtf/Vector.h>
+
+namespace CoreIPC {
+ class ArgumentDecoder;
+ class ArgumentEncoder;
+}
+
+namespace WebCore {
+ class ResourceResponse;
+}
+
+namespace WebKit {
+
+class PlatformCertificateInfo {
+public:
+ PlatformCertificateInfo();
+ explicit PlatformCertificateInfo(const WebCore::ResourceResponse&);
+ ~PlatformCertificateInfo();
+
+ PlatformCertificateInfo(const PlatformCertificateInfo&);
+ PlatformCertificateInfo& operator=(const PlatformCertificateInfo&);
+
+ const Vector<PCCERT_CONTEXT>& certificateChain() const { return m_certificateChain; }
+
+ void encode(CoreIPC::ArgumentEncoder* encoder) const;
+ static bool decode(CoreIPC::ArgumentDecoder* decoder, PlatformCertificateInfo& t);
+
+private:
+ void clearCertificateChain();
+
+ Vector<PCCERT_CONTEXT> m_certificateChain;
+};
+
+} // namespace WebKit
+
+#endif // PlatformCertificateInfo_h
diff --git a/Source/WebKit2/Shared/win/UpdateChunk.cpp b/Source/WebKit2/Shared/win/UpdateChunk.cpp
new file mode 100644
index 0000000..2aabead
--- /dev/null
+++ b/Source/WebKit2/Shared/win/UpdateChunk.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#include "UpdateChunk.h"
+
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+#include "WebCoreArgumentCoders.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+UpdateChunk::UpdateChunk()
+ : m_bitmapSharedMemory(0)
+{
+}
+
+UpdateChunk::UpdateChunk(const IntRect& rect)
+ : m_rect(rect)
+{
+ // Create our shared memory mapping.
+ unsigned memorySize = rect.height() * rect.width() * 4;
+ m_bitmapSharedMemory = ::CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, memorySize, 0);
+}
+
+UpdateChunk::UpdateChunk(const IntRect& rect, HANDLE bitmapSharedMemory)
+ : m_rect(rect)
+ , m_bitmapSharedMemory(bitmapSharedMemory)
+{
+}
+
+void UpdateChunk::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+ encoder->encode(m_rect);
+ encoder->encode(reinterpret_cast<uintptr_t>(m_bitmapSharedMemory));
+}
+
+bool UpdateChunk::decode(CoreIPC::ArgumentDecoder* decoder, UpdateChunk& updateChunk)
+{
+ IntRect rect;
+ if (!decoder->decode(rect))
+ return false;
+ updateChunk.m_rect = rect;
+
+ uintptr_t bitmapSharedMmemory;
+ if (!decoder->decode(bitmapSharedMmemory))
+ return false;
+
+ updateChunk.m_bitmapSharedMemory = reinterpret_cast<HANDLE>(bitmapSharedMmemory);
+ return true;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/win/UpdateChunk.h b/Source/WebKit2/Shared/win/UpdateChunk.h
new file mode 100644
index 0000000..2ddeb8b
--- /dev/null
+++ b/Source/WebKit2/Shared/win/UpdateChunk.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010 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 UpdateChunk_h
+#define UpdateChunk_h
+
+#include <WebCore/IntRect.h>
+
+namespace CoreIPC {
+ class ArgumentEncoder;
+ class ArgumentDecoder;
+}
+
+namespace WebKit {
+
+class UpdateChunk {
+public:
+ UpdateChunk();
+ UpdateChunk(const WebCore::IntRect&);
+ UpdateChunk(const WebCore::IntRect&, HANDLE);
+
+ const WebCore::IntRect& rect() const { return m_rect; }
+ HANDLE memory() const { return m_bitmapSharedMemory; }
+ bool isEmpty() const { return m_rect.isEmpty(); }
+
+ void encode(CoreIPC::ArgumentEncoder*) const;
+ static bool decode(CoreIPC::ArgumentDecoder*, UpdateChunk&);
+
+private:
+ WebCore::IntRect m_rect;
+ HANDLE m_bitmapSharedMemory;
+};
+
+} // namespace WebKit
+
+#endif // UpdateChunk_h
diff --git a/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp
new file mode 100644
index 0000000..95d7de2
--- /dev/null
+++ b/Source/WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#include "WebCoreArgumentCoders.h"
+
+#if USE(CFNETWORK)
+#include "ArgumentCodersCF.h"
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#endif
+
+namespace CoreIPC {
+
+// FIXME: These coders should really go in a WebCoreArgumentCodersCFNetwork file.
+
+void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest)
+{
+#if USE(CFNETWORK)
+ RetainPtr<CFDictionaryRef> dictionary(AdoptCF, wkCFURLRequestCreateSerializableRepresentation(resourceRequest.cfURLRequest(), CoreIPC::tokenNullTypeRef()));
+ encode(encoder, dictionary.get());
+#endif
+}
+
+bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest)
+{
+#if USE(CFNETWORK)
+ RetainPtr<CFDictionaryRef> dictionary;
+ if (!decode(decoder, dictionary))
+ return false;
+
+ CFURLRequestRef cfURLRequest = wkCFURLRequestCreateFromSerializableRepresentation(dictionary.get(), CoreIPC::tokenNullTypeRef());
+ if (!cfURLRequest)
+ return false;
+
+ resourceRequest = WebCore::ResourceRequest(cfURLRequest);
+ return true;
+#else
+ return false;
+#endif
+}
+
+void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceResponse& resourceResponse)
+{
+#if USE(CFNETWORK)
+ bool responseIsPresent = resourceResponse.cfURLResponse();
+ encoder->encode(responseIsPresent);
+
+ if (!responseIsPresent)
+ return;
+
+ RetainPtr<CFDictionaryRef> dictionary(AdoptCF, wkCFURLResponseCreateSerializableRepresentation(resourceResponse.cfURLResponse(), CoreIPC::tokenNullTypeRef()));
+ encode(encoder, dictionary.get());
+#endif
+}
+
+bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse)
+{
+#if USE(CFNETWORK)
+ bool responseIsPresent;
+ decoder->decode(responseIsPresent);
+
+ if (!responseIsPresent) {
+ resourceResponse = WebCore::ResourceResponse();
+ return true;
+ }
+
+ RetainPtr<CFDictionaryRef> dictionary;
+ if (!decode(decoder, dictionary))
+ return false;
+
+ CFURLResponseRef cfURLResponse = wkCFURLResponseCreateFromSerializableRepresentation(dictionary.get(), CoreIPC::tokenNullTypeRef());
+ if (!cfURLResponse)
+ return false;
+
+ resourceResponse = WebCore::ResourceResponse(cfURLResponse);
+ return true;
+#else
+ return false;
+#endif
+}
+
+} // namespace CoreIPC
diff --git a/Source/WebKit2/Shared/win/WebEventFactory.cpp b/Source/WebKit2/Shared/win/WebEventFactory.cpp
new file mode 100644
index 0000000..a4081fc
--- /dev/null
+++ b/Source/WebKit2/Shared/win/WebEventFactory.cpp
@@ -0,0 +1,463 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2009 Google 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.
+ */
+
+#include "WebEventFactory.h"
+
+#include <windowsx.h>
+#include <wtf/ASCIICType.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static const unsigned short HIGH_BIT_MASK_SHORT = 0x8000;
+static const unsigned short SPI_GETWHEELSCROLLCHARS = 0x006C;
+
+static const unsigned WM_VISTA_MOUSEHWHEEL = 0x20E;
+
+static inline LPARAM relativeCursorPosition(HWND hwnd)
+{
+ POINT point = { -1, -1 };
+ ::GetCursorPos(&point);
+ ::ScreenToClient(hwnd, &point);
+ return MAKELPARAM(point.x, point.y);
+}
+
+static inline POINT point(LPARAM lParam)
+{
+ POINT point = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
+ return point;
+}
+
+static int horizontalScrollChars()
+{
+ static ULONG scrollChars;
+ if (!scrollChars && !::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &scrollChars, 0))
+ scrollChars = 1;
+ return scrollChars;
+}
+
+static int verticalScrollLines()
+{
+ static ULONG scrollLines;
+ if (!scrollLines && !::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0))
+ scrollLines = 3;
+ return scrollLines;
+}
+
+static inline int clickCount(WebEvent::Type type, WebMouseEvent::Button button, const POINT& position, double timeStampSeconds)
+{
+ static int gLastClickCount;
+ static double gLastClickTime;
+ static POINT lastClickPosition;
+ static WebMouseEvent::Button lastClickButton = WebMouseEvent::LeftButton;
+
+ bool cancelPreviousClick = (abs(lastClickPosition.x - position.x) > (::GetSystemMetrics(SM_CXDOUBLECLK) / 2))
+ || (abs(lastClickPosition.y - position.y) > (::GetSystemMetrics(SM_CYDOUBLECLK) / 2))
+ || ((timeStampSeconds - gLastClickTime) * 1000.0 > ::GetDoubleClickTime());
+
+ if (type == WebEvent::MouseDown) {
+ if (!cancelPreviousClick && (button == lastClickButton))
+ ++gLastClickCount;
+ else {
+ gLastClickCount = 1;
+ lastClickPosition = position;
+ }
+ gLastClickTime = timeStampSeconds;
+ lastClickButton = button;
+ } else if (type == WebEvent::MouseMove) {
+ if (cancelPreviousClick) {
+ gLastClickCount = 0;
+ lastClickPosition.x = 0;
+ lastClickPosition.y = 0;
+ gLastClickTime = 0;
+ }
+ }
+
+ return gLastClickCount;
+}
+
+static inline WebEvent::Modifiers modifiersForEvent(WPARAM wparam)
+{
+ unsigned modifiers = 0;
+ if (wparam & MK_CONTROL)
+ modifiers |= WebEvent::ControlKey;
+ if (wparam & MK_SHIFT)
+ modifiers |= WebEvent::ShiftKey;
+ if (::GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT)
+ modifiers |= WebEvent::AltKey;
+ return static_cast<WebEvent::Modifiers>(modifiers);
+}
+
+static inline WebEvent::Modifiers modifiersForCurrentKeyState()
+{
+ unsigned modifiers = 0;
+ if (::GetKeyState(VK_CONTROL) & HIGH_BIT_MASK_SHORT)
+ modifiers |= WebEvent::ControlKey;
+ if (::GetKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT)
+ modifiers |= WebEvent::ShiftKey;
+ if (::GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT)
+ modifiers |= WebEvent::AltKey;
+ return static_cast<WebEvent::Modifiers>(modifiers);
+}
+
+static inline WebEvent::Type keyboardEventTypeForEvent(UINT message)
+{
+ switch (message) {
+ case WM_SYSKEYDOWN:
+ case WM_KEYDOWN:
+ return WebEvent::RawKeyDown;
+ break;
+ case WM_SYSKEYUP:
+ case WM_KEYUP:
+ return WebEvent::KeyUp;
+ break;
+ case WM_IME_CHAR:
+ case WM_SYSCHAR:
+ case WM_CHAR:
+ return WebEvent::Char;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ return WebEvent::Char;
+ }
+}
+
+static inline bool isSystemKeyEvent(UINT message)
+{
+ switch (message) {
+ case WM_SYSKEYDOWN:
+ case WM_SYSKEYUP:
+ case WM_SYSCHAR:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool isKeypadEvent(WPARAM wParam, LPARAM lParam, WebEvent::Type type)
+{
+ if (type != WebEvent::RawKeyDown && type != WebEvent::KeyUp)
+ return false;
+
+ switch (wParam) {
+ case VK_NUMLOCK:
+ case VK_NUMPAD0:
+ case VK_NUMPAD1:
+ case VK_NUMPAD2:
+ case VK_NUMPAD3:
+ case VK_NUMPAD4:
+ case VK_NUMPAD5:
+ case VK_NUMPAD6:
+ case VK_NUMPAD7:
+ case VK_NUMPAD8:
+ case VK_NUMPAD9:
+ case VK_MULTIPLY:
+ case VK_ADD:
+ case VK_SEPARATOR:
+ case VK_SUBTRACT:
+ case VK_DECIMAL:
+ case VK_DIVIDE:
+ return true;
+ case VK_RETURN:
+ return HIWORD(lParam) & KF_EXTENDED;
+ case VK_INSERT:
+ case VK_DELETE:
+ case VK_PRIOR:
+ case VK_NEXT:
+ case VK_END:
+ case VK_HOME:
+ case VK_LEFT:
+ case VK_UP:
+ case VK_RIGHT:
+ case VK_DOWN:
+ return !(HIWORD(lParam) & KF_EXTENDED);
+ default:
+ return false;
+ }
+}
+
+static String textFromEvent(WPARAM wparam, WebEvent::Type type)
+{
+ if (type != WebEvent::Char)
+ return String();
+
+ UChar c = static_cast<UChar>(wparam);
+ return String(&c, 1);
+}
+
+static String unmodifiedTextFromEvent(WPARAM wparam, WebEvent::Type type)
+{
+ if (type != WebEvent::Char)
+ return String();
+
+ UChar c = static_cast<UChar>(wparam);
+ return String(&c, 1);
+}
+
+static String keyIdentifierFromEvent(WPARAM wparam, WebEvent::Type type)
+{
+ if (type == WebEvent::Char)
+ return String();
+
+ unsigned short keyCode = static_cast<unsigned short>(wparam);
+ switch (keyCode) {
+ case VK_MENU:
+ return String("Alt");
+ case VK_CONTROL:
+ return String("Control");
+ case VK_SHIFT:
+ return String("Shift");
+ case VK_CAPITAL:
+ return String("CapsLock");
+ case VK_LWIN:
+ case VK_RWIN:
+ return String("Win");
+ case VK_CLEAR:
+ return String("Clear");
+ case VK_DOWN:
+ return String("Down");
+ case VK_END:
+ return String("End");
+ case VK_RETURN:
+ return String("Enter");
+ case VK_EXECUTE:
+ return String("Execute");
+ case VK_F1:
+ return String("F1");
+ case VK_F2:
+ return String("F2");
+ case VK_F3:
+ return String("F3");
+ case VK_F4:
+ return String("F4");
+ case VK_F5:
+ return String("F5");
+ case VK_F6:
+ return String("F6");
+ case VK_F7:
+ return String("F7");
+ case VK_F8:
+ return String("F8");
+ case VK_F9:
+ return String("F9");
+ case VK_F10:
+ return String("F11");
+ case VK_F12:
+ return String("F12");
+ case VK_F13:
+ return String("F13");
+ case VK_F14:
+ return String("F14");
+ case VK_F15:
+ return String("F15");
+ case VK_F16:
+ return String("F16");
+ case VK_F17:
+ return String("F17");
+ case VK_F18:
+ return String("F18");
+ case VK_F19:
+ return String("F19");
+ case VK_F20:
+ return String("F20");
+ case VK_F21:
+ return String("F21");
+ case VK_F22:
+ return String("F22");
+ case VK_F23:
+ return String("F23");
+ case VK_F24:
+ return String("F24");
+ case VK_HELP:
+ return String("Help");
+ case VK_HOME:
+ return String("Home");
+ case VK_INSERT:
+ return String("Insert");
+ case VK_LEFT:
+ return String("Left");
+ case VK_NEXT:
+ return String("PageDown");
+ case VK_PRIOR:
+ return String("PageUp");
+ case VK_PAUSE:
+ return String("Pause");
+ case VK_SNAPSHOT:
+ return String("PrintScreen");
+ case VK_RIGHT:
+ return String("Right");
+ case VK_SCROLL:
+ return String("Scroll");
+ case VK_SELECT:
+ return String("Select");
+ case VK_UP:
+ return String("Up");
+ case VK_DELETE:
+ return String("U+007F"); // Standard says that DEL becomes U+007F.
+ default:
+ return String::format("U+%04X", toASCIIUpper(keyCode));
+ }
+}
+
+WebMouseEvent WebEventFactory::createWebMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool didActivateWebView)
+{
+ WebEvent::Type type;
+ WebMouseEvent::Button button = WebMouseEvent::NoButton;
+ switch (message) {
+ case WM_MOUSEMOVE:
+ type = WebEvent::MouseMove;
+ if (wParam & MK_LBUTTON)
+ button = WebMouseEvent::LeftButton;
+ else if (wParam & MK_MBUTTON)
+ button = WebMouseEvent::MiddleButton;
+ else if (wParam & MK_RBUTTON)
+ button = WebMouseEvent::RightButton;
+ break;
+ case WM_MOUSELEAVE:
+ type = WebEvent::MouseMove;
+ if (wParam & MK_LBUTTON)
+ button = WebMouseEvent::LeftButton;
+ else if (wParam & MK_MBUTTON)
+ button = WebMouseEvent::MiddleButton;
+ else if (wParam & MK_RBUTTON)
+ button = WebMouseEvent::RightButton;
+
+ // Set the current mouse position (relative to the client area of the
+ // current window) since none is specified for this event.
+ lParam = relativeCursorPosition(hWnd);
+ break;
+ case WM_LBUTTONDOWN:
+ case WM_LBUTTONDBLCLK:
+ type = WebEvent::MouseDown;
+ button = WebMouseEvent::LeftButton;
+ break;
+ case WM_MBUTTONDOWN:
+ case WM_MBUTTONDBLCLK:
+ type = WebEvent::MouseDown;
+ button = WebMouseEvent::MiddleButton;
+ break;
+ case WM_RBUTTONDOWN:
+ case WM_RBUTTONDBLCLK:
+ type = WebEvent::MouseDown;
+ button = WebMouseEvent::RightButton;
+ break;
+ case WM_LBUTTONUP:
+ type = WebEvent::MouseUp;
+ button = WebMouseEvent::LeftButton;
+ break;
+ case WM_MBUTTONUP:
+ type = WebEvent::MouseUp;
+ button = WebMouseEvent::MiddleButton;
+ break;
+ case WM_RBUTTONUP:
+ type = WebEvent::MouseUp;
+ button = WebMouseEvent::RightButton;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ type = WebEvent::KeyDown;
+ }
+
+ POINT position = point(lParam);
+ POINT globalPosition = position;
+ ::ClientToScreen(hWnd, &globalPosition);
+
+ double timestamp = ::GetTickCount() * 0.001; // ::GetTickCount returns milliseconds (Chrome uses GetMessageTime() / 1000.0)
+
+ int clickCount = WebKit::clickCount(type, button, position, timestamp);
+ WebEvent::Modifiers modifiers = modifiersForEvent(wParam);
+
+ return WebMouseEvent(type, button, position, globalPosition, 0, 0, 0, clickCount, modifiers, timestamp, didActivateWebView);
+}
+
+WebWheelEvent WebEventFactory::createWebWheelEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ // Taken from WebCore
+ static const float cScrollbarPixelsPerLine = 100.0f / 3.0f;
+
+ POINT globalPosition = point(lParam);
+ POINT position = globalPosition;
+ ::ScreenToClient(hWnd, &position);
+
+ WebWheelEvent::Granularity granularity = WebWheelEvent::ScrollByPixelWheelEvent;
+
+ WebEvent::Modifiers modifiers = modifiersForEvent(wParam);
+ double timestamp = ::GetTickCount() * 0.001; // ::GetTickCount returns milliseconds (Chrome uses GetMessageTime() / 1000.0)
+
+ int deltaX = 0;
+ int deltaY = 0;
+ int wheelTicksX = 0;
+ int wheelTicksY = 0;
+
+ float delta = GET_WHEEL_DELTA_WPARAM(wParam) / static_cast<float>(WHEEL_DELTA);
+ bool isMouseHWheel = (message == WM_VISTA_MOUSEHWHEEL);
+ if (isMouseHWheel) {
+ wheelTicksX = delta;
+ wheelTicksY = 0;
+ delta = -delta;
+ } else {
+ wheelTicksX = 0;
+ wheelTicksY = delta;
+ }
+ if (isMouseHWheel || (modifiers & WebEvent::ShiftKey)) {
+ deltaX = delta * static_cast<float>(horizontalScrollChars()) * cScrollbarPixelsPerLine;
+ deltaY = 0;
+ granularity = WebWheelEvent::ScrollByPixelWheelEvent;
+ } else {
+ deltaX = 0;
+ deltaY = delta;
+ int verticalMultiplier = verticalScrollLines();
+ if (verticalMultiplier == WHEEL_PAGESCROLL)
+ granularity = WebWheelEvent::ScrollByPageWheelEvent;
+ else {
+ granularity = WebWheelEvent::ScrollByPixelWheelEvent;
+ deltaY *= static_cast<float>(verticalMultiplier) * cScrollbarPixelsPerLine;
+ }
+ }
+
+ return WebWheelEvent(WebEvent::Wheel, position, globalPosition, FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, modifiers, timestamp);
+}
+
+WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
+{
+ WebEvent::Type type = keyboardEventTypeForEvent(message);
+ String text = textFromEvent(wparam, type);
+ String unmodifiedText = unmodifiedTextFromEvent(wparam, type);
+ String keyIdentifier = keyIdentifierFromEvent(wparam, type);
+ int windowsVirtualKeyCode = static_cast<int>(wparam);
+ int nativeVirtualKeyCode = static_cast<int>(wparam);
+ int macCharCode = 0;
+ bool autoRepeat = HIWORD(lparam) & KF_REPEAT;
+ bool isKeypad = isKeypadEvent(wparam, lparam, type);
+ bool isSystemKey = isSystemKeyEvent(message);
+ WebEvent::Modifiers modifiers = modifiersForCurrentKeyState();
+ double timestamp = ::GetTickCount() * 0.001; // ::GetTickCount returns milliseconds (Chrome uses GetMessageTime() / 1000.0)
+
+ return WebKeyboardEvent(type, text, unmodifiedText, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/win/WebEventFactory.h b/Source/WebKit2/Shared/win/WebEventFactory.h
new file mode 100644
index 0000000..ce75cdf
--- /dev/null
+++ b/Source/WebKit2/Shared/win/WebEventFactory.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010 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 WebEventFactory_h
+#define WebEventFactory_h
+
+#include "WebEvent.h"
+
+namespace WebKit {
+
+// FIXME: This is not needed in the WebProcess and should be moved to be a peer
+// of WKView or removed altogether in favor of using PlatformEvents everywhere.
+
+class WebEventFactory {
+public:
+ static WebMouseEvent createWebMouseEvent(HWND, UINT message, WPARAM, LPARAM, bool didActivateWebView);
+ static WebWheelEvent createWebWheelEvent(HWND, UINT message, WPARAM, LPARAM);
+ static WebKeyboardEvent createWebKeyboardEvent(HWND, UINT message, WPARAM, LPARAM);
+};
+
+} // namespace WebKit
+
+#endif // WebEventFactory_h
diff --git a/Source/WebKit2/Shared/win/WebURLRequestWin.cpp b/Source/WebKit2/Shared/win/WebURLRequestWin.cpp
new file mode 100644
index 0000000..e64d451
--- /dev/null
+++ b/Source/WebKit2/Shared/win/WebURLRequestWin.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#include "WebURLRequest.h"
+
+namespace WebKit {
+
+WebURLRequest::WebURLRequest(PlatformRequest platformRequest)
+ : m_request(platformRequest)
+{
+}
+
+PlatformRequest WebURLRequest::platformRequest() const
+{
+ return m_request.cfURLRequest();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/win/WebURLResponseWin.cpp b/Source/WebKit2/Shared/win/WebURLResponseWin.cpp
new file mode 100644
index 0000000..3b3f24c
--- /dev/null
+++ b/Source/WebKit2/Shared/win/WebURLResponseWin.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#include "WebURLResponse.h"
+
+namespace WebKit {
+
+WebURLResponse::WebURLResponse(PlatformResponse platformResponse)
+ : m_response(platformResponse)
+{
+}
+
+PlatformResponse WebURLResponse::platformResponse() const
+{
+ return m_response.cfURLResponse();
+}
+
+} // namespace WebKit