summaryrefslogtreecommitdiffstats
path: root/webkit/glue/multipart_response_delegate.h
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-30 21:16:51 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-30 21:16:51 +0000
commit35cb9e1d4ad928a981a305a8f1d1d805c65e0cd5 (patch)
treeff56ff6e26a5a926bfaeb080c6c5bea124c2a87a /webkit/glue/multipart_response_delegate.h
parent335fb4f3221673af83ecae7414b666bfecf42e2b (diff)
downloadchromium_src-35cb9e1d4ad928a981a305a8f1d1d805c65e0cd5.zip
chromium_src-35cb9e1d4ad928a981a305a8f1d1d805c65e0cd5.tar.gz
chromium_src-35cb9e1d4ad928a981a305a8f1d1d805c65e0cd5.tar.bz2
Start using WebURLLoader, et. al. from the WebKit API.
Moves our ResourceHandle to webkit/api/src/ResourceHandle.cpp from webkit/glue/resource_handle_impl.cc. A portion of resource_handle_impl.cc was moved into weburlloader_impl.{h,cc}, which now contains our implementation of WebURLLoader. The annoying parts of this CL involve WebPluginImpl. I had to convert it over to using WebURLLoader instead of ResourceHandle so that MultipartResourceDelegate can be shared. There is some complexity in WebURLRequest / WebURLResponse to make it cheap to wrap a ResourceRequest / ResourceResponse. I think this is worth it since there is a lot of conversion between the two types. BUG=10038 TEST=covered by existing tests R=dglazkov Review URL: http://codereview.chromium.org/113928 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17290 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/multipart_response_delegate.h')
-rw-r--r--webkit/glue/multipart_response_delegate.h57
1 files changed, 31 insertions, 26 deletions
diff --git a/webkit/glue/multipart_response_delegate.h b/webkit/glue/multipart_response_delegate.h
index 41d09c2..3676a78 100644
--- a/webkit/glue/multipart_response_delegate.h
+++ b/webkit/glue/multipart_response_delegate.h
@@ -1,11 +1,10 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// A delegate class of ResourceHandleInternal (resource_handle_win) that
-// handles multipart/x-mixed-replace data. We special case
-// multipart/x-mixed-replace because WebCore expects a separate
-// didReceiveResponse for each new message part.
+// A delegate class of WebURLLoaderImpl that handles multipart/x-mixed-replace
+// data. We special case multipart/x-mixed-replace because WebCore expects a
+// separate didReceiveResponse for each new message part.
//
// Most of the logic and edge case handling are based on the Mozilla's
// implementation in netwerk/streamconv/converters/nsMultiMixedConv.cpp.
@@ -47,28 +46,28 @@
*
* ***** END LICENSE BLOCK ***** */
+#ifndef WEBKIT_GLUE_MULTIPART_RESPONSE_DELEGATE_H_
+#define WEBKIT_GLUE_MULTIPART_RESPONSE_DELEGATE_H_
+
#include <string>
-#include "config.h"
+#include "webkit/api/public/WebURLResponse.h"
-#include "base/compiler_specific.h"
+namespace WebKit {
+class WebURLLoader;
+class WebURLLoaderClient;
+}
-MSVC_PUSH_WARNING_LEVEL(0);
-#include "ResourceResponse.h"
-MSVC_POP_WARNING();
+namespace webkit_glue {
-namespace WebCore {
- class ResourceHandle;
- class ResourceHandleClient;
-}
+// Used by unit tests to access private members.
+class MultipartResponseDelegateTester;
class MultipartResponseDelegate {
- friend class MultipartResponseTest_Functions_Test; // For unittests.
-
public:
- MultipartResponseDelegate(WebCore::ResourceHandleClient* client,
- WebCore::ResourceHandle* job,
- const WebCore::ResourceResponse& response,
+ MultipartResponseDelegate(WebKit::WebURLLoaderClient* client,
+ WebKit::WebURLLoader* loader,
+ const WebKit::WebURLResponse& response,
const std::string& boundary);
// Passed through from ResourceHandleInternal
@@ -78,25 +77,27 @@ class MultipartResponseDelegate {
// Returns the multi part boundary string from the Content-type header
// in the response.
// Returns true on success.
- static bool ReadMultipartBoundary(const WebCore::ResourceResponse& response,
+ static bool ReadMultipartBoundary(const WebKit::WebURLResponse& response,
std::string* multipart_boundary);
// Returns the lower and higher content ranges from an individual multipart
// in a multipart response.
// Returns true on success.
- static bool ReadContentRanges(const WebCore::ResourceResponse& response,
+ static bool ReadContentRanges(const WebKit::WebURLResponse& response,
int* content_range_lower_bound,
int* content_range_upper_bound);
private:
- // Pointers back to our owning object so we can make callbacks as we parse
- // pieces of data.
- WebCore::ResourceHandleClient* client_;
- WebCore::ResourceHandle* job_;
+ friend class MultipartResponseDelegateTester; // For unittests.
+
+ // Pointers to the client and associated loader so we can make callbacks as
+ // we parse pieces of data.
+ WebKit::WebURLLoaderClient* client_;
+ WebKit::WebURLLoader* loader_;
// The original resource response for this request. We use this as a
// starting point for each parts response.
- WebCore::ResourceResponse original_response_;
+ WebKit::WebURLResponse original_response_;
// Checks to see if data[pos] character is a line break; handles crlf, lflf,
// lf, or cr. Returns the number of characters to skip over (0, 1 or 2).
@@ -128,3 +129,7 @@ class MultipartResponseDelegate {
// processing AddData requests.
bool stop_sending_;
};
+
+} // namespace webkit_glue
+
+#endif