Diff
Modified: trunk/Source/WebCore/ChangeLog (102302 => 102303)
--- trunk/Source/WebCore/ChangeLog 2011-12-08 03:11:13 UTC (rev 102302)
+++ trunk/Source/WebCore/ChangeLog 2011-12-08 03:38:23 UTC (rev 102303)
@@ -1,3 +1,28 @@
+2011-12-07 Leo Yang <[email protected]>
+
+ Upstream the BlackBerry porting of network Resource
+ https://bugs.webkit.org/show_bug.cgi?id=73388
+
+ Reviewed by Rob Buis.
+
+ Other main contributors:
+ Joe Mason <[email protected]>
+ Yong Li <[email protected]>
+ Gary Simmons <[email protected]>
+ Genevieve Mak <[email protected]>
+ Chris Guan <[email protected]>
+ Mike Lattanzio <[email protected]>
+
+ Initial upstream, can't be built yet, no new tests.
+
+ * platform/network/blackberry/ResourceError.h: Added.
+ * platform/network/blackberry/ResourceErrorBlackBerry.cpp: Added.
+ * platform/network/blackberry/ResourceHandleBlackBerry.cpp: Added.
+ * platform/network/blackberry/ResourceRequest.h: Added.
+ * platform/network/blackberry/ResourceRequestBlackBerry.cpp: Added.
+ * platform/network/blackberry/ResourceResponse.h: Added.
+ * platform/network/blackberry/ResourceResponseBlackBerry.cpp: Added.
+
2011-12-07 Fady Samuel <[email protected]>
[Chromium] Plumb DPI info into PlatformScreen
Added: trunk/Source/WebCore/platform/network/blackberry/ResourceError.h (0 => 102303)
--- trunk/Source/WebCore/platform/network/blackberry/ResourceError.h (rev 0)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceError.h 2011-12-08 03:38:23 UTC (rev 102303)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef ResourceError_h
+#define ResourceError_h
+
+#include "ResourceErrorBase.h"
+
+namespace WebCore {
+
+class ResourceError : public ResourceErrorBase {
+public:
+ static const char* const httpErrorDomain;
+ static const char* const platformErrorDomain;
+
+ ResourceError()
+ {
+ }
+
+ ResourceError(const String& domain, int errorCode, const String& failingURL, const String& localizedDescription)
+ : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription)
+ {
+ }
+};
+
+} // namespace WebCore
+
+#endif // ResourceError_h
Added: trunk/Source/WebCore/platform/network/blackberry/ResourceErrorBlackBerry.cpp (0 => 102303)
--- trunk/Source/WebCore/platform/network/blackberry/ResourceErrorBlackBerry.cpp (rev 0)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceErrorBlackBerry.cpp 2011-12-08 03:38:23 UTC (rev 102303)
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2010 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "ResourceError.h"
+
+namespace WebCore {
+
+const char* const ResourceError::httpErrorDomain = "HTTP";
+const char* const ResourceError::platformErrorDomain = "BlackBerryPlatform";
+
+} // namespace WebCore
Added: trunk/Source/WebCore/platform/network/blackberry/ResourceHandleBlackBerry.cpp (0 => 102303)
--- trunk/Source/WebCore/platform/network/blackberry/ResourceHandleBlackBerry.cpp (rev 0)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceHandleBlackBerry.cpp 2011-12-08 03:38:23 UTC (rev 102303)
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2009, 2010 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "ResourceHandle.h"
+
+#include "EventLoop.h"
+#include "Frame.h"
+#include "FrameLoaderClientBlackBerry.h"
+#include "NetworkManager.h"
+#include "NotImplemented.h"
+#include "Page.h"
+#include "PageGroupLoadDeferrer.h"
+#include "ResourceError.h"
+#include "ResourceHandleClient.h"
+#include "ResourceHandleInternal.h"
+#include "ResourceRequest.h"
+#include "ResourceResponse.h"
+#include "SharedBuffer.h"
+#include "ThreadableLoader.h" // for StoredCredentials
+
+#include <network/FilterStream.h>
+
+namespace WebCore {
+
+class WebCoreSynchronousLoader : public ResourceHandleClient {
+public:
+ WebCoreSynchronousLoader();
+
+ virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&);
+ virtual void didReceiveData(ResourceHandle*, const char*, int, int);
+ virtual void didFinishLoading(ResourceHandle*, double);
+ virtual void didFail(ResourceHandle*, const ResourceError&);
+
+ ResourceResponse resourceResponse() const { return m_response; }
+ ResourceError resourceError() const { return m_error; }
+ Vector<char> data() const { return m_data; }
+ bool isDone() const { return m_isDone; }
+
+private:
+ ResourceResponse m_response;
+ ResourceError m_error;
+ Vector<char> m_data;
+ bool m_isDone;
+};
+
+WebCoreSynchronousLoader::WebCoreSynchronousLoader()
+ : m_isDone(false)
+{
+}
+
+void WebCoreSynchronousLoader::didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
+{
+ m_response = response;
+}
+
+void WebCoreSynchronousLoader::didReceiveData(ResourceHandle*, const char* data, int length, int)
+{
+ m_data.append(data, length);
+}
+
+void WebCoreSynchronousLoader::didFinishLoading(ResourceHandle*, double)
+{
+ m_isDone = true;
+}
+
+void WebCoreSynchronousLoader::didFail(ResourceHandle*, const ResourceError& error)
+{
+ m_error = error;
+ m_isDone = true;
+}
+
+ResourceHandleInternal::~ResourceHandleInternal()
+{
+ notImplemented();
+}
+
+ResourceHandle::~ResourceHandle()
+{
+ notImplemented();
+}
+
+bool ResourceHandle::loadsBlocked()
+{
+ notImplemented();
+ return false;
+}
+
+void ResourceHandle::platformSetDefersLoading(bool defersLoading)
+{
+ NetworkManager::instance()->setDefersLoading(this, defersLoading);
+}
+
+bool ResourceHandle::start(NetworkingContext* context)
+{
+ if (!context || !context->isValid())
+ return false;
+
+ // FIXME: clean up use of Frame now that we have NetworkingContext (see RIM Bug #1515)
+ Frame* frame = context->wrappedFrame();
+ if (!frame || !frame->loader() || !frame->loader()->client() || !client())
+ return false;
+ int playerId = static_cast<FrameLoaderClientBlackBerry*>(frame->loader()->client())->playerId();
+ return NetworkManager::instance()->startJob(playerId, this, *frame, d->m_defersLoading);
+}
+
+bool ResourceHandle::supportsBufferedData()
+{
+ notImplemented();
+ return false;
+}
+
+void ResourceHandle::pauseLoad(bool pause)
+{
+ if (NetworkManager::instance())
+ NetworkManager::instance()->pauseLoad(this, pause);
+}
+
+bool ResourceHandle::willLoadFromCache(ResourceRequest&, Frame*)
+{
+ notImplemented();
+ return false;
+}
+
+void ResourceHandle::cancel()
+{
+ NetworkManager::instance()->stopJob(this);
+}
+
+void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data)
+{
+ if (!context || !context->isValid()) {
+ ASSERT(false && "loadResourceSynchronously called with invalid networking context");
+ return;
+ }
+
+ // FIXME: clean up use of Frame now that we have NetworkingContext (see RIM Bug #1515)
+ Frame* frame = context->wrappedFrame();
+ if (!frame || !frame->loader() || !frame->loader()->client() || !frame->page()) {
+ ASSERT(false && "loadResourceSynchronously called without a frame or frame client");
+ return;
+ }
+
+ PageGroupLoadDeferrer deferrer(frame->page(), true);
+ TimerBase::fireTimersInNestedEventLoop();
+
+ int playerId = static_cast<FrameLoaderClientBlackBerry*>(frame->loader()->client())->playerId();
+
+ WebCoreSynchronousLoader syncLoader;
+
+ bool defersLoading = false;
+ bool shouldContentSniff = false;
+
+ RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, &syncLoader, defersLoading, shouldContentSniff));
+ NetworkManager::instance()->startJob(playerId, handle, *frame, defersLoading);
+
+ const double syncLoadTimeOut = 60; // seconds
+
+ double startTime = currentTime();
+ EventLoop loop;
+ while (!syncLoader.isDone() && !loop.ended()) {
+ loop.cycle();
+ if (currentTime() - startTime > syncLoadTimeOut) {
+ handle->cancel();
+ error = ResourceError(ResourceError::platformErrorDomain, BlackBerry::Platform::FilterStream::StatusNetworkError, request.url().string(), "Time out");
+ return;
+ }
+ }
+
+ error = syncLoader.resourceError();
+ data = ""
+ response = syncLoader.resourceResponse();
+}
+
+PassRefPtr<SharedBuffer> ResourceHandle::bufferedData()
+{
+ notImplemented();
+ return 0;
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/platform/network/blackberry/ResourceRequest.h (0 => 102303)
--- trunk/Source/WebCore/platform/network/blackberry/ResourceRequest.h (rev 0)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceRequest.h 2011-12-08 03:38:23 UTC (rev 102303)
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2009, 2010 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef ResourceRequest_h
+#define ResourceRequest_h
+
+#include "ResourceRequestBase.h"
+
+namespace BlackBerry {
+namespace Platform {
+class NetworkRequest;
+}
+}
+
+namespace WebCore {
+
+class ResourceRequest : public ResourceRequestBase {
+public:
+ ResourceRequest(const String& url)
+ : ResourceRequestBase(KURL(ParsedURLString, url), UseProtocolCachePolicy)
+ , m_isXMLHTTPRequest(false)
+ , m_mustHandleInternally(false)
+ , m_isRequestedByPlugin(false)
+ , m_forceDownload(false)
+ {
+ }
+
+ ResourceRequest(const KURL& url)
+ : ResourceRequestBase(url, UseProtocolCachePolicy)
+ , m_isXMLHTTPRequest(false)
+ , m_mustHandleInternally(false)
+ , m_isRequestedByPlugin(false)
+ , m_forceDownload(false)
+ {
+ }
+
+ ResourceRequest(const KURL& url, const String& referrer, ResourceRequestCachePolicy policy = UseProtocolCachePolicy)
+ : ResourceRequestBase(url, policy)
+ , m_isXMLHTTPRequest(false)
+ , m_mustHandleInternally(false)
+ , m_isRequestedByPlugin(false)
+ , m_forceDownload(false)
+ {
+ setHTTPReferrer(referrer);
+ }
+
+ ResourceRequest()
+ : ResourceRequestBase(KURL(), UseProtocolCachePolicy)
+ , m_isXMLHTTPRequest(false)
+ , m_mustHandleInternally(false)
+ , m_isRequestedByPlugin(false)
+ , m_forceDownload(false)
+ {
+ }
+
+ void setToken(const String& token) { m_token = token; }
+ String token() const { return m_token; }
+
+ // FIXME: For RIM Bug #452. The BlackBerry application wants the anchor text for a clicked hyperlink so as to
+ // make an informed decision as to whether to allow the navigation. We should move this functionality into a
+ // UI/Policy delegate.
+ void setAnchorText(const String& anchorText) { m_anchorText = anchorText; }
+ String anchorText() const { return m_anchorText; }
+
+ void setOverrideContentType(const String& contentType) { m_overrideContentType = contentType; }
+ String overrideContentType() const { return m_overrideContentType; }
+
+ void setIsXMLHTTPRequest(bool isXMLHTTPRequest) { m_isXMLHTTPRequest = isXMLHTTPRequest; }
+ bool isXMLHTTPRequest() const { return m_isXMLHTTPRequest; }
+
+ void setIsRequestedByPlugin(bool isRequestedByPlugin) { m_isRequestedByPlugin = isRequestedByPlugin; }
+ bool isRequestedByPlugin() const { return m_isRequestedByPlugin; }
+
+ // Marks requests which must be handled by webkit even if LinksHandledExternally is set.
+ void setMustHandleInternally(bool mustHandleInternally) { m_mustHandleInternally = mustHandleInternally; }
+ bool mustHandleInternally() const { return m_mustHandleInternally; }
+
+ void initializePlatformRequest(BlackBerry::Platform::NetworkRequest&, bool isInitial = false) const;
+ void setForceDownload(bool forceDownload) { m_forceDownload = true; }
+ bool forceDownload() const { return m_forceDownload; }
+
+private:
+ friend class ResourceRequestBase;
+
+ String m_token;
+ String m_anchorText;
+ String m_overrideContentType;
+ bool m_isXMLHTTPRequest;
+ bool m_mustHandleInternally;
+ bool m_isRequestedByPlugin;
+ bool m_forceDownload;
+
+ void doUpdatePlatformRequest() { }
+ void doUpdateResourceRequest() { }
+
+ PassOwnPtr<CrossThreadResourceRequestData> doPlatformCopyData(PassOwnPtr<CrossThreadResourceRequestData>) const;
+ void doPlatformAdopt(PassOwnPtr<CrossThreadResourceRequestData>);
+};
+
+struct CrossThreadResourceRequestData : public CrossThreadResourceRequestDataBase {
+ String m_token;
+ String m_anchorText;
+ bool m_isXMLHTTPRequest;
+ bool m_mustHandleInternally;
+ bool m_isRequestedByPlugin;
+ bool m_forceDownload;
+};
+
+} // namespace WebCore
+
+#endif // ResourceRequest_h
Added: trunk/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp (0 => 102303)
--- trunk/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp (rev 0)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp 2011-12-08 03:38:23 UTC (rev 102303)
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2009, 2010, 2011 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "ResourceRequest.h"
+
+#include <BlackBerryPlatformClient.h>
+#include <network/NetworkRequest.h>
+#include <wtf/text/CString.h>
+
+using BlackBerry::Platform::NetworkRequest;
+
+namespace WebCore {
+
+unsigned initializeMaximumHTTPConnectionCountPerHost()
+{
+ return 6;
+}
+
+static inline NetworkRequest::CachePolicy platformCachePolicyForRequest(const ResourceRequest& request)
+{
+ switch (request.cachePolicy()) {
+ case WebCore::UseProtocolCachePolicy:
+ return NetworkRequest::UseProtocolCachePolicy;
+ case WebCore::ReloadIgnoringCacheData:
+ return NetworkRequest::ReloadIgnoringCacheData;
+ case WebCore::ReturnCacheDataElseLoad:
+ return NetworkRequest::ReturnCacheDataElseLoad;
+ case WebCore::ReturnCacheDataDontLoad:
+ return NetworkRequest::ReturnCacheDataDontLoad;
+ default:
+ ASSERT_NOT_REACHED();
+ return NetworkRequest::UseProtocolCachePolicy;
+ }
+}
+
+static inline NetworkRequest::TargetType platformTargetTypeForRequest(const ResourceRequest& request)
+{
+ if (request.isXMLHTTPRequest())
+ return NetworkRequest::TargetIsXMLHTTPRequest;
+
+ switch (request.targetType()) {
+ case ResourceRequest::TargetIsMainFrame:
+ return NetworkRequest::TargetIsMainFrame;
+ case ResourceRequest::TargetIsSubframe:
+ return NetworkRequest::TargetIsSubframe;
+ case ResourceRequest::TargetIsSubresource:
+ return NetworkRequest::TargetIsSubresource;
+ case ResourceRequest::TargetIsStyleSheet:
+ return NetworkRequest::TargetIsStyleSheet;
+ case ResourceRequest::TargetIsScript:
+ return NetworkRequest::TargetIsScript;
+ case ResourceRequest::TargetIsFontResource:
+ return NetworkRequest::TargetIsFontResource;
+ case ResourceRequest::TargetIsImage:
+ return NetworkRequest::TargetIsImage;
+ case ResourceRequest::TargetIsObject:
+ return NetworkRequest::TargetIsObject;
+ case ResourceRequest::TargetIsMedia:
+ return NetworkRequest::TargetIsMedia;
+ case ResourceRequest::TargetIsWorker:
+ return NetworkRequest::TargetIsWorker;
+ case ResourceRequest::TargetIsSharedWorker:
+ return NetworkRequest::TargetIsSharedWorker;
+ default:
+ ASSERT_NOT_REACHED();
+ return NetworkRequest::TargetIsUnknown;
+ }
+}
+
+void ResourceRequest::initializePlatformRequest(NetworkRequest& platformRequest, bool isInitial) const
+{
+ // If this is the initial load, skip the request body and headers.
+ if (isInitial)
+ platformRequest.setRequestInitial(timeoutInterval());
+ else {
+ platformRequest.setRequestUrl(url().string().utf8().data(),
+ httpMethod().latin1().data(),
+ platformCachePolicyForRequest(*this),
+ platformTargetTypeForRequest(*this),
+ timeoutInterval());
+
+ if (httpBody() && !httpBody()->isEmpty()) {
+ const Vector<FormDataElement>& elements = httpBody()->elements();
+ // Use setData for simple forms because it is slightly more efficient.
+ if (elements.size() == 1 && elements[0].m_type == FormDataElement::data)
+ platformRequest.setData(elements[0].m_data.data(), elements[0].m_data.size());
+ else {
+ for (unsigned i = 0; i < elements.size(); ++i) {
+ const FormDataElement& element = elements[i];
+ if (element.m_type == FormDataElement::data)
+ platformRequest.addMultipartData(element.m_data.data(), element.m_data.size());
+ else if (element.m_type == FormDataElement::encodedFile)
+ platformRequest.addMultipartFilename(element.m_filename.characters(), element.m_filename.length());
+#if ENABLE(BLOB)
+ else if (element.m_type == FormDataElement::encodedBlob)
+ continue; // We don't support blob now!
+#endif
+ else
+ ASSERT_NOT_REACHED(); // unknown type
+ }
+ }
+ }
+
+ for (HTTPHeaderMap::const_iterator it = httpHeaderFields().begin(); it != httpHeaderFields().end(); ++it) {
+ String key = it->first;
+ String value = it->second;
+ if (!key.isEmpty() && !value.isEmpty())
+ platformRequest.addHeader(key.latin1().data(), value.latin1().data());
+ }
+
+ // Locale has the form "en-US". Construct accept language like "en-US, en;q=0.8".
+ std::string locale = BlackBerry::Platform::Client::get()->getLocale();
+ // POSIX locale has '_' instead of '-'.
+ // Replace to conform to HTTP spec.
+ size_t underscore = locale.find('_');
+ if (underscore != std::string::npos)
+ locale.replace(underscore, 1, "-");
+ std::string acceptLanguage = locale + ", " + locale.substr(0, 2) + ";q=0.8";
+ platformRequest.addHeader("Accept-Language", acceptLanguage.c_str());
+ }
+}
+
+PassOwnPtr<CrossThreadResourceRequestData> ResourceRequest::doPlatformCopyData(PassOwnPtr<CrossThreadResourceRequestData> data) const
+{
+ data->m_token = m_token;
+ data->m_anchorText = m_anchorText;
+ data->m_isXMLHTTPRequest = m_isXMLHTTPRequest;
+ data->m_mustHandleInternally = m_mustHandleInternally;
+ return data;
+}
+
+void ResourceRequest::doPlatformAdopt(PassOwnPtr<CrossThreadResourceRequestData> data)
+{
+ m_token = data->m_token;
+ m_anchorText = data->m_anchorText;
+ m_isXMLHTTPRequest = data->m_isXMLHTTPRequest;
+ m_mustHandleInternally = data->m_mustHandleInternally;
+ m_forceDownload = data->m_forceDownload;
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/platform/network/blackberry/ResourceResponse.h (0 => 102303)
--- trunk/Source/WebCore/platform/network/blackberry/ResourceResponse.h (rev 0)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceResponse.h 2011-12-08 03:38:23 UTC (rev 102303)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2009, 2010 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef ResourceResponse_h
+#define ResourceResponse_h
+
+#include "ResourceResponseBase.h"
+
+namespace WebCore {
+
+class ResourceResponse : public ResourceResponseBase {
+public:
+ ResourceResponse()
+ : m_isWML(false)
+ {
+ }
+
+ ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
+ : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename)
+ , m_isMultipartPayload(false)
+ , m_isWML(false)
+ {
+ }
+
+ void setIsWML(bool isWML) { m_isWML = isWML; }
+ bool isWML() const { return m_isWML; }
+
+ PassOwnPtr<CrossThreadResourceResponseData> doPlatformCopyData(PassOwnPtr<CrossThreadResourceResponseData>) const;
+ void doPlatformAdopt(PassOwnPtr<CrossThreadResourceResponseData>);
+
+ void setIsMultipartPayload(bool value) { m_isMultipartPayload = value; }
+ bool isMultipartPayload() const { return m_isMultipartPayload; }
+
+private:
+ bool m_isMultipartPayload;
+ bool m_isWML;
+};
+
+struct CrossThreadResourceResponseData : public CrossThreadResourceResponseDataBase {
+ bool m_isWML;
+};
+
+} // namespace WebCore
+
+#endif // ResourceResponse_h
Added: trunk/Source/WebCore/platform/network/blackberry/ResourceResponseBlackBerry.cpp (0 => 102303)
--- trunk/Source/WebCore/platform/network/blackberry/ResourceResponseBlackBerry.cpp (rev 0)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceResponseBlackBerry.cpp 2011-12-08 03:38:23 UTC (rev 102303)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "ResourceResponse.h"
+
+namespace WebCore {
+
+PassOwnPtr<CrossThreadResourceResponseData> ResourceResponse::doPlatformCopyData(PassOwnPtr<CrossThreadResourceResponseData> data) const
+{
+ data->m_isWML = m_isWML;
+ return data;
+}
+
+void ResourceResponse::doPlatformAdopt(PassOwnPtr<CrossThreadResourceResponseData> data)
+{
+ m_isWML = data->m_isWML;
+}
+
+} // namespace WebCore