summaryrefslogtreecommitdiffstats
path: root/content/public/renderer
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-25 21:01:58 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-25 21:01:58 +0000
commit885e54f1b299324a22f36014038d217805c15d3f (patch)
tree16879f927bb245c5e159d60a45e0e718de8120c6 /content/public/renderer
parent49261dee53235586c1a0aa6343277c575d7d9358 (diff)
downloadchromium_src-885e54f1b299324a22f36014038d217805c15d3f.zip
chromium_src-885e54f1b299324a22f36014038d217805c15d3f.tar.gz
chromium_src-885e54f1b299324a22f36014038d217805c15d3f.tar.bz2
Add ResourceFetcher to content\public\renderer.
This is needed to move the alt error page (Link Doctor) code out of content. BUG=308232 R=jam@chromium.org, ttuttle@chromium.org Review URL: https://codereview.chromium.org/72913002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237135 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public/renderer')
-rw-r--r--content/public/renderer/resource_fetcher.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/content/public/renderer/resource_fetcher.h b/content/public/renderer/resource_fetcher.h
new file mode 100644
index 0000000..5f57cb6
--- /dev/null
+++ b/content/public/renderer/resource_fetcher.h
@@ -0,0 +1,55 @@
+// Copyright 2013 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 CONTENT_PUBLIC_RENDERER_RESOURCE_FETCHER_H_
+#define CONTENT_PUBLIC_RENDERER_RESOURCE_FETCHER_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "content/common/content_export.h"
+#include "third_party/WebKit/public/platform/WebURLRequest.h"
+
+class GURL;
+
+namespace base {
+class TimeDelta;
+}
+
+namespace blink {
+class WebFrame;
+class WebURLResponse;
+}
+
+namespace content {
+
+// Interface to download resources asynchronously.
+class CONTENT_EXPORT ResourceFetcher {
+ public:
+ virtual ~ResourceFetcher() {}
+
+ // This will be called asynchronously after the URL has been fetched,
+ // successfully or not. If there is a failure, response and data will both be
+ // empty. |response| and |data| are both valid until the URLFetcher instance
+ // is destroyed.
+ typedef base::Callback<void(const blink::WebURLResponse& response,
+ const std::string& data)> Callback;
+
+ // Creates a ResourceFetcher and starts fetching the specified resource.
+ // Caller takes ownership of the returned object. Deleting the
+ // ResourceFetcher will cancel the request, and the callback will never be
+ // run.
+ static ResourceFetcher* Create(const GURL& url,
+ blink::WebFrame* frame,
+ blink::WebURLRequest::TargetType target_type,
+ const Callback& callback);
+
+ // Sets how long to wait for the server to reply. By default, there is no
+ // timeout.
+ virtual void SetTimeout(const base::TimeDelta& timeout) = 0;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_RENDERER_RESOURCE_FETCHER_H_