summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/wince
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-06 11:45:16 +0100
committerSteve Block <steveblock@google.com>2011-05-12 13:44:10 +0100
commitcad810f21b803229eb11403f9209855525a25d57 (patch)
tree29a6fd0279be608e0fe9ffe9841f722f0f4e4269 /Source/WebCore/platform/wince
parent121b0cf4517156d0ac5111caf9830c51b69bae8f (diff)
downloadexternal_webkit-cad810f21b803229eb11403f9209855525a25d57.zip
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.gz
external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.bz2
Merge WebKit at r75315: Initial merge by git.
Change-Id: I570314b346ce101c935ed22a626b48c2af266b84
Diffstat (limited to 'Source/WebCore/platform/wince')
-rw-r--r--Source/WebCore/platform/wince/CursorWinCE.cpp109
-rw-r--r--Source/WebCore/platform/wince/DragDataWinCE.cpp83
-rw-r--r--Source/WebCore/platform/wince/DragImageWinCE.cpp63
-rw-r--r--Source/WebCore/platform/wince/FileChooserWinCE.cpp60
-rw-r--r--Source/WebCore/platform/wince/FileSystemWinCE.cpp302
-rw-r--r--Source/WebCore/platform/wince/KURLWinCE.cpp30
-rw-r--r--Source/WebCore/platform/wince/KeygenWinCE.cpp101
-rw-r--r--Source/WebCore/platform/wince/MIMETypeRegistryWinCE.cpp141
-rw-r--r--Source/WebCore/platform/wince/PasteboardWinCE.cpp331
-rw-r--r--Source/WebCore/platform/wince/SearchPopupMenuWinCE.cpp54
-rw-r--r--Source/WebCore/platform/wince/SharedTimerWinCE.cpp122
-rw-r--r--Source/WebCore/platform/wince/TemporaryLinkStubs.cpp37
12 files changed, 1433 insertions, 0 deletions
diff --git a/Source/WebCore/platform/wince/CursorWinCE.cpp b/Source/WebCore/platform/wince/CursorWinCE.cpp
new file mode 100644
index 0000000..90ba879
--- /dev/null
+++ b/Source/WebCore/platform/wince/CursorWinCE.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2008-2009 Torch Mobile Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "Cursor.h"
+
+namespace WebCore {
+
+struct AllCursors {
+ AllCursors()
+ {
+ for (int i = 0; i < NumCursorTypes; ++i)
+ m_cursors[i] = (CursorType) i;
+ }
+ Cursor m_cursors[NumCursorTypes];
+};
+
+static const Cursor& getCursor(CursorType type)
+{
+ static AllCursors allCursors;
+ return allCursors.m_cursors[type];
+}
+
+Cursor::Cursor(const Cursor& other)
+: m_platformCursor(other.m_platformCursor)
+{
+}
+
+Cursor::Cursor(Image* img, const IntPoint& hotspot)
+: m_platformCursor(CursorNone)
+{
+}
+
+Cursor::~Cursor()
+{
+}
+
+Cursor& Cursor::operator=(const Cursor& other)
+{
+ m_platformCursor = other.m_platformCursor;
+ return *this;
+}
+
+Cursor::Cursor(PlatformCursor c)
+: m_platformCursor(c)
+{
+}
+
+const Cursor& noneCursor() { return getCursor(CursorNone); }
+const Cursor& pointerCursor() { return getCursor(CursorPointer); }
+const Cursor& crossCursor() { return getCursor(CursorCross); }
+const Cursor& handCursor() { return getCursor(CursorHand); }
+const Cursor& iBeamCursor() { return getCursor(CursorBeam); }
+const Cursor& waitCursor() { return getCursor(CursorWait); }
+const Cursor& helpCursor() { return getCursor(CursorHelp); }
+const Cursor& moveCursor() { return getCursor(CursorMove); }
+const Cursor& eastResizeCursor() { return getCursor(CursorEastResize); }
+const Cursor& northResizeCursor() { return getCursor(CursorNorthResize); }
+const Cursor& northEastResizeCursor() { return getCursor(CursorNorthEastResize); }
+const Cursor& northWestResizeCursor() { return getCursor(CursorNorthWestResize); }
+const Cursor& southResizeCursor() { return getCursor(CursorSouthResize); }
+const Cursor& southEastResizeCursor() { return getCursor(CursorSouthEastResize); }
+const Cursor& southWestResizeCursor() { return getCursor(CursorSouthWestResize); }
+const Cursor& westResizeCursor() { return getCursor(CursorWestResize); }
+const Cursor& northSouthResizeCursor() { return getCursor(CursorNorthSouthResize); }
+const Cursor& eastWestResizeCursor() { return getCursor(CursorEastWestResize); }
+const Cursor& northEastSouthWestResizeCursor() { return getCursor(CursorNorthEastSouthWestResize); }
+const Cursor& northWestSouthEastResizeCursor() { return getCursor(CursorNorthWestSouthEastResize); }
+const Cursor& columnResizeCursor() { return getCursor(CursorColumnResize); }
+const Cursor& rowResizeCursor() { return getCursor(CursorRowResize); }
+const Cursor& verticalTextCursor() { return getCursor(CursorVerticalText); }
+const Cursor& cellCursor() { return getCursor(CursorCell); }
+const Cursor& contextMenuCursor() { return getCursor(CursorContextMenu); }
+const Cursor& noDropCursor() { return getCursor(CursorNoDrop); }
+const Cursor& notAllowedCursor() { return getCursor(CursorNotAllowed); }
+const Cursor& progressCursor() { return getCursor(CursorProgress); }
+const Cursor& aliasCursor() { return getCursor(CursorAlias); }
+const Cursor& zoomInCursor() { return getCursor(CursorZoomIn); }
+const Cursor& zoomOutCursor() { return getCursor(CursorZoomOut); }
+const Cursor& copyCursor() { return getCursor(CursorCopy); }
+const Cursor& middlePanningCursor() { return crossCursor(); }
+const Cursor& eastPanningCursor() { return crossCursor(); }
+const Cursor& northPanningCursor() { return crossCursor(); }
+const Cursor& northEastPanningCursor() { return crossCursor(); }
+const Cursor& northWestPanningCursor() { return crossCursor(); }
+const Cursor& southPanningCursor() { return crossCursor(); }
+const Cursor& southEastPanningCursor() { return crossCursor(); }
+const Cursor& southWestPanningCursor() { return crossCursor(); }
+const Cursor& westPanningCursor() { return crossCursor(); }
+const Cursor& grabbingCursor() { return moveCursor(); }
+const Cursor& grabCursor() { return moveCursor(); }
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wince/DragDataWinCE.cpp b/Source/WebCore/platform/wince/DragDataWinCE.cpp
new file mode 100644
index 0000000..5535ea9
--- /dev/null
+++ b/Source/WebCore/platform/wince/DragDataWinCE.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2007-2008 Torch Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "DragData.h"
+
+#include "DocumentFragment.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
+{
+ return false;
+}
+
+String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const
+{
+ return String();
+}
+
+bool DragData::containsFiles() const
+{
+ return false;
+}
+
+void DragData::asFilenames(Vector<String>&) const
+{
+}
+
+bool DragData::containsPlainText() const
+{
+ return false;
+}
+
+String DragData::asPlainText() const
+{
+ return String();
+}
+
+bool DragData::containsColor() const
+{
+ return false;
+}
+
+bool DragData::canSmartReplace() const
+{
+ return false;
+}
+
+bool DragData::containsCompatibleContent() const
+{
+ return false;
+}
+
+PassRefPtr<DocumentFragment> DragData::asFragment(Document* doc) const
+{
+ return 0;
+}
+
+Color DragData::asColor() const
+{
+ return Color();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wince/DragImageWinCE.cpp b/Source/WebCore/platform/wince/DragImageWinCE.cpp
new file mode 100644
index 0000000..f639b41
--- /dev/null
+++ b/Source/WebCore/platform/wince/DragImageWinCE.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2007-2008 Torch Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "DragImage.h"
+
+#include "CachedImage.h"
+#include "GraphicsContext.h"
+#include "Image.h"
+
+#include <windows.h>
+
+namespace WebCore {
+
+IntSize dragImageSize(DragImageRef)
+{
+ return IntSize(0, 0);
+}
+
+void deleteDragImage(DragImageRef image)
+{
+ if (image)
+ ::DeleteObject(image);
+}
+
+DragImageRef scaleDragImage(DragImageRef, FloatSize)
+{
+ return 0;
+}
+
+DragImageRef dissolveDragImageToFraction(DragImageRef image, float)
+{
+ return image;
+}
+
+DragImageRef createDragImageFromImage(Image*)
+{
+ return 0;
+}
+
+DragImageRef createDragImageIconForCachedImage(CachedImage*)
+{
+ return 0;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wince/FileChooserWinCE.cpp b/Source/WebCore/platform/wince/FileChooserWinCE.cpp
new file mode 100644
index 0000000..955e68a
--- /dev/null
+++ b/Source/WebCore/platform/wince/FileChooserWinCE.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 "config.h"
+#include "FileChooser.h"
+
+#include "Chrome.h"
+#include "ChromeClient.h"
+#include "Document.h"
+#include "Frame.h"
+#include "Icon.h"
+#include "LocalizedStrings.h"
+#include "Page.h"
+#include "StringTruncator.h"
+
+namespace WebCore {
+
+String pathGetFileName(const String& path);
+
+String FileChooser::basenameForWidth(const Font& font, int width) const
+{
+ if (width <= 0)
+ return String();
+
+ String string;
+ if (m_filenames.isEmpty())
+ string = fileButtonNoFileSelectedLabel();
+ else if (m_filenames.size() == 1) {
+ String tmpFilename = m_filenames[0];
+ string = pathGetFileName(tmpFilename);
+ } else
+ return StringTruncator::rightTruncate(String::number(m_filenames.size()) + " files", width, font, false);
+
+ return StringTruncator::centerTruncate(string, width, font, false);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wince/FileSystemWinCE.cpp b/Source/WebCore/platform/wince/FileSystemWinCE.cpp
new file mode 100644
index 0000000..49acf12
--- /dev/null
+++ b/Source/WebCore/platform/wince/FileSystemWinCE.cpp
@@ -0,0 +1,302 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ *
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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 "config.h"
+#include "FileSystem.h"
+
+#include "NotImplemented.h"
+#include "PlatformString.h"
+#include <wincrypt.h>
+#include <windows.h>
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+static size_t reverseFindPathSeparator(const String& path, unsigned start = UINT_MAX)
+{
+ size_t positionSlash = path.reverseFind('/', start);
+ size_t positionBackslash = path.reverseFind('\\', start);
+
+ if (positionSlash == notFound)
+ return positionBackslash;
+
+ if (positionBackslash == notFound)
+ return positionSlash;
+
+ return std::max(positionSlash, positionBackslash);
+}
+
+static bool getFileInfo(const String& path, BY_HANDLE_FILE_INFORMATION& fileInfo)
+{
+ String filename = path;
+ HANDLE hFile = CreateFile(filename.charactersWithNullTermination(), GENERIC_READ, FILE_SHARE_READ, 0
+ , OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, 0);
+
+ if (hFile == INVALID_HANDLE_VALUE)
+ return false;
+
+ bool rtn = GetFileInformationByHandle(hFile, &fileInfo) ? true : false;
+
+ CloseHandle(hFile);
+ return rtn;
+}
+
+bool getFileSize(const String& path, long long& result)
+{
+ BY_HANDLE_FILE_INFORMATION fileInformation;
+ if (!getFileInfo(path, fileInformation))
+ return false;
+
+ ULARGE_INTEGER fileSize;
+ fileSize.LowPart = fileInformation.nFileSizeLow;
+ fileSize.HighPart = fileInformation.nFileSizeHigh;
+
+ result = fileSize.QuadPart;
+
+ return true;
+}
+
+bool getFileModificationTime(const String& path, time_t& result)
+{
+ BY_HANDLE_FILE_INFORMATION fileInformation;
+ if (!getFileInfo(path, fileInformation))
+ return false;
+
+ ULARGE_INTEGER t;
+ memcpy(&t, &fileInformation.ftLastWriteTime, sizeof(t));
+
+ result = t.QuadPart * 0.0000001 - 11644473600.0;
+
+ return true;
+}
+
+bool fileExists(const String& path)
+{
+ String filename = path;
+ HANDLE hFile = CreateFile(filename.charactersWithNullTermination(), 0, FILE_SHARE_READ | FILE_SHARE_WRITE
+ , 0, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, 0);
+
+ CloseHandle(hFile);
+
+ return hFile != INVALID_HANDLE_VALUE;
+}
+
+bool deleteFile(const String& path)
+{
+ String filename = path;
+ return !!DeleteFileW(filename.charactersWithNullTermination());
+}
+
+
+bool deleteEmptyDirectory(const String& path)
+{
+ String filename = path;
+ return !!RemoveDirectoryW(filename.charactersWithNullTermination());
+}
+
+String pathByAppendingComponent(const String& path, const String& component)
+{
+ if (component.isEmpty())
+ return path;
+
+ Vector<UChar, MAX_PATH> buffer;
+
+ buffer.append(path.characters(), path.length());
+
+ if (buffer.last() != L'\\' && buffer.last() != L'/'
+ && component[0] != L'\\' && component[0] != L'/')
+ buffer.append(L'\\');
+
+ buffer.append(component.characters(), component.length());
+
+ return String(buffer.data(), buffer.size());
+}
+
+CString fileSystemRepresentation(const String&)
+{
+ return "";
+}
+
+bool makeAllDirectories(const String& path)
+{
+ size_t lastDivPos = reverseFindPathSeparator(path);
+ unsigned endPos = path.length();
+ if (lastDivPos == endPos - 1) {
+ --endPos;
+ lastDivPos = reverseFindPathSeparator(path, lastDivPos);
+ }
+
+ if (lastDivPos != notFound) {
+ if (!makeAllDirectories(path.substring(0, lastDivPos)))
+ return false;
+ }
+
+ String folder(path.substring(0, endPos));
+ CreateDirectory(folder.charactersWithNullTermination(), 0);
+
+ DWORD fileAttr = GetFileAttributes(folder.charactersWithNullTermination());
+ return fileAttr != 0xFFFFFFFF && (fileAttr & FILE_ATTRIBUTE_DIRECTORY);
+}
+
+String homeDirectoryPath()
+{
+ notImplemented();
+ return "";
+}
+
+String pathGetFileName(const String& path)
+{
+ size_t pos = reverseFindPathSeparator(path);
+ if (pos == notFound)
+ return path;
+ return path.substring(pos + 1);
+}
+
+String directoryName(const String& path)
+{
+ size_t pos = reverseFindPathSeparator(path);
+ if (pos == notFound)
+ return String();
+ return path.left(pos);
+}
+
+CString openTemporaryFile(const char*, PlatformFileHandle& handle)
+{
+ handle = INVALID_HANDLE_VALUE;
+
+ wchar_t tempPath[MAX_PATH];
+ int tempPathLength = ::GetTempPath(WTF_ARRAY_LENGTH(tempPath), tempPath);
+ if (tempPathLength <= 0 || tempPathLength > WTF_ARRAY_LENGTH(tempPath))
+ return CString();
+
+ HCRYPTPROV hCryptProv = 0;
+ if (!CryptAcquireContext(&hCryptProv, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
+ return CString();
+
+ String proposedPath;
+ while (1) {
+
+ wchar_t tempFile[] = L"XXXXXXXX.tmp"; // Use 8.3 style name (more characters aren't helpful due to 8.3 short file names)
+ const int randomPartLength = 8;
+ if (!CryptGenRandom(hCryptProv, randomPartLength * 2, reinterpret_cast<BYTE*>(tempFile)))
+ break;
+
+ // Limit to valid filesystem characters, also excluding others that could be problematic, like punctuation.
+ // don't include both upper and lowercase since Windows file systems are typically not case sensitive.
+ const char validChars[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+ for (int i = 0; i < randomPartLength; ++i)
+ tempFile[i] = validChars[tempFile[i] % (sizeof(validChars) - 1)];
+
+ ASSERT(wcslen(tempFile) * 2 == sizeof(tempFile) - 2);
+
+ proposedPath = pathByAppendingComponent(String(tempPath), String(tempFile));
+
+ // use CREATE_NEW to avoid overwriting an existing file with the same name
+ handle = CreateFile(proposedPath.charactersWithNullTermination(), GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
+ if (!isHandleValid(handle) && GetLastError() == ERROR_ALREADY_EXISTS)
+ continue;
+
+ break;
+ }
+
+ CryptReleaseContext(hCryptProv, 0);
+
+ if (!isHandleValid(handle))
+ return CString();
+
+ return proposedPath.latin1();
+}
+
+void closeFile(PlatformFileHandle& handle)
+{
+ if (isHandleValid(handle)) {
+ ::CloseHandle(handle);
+ handle = invalidPlatformFileHandle;
+ }
+}
+
+int writeToFile(PlatformFileHandle handle, const char* data, int length)
+{
+ if (!isHandleValid(handle))
+ return -1;
+
+ DWORD bytesWritten;
+ bool success = WriteFile(handle, data, length, &bytesWritten, 0);
+
+ if (!success)
+ return -1;
+ return static_cast<int>(bytesWritten);
+}
+
+bool unloadModule(PlatformModule module)
+{
+ return ::FreeLibrary(module);
+}
+
+String localUserSpecificStorageDirectory()
+{
+ return String(L"\\");
+}
+
+String roamingUserSpecificStorageDirectory()
+{
+ return String(L"\\");
+}
+
+Vector<String> listDirectory(const String& path, const String& filter)
+{
+ Vector<String> entries;
+
+ Vector<UChar, 256> pattern;
+ pattern.append(path.characters(), path.length());
+ if (pattern.last() != L'/' && pattern.last() != L'\\')
+ pattern.append(L'\\');
+
+ String root(pattern.data(), pattern.size());
+ pattern.append(filter.characters(), filter.length());
+ pattern.append(0);
+
+ WIN32_FIND_DATA findData;
+ HANDLE hFind = FindFirstFile(pattern.data(), &findData);
+ if (INVALID_HANDLE_VALUE != hFind) {
+ do {
+ // FIXEME: should we also add the folders? This function
+ // is so far only called by PluginDatabase.cpp to list
+ // all plugins in a folder, where it's not supposed to list sub-folders.
+ if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+ entries.append(root + findData.cFileName);
+ } while (FindNextFile(hFind, &findData));
+ FindClose(hFind);
+ }
+
+ return entries;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wince/KURLWinCE.cpp b/Source/WebCore/platform/wince/KURLWinCE.cpp
new file mode 100644
index 0000000..2bbdfe8
--- /dev/null
+++ b/Source/WebCore/platform/wince/KURLWinCE.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2009 Torch Mobile Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "KURL.h"
+
+namespace WebCore {
+
+String KURL::fileSystemPath() const
+{
+ return path();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wince/KeygenWinCE.cpp b/Source/WebCore/platform/wince/KeygenWinCE.cpp
new file mode 100644
index 0000000..0c1b3c6
--- /dev/null
+++ b/Source/WebCore/platform/wince/KeygenWinCE.cpp
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2008-2009 Torch Mobile Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "SSLKeyGenerator.h"
+
+#include "Base64.h"
+#include <wtf/text/CString.h>
+
+#include <windows.h>
+#include <wincrypt.h>
+
+namespace WebCore {
+
+void WebCore::getSupportedKeySizes(Vector<String>& v)
+{
+ v.append("High Grade");
+ v.append("Medium Grade");
+}
+
+String WebCore::signedPublicKeyAndChallengeString(unsigned index, const String& challenge, const KURL& url)
+{
+ String keyString;
+
+ HCRYPTPROV hContext = 0;
+ HCRYPTKEY hKey = 0;
+ PCERT_PUBLIC_KEY_INFO pPubInfo = 0;
+
+ // Try to delete it if it exists already
+ CryptAcquireContext(&hContext, _T("keygen_container"), MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_DELETEKEYSET);
+
+ do {
+ if (!CryptAcquireContext(&hContext, _T("keygen_container"), MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_NEWKEYSET))
+ break;
+
+ DWORD dwPubInfoLength = 0;
+ if (!CryptGenKey(hContext, AT_KEYEXCHANGE, 0, &hKey) || !CryptExportPublicKeyInfo(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, 0, &dwPubInfoLength))
+ break;
+
+ // Use malloc instead of new, because malloc guarantees to return a pointer aligned for all data types.
+ pPubInfo = reinterpret_cast<PCERT_PUBLIC_KEY_INFO>(fastMalloc(dwPubInfoLength));
+
+ if (!CryptExportPublicKeyInfo(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, pPubInfo, &dwPubInfoLength))
+ break;
+
+ CERT_KEYGEN_REQUEST_INFO requestInfo = { 0 };
+ requestInfo.dwVersion = CERT_KEYGEN_REQUEST_V1;
+ requestInfo.pwszChallengeString = L"";
+ requestInfo.SubjectPublicKeyInfo = *pPubInfo;
+
+ String localChallenge = challenge;
+
+ // Windows API won't write to our buffer, although it's not declared with const.
+ requestInfo.pwszChallengeString = const_cast<wchar_t*>(localChallenge.charactersWithNullTermination());
+
+ CRYPT_ALGORITHM_IDENTIFIER signAlgo = { 0 };
+ signAlgo.pszObjId = szOID_RSA_SHA1RSA;
+
+ DWORD dwEncodedLength;
+ if (!CryptSignAndEncodeCertificate(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, X509_KEYGEN_REQUEST_TO_BE_SIGNED, &requestInfo, &signAlgo, 0, 0, &dwEncodedLength))
+ break;
+
+ Vector<char> binary(dwEncodedLength);
+ if (!CryptSignAndEncodeCertificate(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, X509_KEYGEN_REQUEST_TO_BE_SIGNED, &requestInfo, &signAlgo, 0, reinterpret_cast<LPBYTE>(binary.data()), &dwEncodedLength))
+ break;
+
+ Vector<char> base64;
+ base64Encode(binary, base64);
+ keyString = String(base64.data(), base64.size());
+
+ } while(0);
+
+ if (pPubInfo)
+ fastFree(pPubInfo);
+
+ if (hKey)
+ CryptDestroyKey(hKey);
+
+ if (hContext)
+ CryptReleaseContext(hContext, 0);
+
+ return keyString;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wince/MIMETypeRegistryWinCE.cpp b/Source/WebCore/platform/wince/MIMETypeRegistryWinCE.cpp
new file mode 100644
index 0000000..7534b91
--- /dev/null
+++ b/Source/WebCore/platform/wince/MIMETypeRegistryWinCE.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 "config.h"
+#include "MIMETypeRegistry.h"
+
+#include <wtf/HashMap.h>
+#include <windows.h>
+#include <winreg.h>
+
+namespace WebCore {
+
+static String mimeTypeForExtension(const String& extension)
+{
+ String ext = "." + extension;
+ WCHAR contentTypeStr[256];
+ DWORD contentTypeStrLen = sizeof(contentTypeStr);
+ DWORD valueType;
+
+ HKEY key;
+ String result;
+ if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_CLASSES_ROOT, ext.charactersWithNullTermination(), 0, 0, &key))
+ return result;
+
+ if (ERROR_SUCCESS == RegQueryValueEx(key, L"Content Type", 0, &valueType, (LPBYTE)contentTypeStr, &contentTypeStrLen) && valueType == REG_SZ)
+ result = String(contentTypeStr, contentTypeStrLen / sizeof(contentTypeStr[0]) - 1);
+
+ RegCloseKey(key);
+
+ return result;
+}
+
+static HashMap<String, String> mimetypeMap;
+
+static void initMIMETypeEntensionMap()
+{
+ if (mimetypeMap.isEmpty()) {
+ //fill with initial values
+ mimetypeMap.add("txt", "text/plain");
+ mimetypeMap.add("pdf", "application/pdf");
+ mimetypeMap.add("ps", "application/postscript");
+ mimetypeMap.add("html", "text/html");
+ mimetypeMap.add("htm", "text/html");
+ mimetypeMap.add("xml", "text/xml");
+ mimetypeMap.add("xsl", "text/xsl");
+ mimetypeMap.add("js", "application/x-javascript");
+ mimetypeMap.add("xhtml", "application/xhtml+xml");
+ mimetypeMap.add("rss", "application/rss+xml");
+ mimetypeMap.add("webarchive", "application/x-webarchive");
+ mimetypeMap.add("svg", "image/svg+xml");
+ mimetypeMap.add("svgz", "image/svg+xml");
+ mimetypeMap.add("jpg", "image/jpeg");
+ mimetypeMap.add("jpeg", "image/jpeg");
+ mimetypeMap.add("png", "image/png");
+ mimetypeMap.add("tif", "image/tiff");
+ mimetypeMap.add("tiff", "image/tiff");
+ mimetypeMap.add("ico", "image/ico");
+ mimetypeMap.add("cur", "image/ico");
+ mimetypeMap.add("bmp", "image/bmp");
+ mimetypeMap.add("css", "text/css");
+ // FIXME: Custom font works only when MIME is "text/plain"
+ mimetypeMap.add("ttf", "text/plain"); // "font/ttf"
+ mimetypeMap.add("otf", "text/plain"); // "font/otf"
+#if ENABLE(WML)
+ mimetypeMap.add("wml", "text/vnd.wap.wml");
+#endif
+#if ENABLE(WBXML)
+ mimetypeMap.add("wbxml", "application/vnd.wap.wmlc");
+#endif
+ }
+}
+
+String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type)
+{
+ if (type.isEmpty())
+ return String();
+
+ // Avoid conflicts with "ttf" and "otf"
+ if (equalIgnoringCase(type, "text/plain"))
+ return "txt";
+
+ initMIMETypeEntensionMap();
+
+ for (HashMap<String, String>::iterator i = mimetypeMap.begin(); i != mimetypeMap.end(); ++i) {
+ if (equalIgnoringCase(i->second, type))
+ return i->first;
+ }
+
+#if ENABLE(XHTMLMP)
+ if (equalIgnoringCase("application/vnd.wap.xhtml+xml", type))
+ return String("xml");
+#endif
+
+ return String();
+}
+
+String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
+{
+ if (ext.isEmpty())
+ return String();
+
+ initMIMETypeEntensionMap();
+
+ String result = mimetypeMap.get(ext.lower());
+ if (result.isEmpty()) {
+ result = mimeTypeForExtension(ext);
+ if (!result.isEmpty())
+ mimetypeMap.add(ext, result);
+ }
+ return result.isEmpty() ? "unknown/unknown" : result;
+}
+
+bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&)
+{
+ return false;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wince/PasteboardWinCE.cpp b/Source/WebCore/platform/wince/PasteboardWinCE.cpp
new file mode 100644
index 0000000..70b4083
--- /dev/null
+++ b/Source/WebCore/platform/wince/PasteboardWinCE.cpp
@@ -0,0 +1,331 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 "config.h"
+#include "Pasteboard.h"
+
+#include "ClipboardUtilitiesWin.h"
+#include "Document.h"
+#include "DocumentFragment.h"
+#include "Element.h"
+#include "Frame.h"
+#include "HitTestResult.h"
+#include "Image.h"
+#include "KURL.h"
+#include "Page.h"
+#include "Range.h"
+#include "RenderImage.h"
+#include "TextEncoding.h"
+#include "WebCoreInstanceHandle.h"
+#include "markup.h"
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+static UINT HTMLClipboardFormat = 0;
+static UINT BookmarkClipboardFormat = 0;
+static UINT WebSmartPasteFormat = 0;
+
+extern HDC hScreenDC;
+
+static LRESULT CALLBACK PasteboardOwnerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ LRESULT lresult = 0;
+ LONG longPtr = GetWindowLong(hWnd, 0);
+
+ switch (message) {
+ case WM_RENDERFORMAT:
+ // This message comes when SetClipboardData was sent a null data handle
+ // and now it's come time to put the data on the clipboard.
+ break;
+ case WM_RENDERALLFORMATS:
+ // This message comes when SetClipboardData was sent a null data handle
+ // and now this application is about to quit, so it must put data on
+ // the clipboard before it exits.
+ break;
+ case WM_DESTROY:
+ break;
+ default:
+ lresult = DefWindowProc(hWnd, message, wParam, lParam);
+ break;
+ }
+ return lresult;
+}
+
+Pasteboard* Pasteboard::generalPasteboard()
+{
+ static Pasteboard* pasteboard = new Pasteboard;
+ return pasteboard;
+}
+
+Pasteboard::Pasteboard()
+{
+ // make a dummy HWND to be the Windows clipboard's owner
+ WNDCLASS wc = {0};
+ memset(&wc, 0, sizeof(wc));
+ wc.lpfnWndProc = PasteboardOwnerWndProc;
+ wc.hInstance = WebCore::instanceHandle();
+ wc.lpszClassName = L"PasteboardOwnerWindowClass";
+ ::RegisterClass(&wc);
+
+ m_owner = ::CreateWindow(L"PasteboardOwnerWindowClass", L"PasteboardOwnerWindow", 0, 0, 0, 0, 0,
+ HWND_MESSAGE, 0, 0, 0);
+
+ HTMLClipboardFormat = ::RegisterClipboardFormat(L"HTML Format");
+ BookmarkClipboardFormat = ::RegisterClipboardFormat(L"UniformResourceLocatorW");
+ WebSmartPasteFormat = ::RegisterClipboardFormat(L"WebKit Smart Paste Format");
+}
+
+void Pasteboard::clear()
+{
+ if (::OpenClipboard(m_owner)) {
+ ::EmptyClipboard();
+ ::CloseClipboard();
+ }
+}
+
+void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
+{
+ clear();
+
+ // Put CF_HTML format on the pasteboard
+ if (::OpenClipboard(m_owner)) {
+ ExceptionCode ec = 0;
+ Vector<char> data;
+ markupToCF_HTML(createMarkup(selectedRange, 0, AnnotateForInterchange), selectedRange->startContainer(ec)->document()->url(), data);
+ HGLOBAL cbData = createGlobalData(data);
+ if (!::SetClipboardData(HTMLClipboardFormat, cbData))
+ ::GlobalFree(cbData);
+ ::CloseClipboard();
+ }
+
+ // Put plain string on the pasteboard. CF_UNICODETEXT covers CF_TEXT as well
+ String str = frame->selectedText();
+ replaceNewlinesWithWindowsStyleNewlines(str);
+ replaceNBSPWithSpace(str);
+ if (::OpenClipboard(m_owner)) {
+ HGLOBAL cbData = createGlobalData(str);
+ if (!::SetClipboardData(CF_UNICODETEXT, cbData))
+ ::GlobalFree(cbData);
+ ::CloseClipboard();
+ }
+
+ // enable smart-replacing later on by putting dummy data on the pasteboard
+ if (canSmartCopyOrDelete) {
+ if (::OpenClipboard(m_owner)) {
+ ::SetClipboardData(WebSmartPasteFormat, 0);
+ ::CloseClipboard();
+ }
+ }
+}
+
+void Pasteboard::writePlainText(const String& text)
+{
+ clear();
+
+ // Put plain string on the pasteboard. CF_UNICODETEXT covers CF_TEXT as well
+ String str = text;
+ replaceNewlinesWithWindowsStyleNewlines(str);
+ if (::OpenClipboard(m_owner)) {
+ HGLOBAL cbData = createGlobalData(str);
+ if (!::SetClipboardData(CF_UNICODETEXT, cbData))
+ ::GlobalFree(cbData);
+ ::CloseClipboard();
+ }
+}
+
+void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame)
+{
+ ASSERT(!url.isEmpty());
+
+ clear();
+
+ String title(titleStr);
+ if (title.isEmpty()) {
+ title = url.lastPathComponent();
+ if (title.isEmpty())
+ title = url.host();
+ }
+
+ // write to clipboard in format com.apple.safari.bookmarkdata to be able to paste into the bookmarks view with appropriate title
+ if (::OpenClipboard(m_owner)) {
+ HGLOBAL cbData = createGlobalData(url, title);
+ if (!::SetClipboardData(BookmarkClipboardFormat, cbData))
+ ::GlobalFree(cbData);
+ ::CloseClipboard();
+ }
+
+ // write to clipboard in format CF_HTML to be able to paste into contenteditable areas as a link
+ if (::OpenClipboard(m_owner)) {
+ Vector<char> data;
+ markupToCF_HTML(urlToMarkup(url, title), "", data);
+ HGLOBAL cbData = createGlobalData(data);
+ if (!::SetClipboardData(HTMLClipboardFormat, cbData))
+ ::GlobalFree(cbData);
+ ::CloseClipboard();
+ }
+
+ // bare-bones CF_UNICODETEXT support
+ if (::OpenClipboard(m_owner)) {
+ HGLOBAL cbData = createGlobalData(url.string());
+ if (!::SetClipboardData(CF_UNICODETEXT, cbData))
+ ::GlobalFree(cbData);
+ ::CloseClipboard();
+ }
+}
+
+void Pasteboard::writeImage(Node* node, const KURL&, const String&)
+{
+ ASSERT(node && node->renderer() && node->renderer()->isImage());
+ RenderImage* renderer = static_cast<RenderImage*>(node->renderer());
+ CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage());
+ ASSERT(cachedImage);
+ Image* image = cachedImage->image();
+ ASSERT(image);
+
+ clear();
+
+ RefPtr<SharedBitmap> sourceBmp = image->nativeImageForCurrentFrame();
+ if (!sourceBmp)
+ return;
+
+ IntRect rect(0, 0, sourceBmp->width(), sourceBmp->height());
+ BitmapInfo bmpInfo;
+ void* pixels;
+ HBITMAP resultBitmap = sourceBmp->clipBitmap(rect, true, bmpInfo, pixels);
+ if (!resultBitmap)
+ return;
+
+ if (::OpenClipboard(m_owner)) {
+ ::SetClipboardData(CF_BITMAP, resultBitmap);
+ ::CloseClipboard();
+ } else
+ DeleteObject(resultBitmap);
+}
+
+bool Pasteboard::canSmartReplace()
+{
+ return ::IsClipboardFormatAvailable(WebSmartPasteFormat);
+}
+
+String Pasteboard::plainText(Frame* frame)
+{
+ if (::IsClipboardFormatAvailable(CF_UNICODETEXT) && ::OpenClipboard(m_owner)) {
+ HANDLE cbData = ::GetClipboardData(CF_UNICODETEXT);
+ if (cbData) {
+ UChar* buffer = (UChar*)GlobalLock(cbData);
+ String fromClipboard(buffer);
+ GlobalUnlock(cbData);
+ CloseClipboard();
+ return fromClipboard;
+ } else
+ CloseClipboard();
+ }
+
+ if (::IsClipboardFormatAvailable(CF_TEXT) && ::OpenClipboard(m_owner)) {
+ HANDLE cbData = ::GetClipboardData(CF_TEXT);
+ if (cbData) {
+ char* buffer = (char*)GlobalLock(cbData);
+ String fromClipboard(buffer);
+ GlobalUnlock(cbData);
+ CloseClipboard();
+ return fromClipboard;
+ } else
+ CloseClipboard();
+ }
+
+ return String();
+}
+
+PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText)
+{
+ chosePlainText = false;
+
+ if (::IsClipboardFormatAvailable(HTMLClipboardFormat) && ::OpenClipboard(m_owner)) {
+ // get data off of clipboard
+ HANDLE cbData = ::GetClipboardData(HTMLClipboardFormat);
+ if (cbData) {
+ SIZE_T dataSize = ::GlobalSize(cbData);
+ String cf_html(UTF8Encoding().decode((char*)GlobalLock(cbData), dataSize));
+ GlobalUnlock(cbData);
+ CloseClipboard();
+
+ PassRefPtr<DocumentFragment> fragment = fragmentFromCF_HTML(frame->document(), cf_html);
+ if (fragment)
+ return fragment;
+ } else
+ CloseClipboard();
+ }
+
+ if (allowPlainText && IsClipboardFormatAvailable(CF_UNICODETEXT)) {
+ chosePlainText = true;
+ if (OpenClipboard(m_owner)) {
+ HANDLE cbData = GetClipboardData(CF_UNICODETEXT);
+ if (cbData) {
+ UChar* buffer = (UChar*)GlobalLock(cbData);
+ String str(buffer);
+ GlobalUnlock(cbData);
+ CloseClipboard();
+ RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), str);
+ if (fragment)
+ return fragment.release();
+ } else
+ CloseClipboard();
+ }
+ }
+
+ if (allowPlainText && ::IsClipboardFormatAvailable(CF_TEXT)) {
+ chosePlainText = true;
+ if (::OpenClipboard(m_owner)) {
+ HANDLE cbData = ::GetClipboardData(CF_TEXT);
+ if (cbData) {
+ char* buffer = (char*)GlobalLock(cbData);
+ String str(buffer);
+ GlobalUnlock(cbData);
+ CloseClipboard();
+ RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), str);
+ if (fragment)
+ return fragment.release();
+ } else
+ CloseClipboard();
+ }
+ }
+
+ return 0;
+}
+
+bool Pasteboard::hasData()
+{
+ return hasDataInFormat(CF_UNICODETEXT) || hasDataInFormat(CF_TEXT);
+}
+
+bool Pasteboard::hasDataInFormat(unsigned int format)
+{
+ return ::IsClipboardFormatAvailable(format);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wince/SearchPopupMenuWinCE.cpp b/Source/WebCore/platform/wince/SearchPopupMenuWinCE.cpp
new file mode 100644
index 0000000..b2a8442
--- /dev/null
+++ b/Source/WebCore/platform/wince/SearchPopupMenuWinCE.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2009 Torch Mobile Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "SearchPopupMenu.h"
+
+#include "NotImplemented.h"
+#include <wtf/text/AtomicString.h>
+
+namespace WebCore {
+
+SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client)
+: PopupMenu(client)
+{
+}
+
+bool SearchPopupMenu::enabled()
+{
+ return false;
+}
+
+void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
+{
+ if (name.isEmpty())
+ return;
+
+ notImplemented();
+}
+
+void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
+{
+ if (name.isEmpty())
+ return;
+
+ notImplemented();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wince/SharedTimerWinCE.cpp b/Source/WebCore/platform/wince/SharedTimerWinCE.cpp
new file mode 100644
index 0000000..829d95e
--- /dev/null
+++ b/Source/WebCore/platform/wince/SharedTimerWinCE.cpp
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007-2008 Torch Mobile, Inc.
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 "config.h"
+#include "SharedTimer.h"
+
+#include "Page.h"
+#include "SystemTime.h"
+#include "WebCoreInstanceHandle.h"
+#include "Widget.h"
+#include <wtf/Assertions.h>
+#include <wtf/CurrentTime.h>
+#include <windows.h>
+
+namespace WebCore {
+
+enum {
+ TimerIdNone = 0,
+ TimerIdAuto,
+ TimerIdManual,
+};
+static UINT timerID = TimerIdNone;
+
+static void (*sharedTimerFiredFunction)();
+
+static HWND timerWindowHandle = 0;
+const LPCWSTR kTimerWindowClassName = L"TimerWindowClass";
+
+LRESULT CALLBACK TimerWindowWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if (message == WM_TIMER) {
+ if (timerID != TimerIdNone)
+ sharedTimerFiredFunction();
+ } else if (message == WM_USER) {
+ if (timerID = TimerIdManual) {
+ sharedTimerFiredFunction();
+ PostMessage(hWnd, WM_USER, 0, 0);
+ }
+ } else
+ return DefWindowProc(hWnd, message, wParam, lParam);
+
+ return 0;
+}
+
+static void initializeOffScreenTimerWindow()
+{
+ if (timerWindowHandle)
+ return;
+
+ WNDCLASS wcex = {0};
+ wcex.lpfnWndProc = TimerWindowWndProc;
+ wcex.hInstance = WebCore::instanceHandle();
+ wcex.lpszClassName = kTimerWindowClassName;
+ RegisterClass(&wcex);
+
+ timerWindowHandle = CreateWindow(kTimerWindowClassName, 0, 0,
+ CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, 0, WebCore::instanceHandle(), 0);
+}
+
+void setSharedTimerFiredFunction(void (*f)())
+{
+ sharedTimerFiredFunction = f;
+}
+
+#define USER_TIMER_MAXIMUM 0x7FFFFFFF
+#define USER_TIMER_MINIMUM 0x0000000A
+
+void setSharedTimerFireTime(double fireTime)
+{
+ ASSERT(sharedTimerFiredFunction);
+
+ double interval = (fireTime - currentTime()) * 1000.;
+ unsigned intervalInMS = interval < USER_TIMER_MINIMUM
+ ? USER_TIMER_MINIMUM
+ : interval > USER_TIMER_MAXIMUM
+ ? USER_TIMER_MAXIMUM
+ : static_cast<unsigned>(interval);
+
+ if (timerID == TimerIdAuto) {
+ KillTimer(timerWindowHandle, TimerIdAuto);
+ timerID = TimerIdNone;
+ }
+
+ initializeOffScreenTimerWindow();
+ if (SetTimer(timerWindowHandle, TimerIdAuto, intervalInMS, 0))
+ timerID = TimerIdAuto;
+ else if (timerID != TimerIdManual)
+ PostMessage(timerWindowHandle, WM_USER, 0, 0);
+}
+
+void stopSharedTimer()
+{
+ if (timerID == TimerIdAuto)
+ KillTimer(timerWindowHandle, TimerIdAuto);
+
+ timerID = TimerIdNone;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/wince/TemporaryLinkStubs.cpp b/Source/WebCore/platform/wince/TemporaryLinkStubs.cpp
new file mode 100644
index 0000000..dbd62dc
--- /dev/null
+++ b/Source/WebCore/platform/wince/TemporaryLinkStubs.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+ *
+ * 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 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 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 "config.h"
+
+#include "CookieStorage.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+void setCookieStoragePrivateBrowsingEnabled(bool)
+{
+ notImplemented();
+}
+
+} // namespace WebCore