summaryrefslogtreecommitdiffstats
path: root/webkit/glue/weburlloader_impl.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/weburlloader_impl.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/weburlloader_impl.h')
-rw-r--r--webkit/glue/weburlloader_impl.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/webkit/glue/weburlloader_impl.h b/webkit/glue/weburlloader_impl.h
new file mode 100644
index 0000000..2ad50c3
--- /dev/null
+++ b/webkit/glue/weburlloader_impl.h
@@ -0,0 +1,61 @@
+// Copyright (c) 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.
+
+#ifndef WEBKIT_GLUE_WEBURLLOADER_IMPL_H_
+#define WEBKIT_GLUE_WEBURLLOADER_IMPL_H_
+
+#include "base/scoped_ptr.h"
+#include "base/task.h"
+#include "webkit/api/public/WebURLLoader.h"
+#include "webkit/glue/multipart_response_delegate.h"
+#include "webkit/glue/resource_loader_bridge.h"
+
+namespace webkit_glue {
+
+class WebURLLoaderImpl : public WebKit::WebURLLoader,
+ public ResourceLoaderBridge::Peer {
+ public:
+ WebURLLoaderImpl();
+ ~WebURLLoaderImpl();
+
+ // WebURLLoader methods:
+ virtual void loadSynchronously(
+ const WebKit::WebURLRequest& request,
+ WebKit::WebURLResponse& response,
+ WebKit::WebURLError& error,
+ WebKit::WebData& data);
+ virtual void loadAsynchronously(
+ const WebKit::WebURLRequest& request,
+ WebKit::WebURLLoaderClient* client);
+ virtual void cancel();
+ virtual void setDefersLoading(bool value);
+
+ // ResourceLoaderBridge::Peer methods:
+ virtual void OnUploadProgress(uint64 position, uint64 size);
+ virtual void OnReceivedRedirect(const GURL& new_url);
+ virtual void OnReceivedResponse(
+ const ResourceLoaderBridge::ResponseInfo& info, bool content_filtered);
+ virtual void OnReceivedData(const char* data, int len);
+ virtual void OnCompletedRequest(
+ const URLRequestStatus& status, const std::string& security_info);
+ virtual std::string GetURLForDebugging();
+
+ private:
+ void Start(
+ const WebKit::WebURLRequest& request,
+ ResourceLoaderBridge::SyncLoadResponse* sync_load_response);
+ void HandleDataURL();
+
+ ScopedRunnableMethodFactory<WebURLLoaderImpl> task_factory_;
+
+ GURL url_;
+ WebKit::WebURLLoaderClient* client_;
+ scoped_ptr<ResourceLoaderBridge> bridge_;
+ scoped_ptr<MultipartResponseDelegate> multipart_delegate_;
+ int64 expected_content_length_;
+};
+
+} // namespace webkit_glue
+
+#endif // WEBKIT_GLUE_WEBURLLOADER_IMPL_H_