Index: net/url_request/url_fetcher.h |
diff --git a/content/public/common/url_fetcher.h b/net/url_request/url_fetcher.h |
similarity index 76% |
copy from content/public/common/url_fetcher.h |
copy to net/url_request/url_fetcher.h |
index 57266dcc189c89c75723c8006411c0e25b83200e..b5e7e5537cdd3136905c08d047419f0fedc38a1b 100644 |
--- a/content/public/common/url_fetcher.h |
+++ b/net/url_request/url_fetcher.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CONTENT_PUBLIC_COMMON_URL_FETCHER_H_ |
-#define CONTENT_PUBLIC_COMMON_URL_FETCHER_H_ |
+#ifndef NET_URL_REQUEST_URL_FETCHER_H_ |
+#define NET_URL_REQUEST_URL_FETCHER_H_ |
#pragma once |
#include <string> |
@@ -11,7 +11,7 @@ |
#include "base/memory/ref_counted.h" |
#include "base/platform_file.h" |
-#include "content/common/content_export.h" |
+#include "net/base/net_export.h" |
class FilePath; |
class GURL; |
@@ -25,14 +25,10 @@ namespace net { |
class HostPortPair; |
class HttpRequestHeaders; |
class HttpResponseHeaders; |
+class URLFetcherDelegate; |
class URLRequestContextGetter; |
class URLRequestStatus; |
typedef std::vector<std::string> ResponseCookies; |
-} |
- |
-namespace content { |
- |
-class URLFetcherDelegate; |
// To use this class, create an instance with the desired URL and a pointer to |
// the object to be notified when the URL has been loaded: |
@@ -62,7 +58,7 @@ class URLFetcherDelegate; |
// |
// NOTE: By default URLFetcher requests are NOT intercepted, except when |
// interception is explicitly enabled in tests. |
-class CONTENT_EXPORT URLFetcher { |
+class NET_EXPORT URLFetcher { |
public: |
// Imposible http response code. Used to signal that no http response code |
// was received. |
@@ -79,35 +75,7 @@ class CONTENT_EXPORT URLFetcher { |
PUT, |
}; |
- // |url| is the URL to send the request to. |
- // |request_type| is the type of request to make. |
- // |d| the object that will receive the callback on fetch completion. |
- static URLFetcher* Create(const GURL& url, |
- RequestType request_type, |
- URLFetcherDelegate* d); |
- |
- // Like above, but if there's a URLFetcherFactory registered with the |
- // implementation it will be used. |id| may be used during testing to identify |
- // who is creating the URLFetcher. |
- static URLFetcher* Create(int id, |
- const GURL& url, |
- RequestType request_type, |
- URLFetcherDelegate* d); |
- |
- // Cancels all existing URLFetchers. Will notify the URLFetcherDelegates. |
- // Note that any new URLFetchers created while this is running will not be |
- // cancelled. Typically, one would call this in the CleanUp() method of an IO |
- // thread, so that no new URLRequests would be able to start on the IO thread |
- // anyway. This doesn't prevent new URLFetchers from trying to post to the IO |
- // thread though, even though the task won't ever run. |
- static void CancelAll(); |
- |
- // Normally interception is disabled for URLFetcher, but you can use this |
- // to enable it for tests. Also see ScopedURLFetcherFactory for another way |
- // of testing code that uses an URLFetcher. |
- static void SetEnableInterceptionForTests(bool enabled); |
- |
- virtual ~URLFetcher() {} |
+ virtual ~URLFetcher(); |
// Sets data only needed by POSTs. All callers making POST requests should |
// call this before the request is started. |upload_content_type| is the MIME |
@@ -150,18 +118,12 @@ class CONTENT_EXPORT URLFetcher { |
virtual void AddExtraRequestHeader(const std::string& header_line) = 0; |
virtual void GetExtraRequestHeaders( |
- net::HttpRequestHeaders* headers) const = 0; |
+ HttpRequestHeaders* headers) const = 0; |
- // Set the net::URLRequestContext on the request. Must be called before the |
+ // Set the URLRequestContext on the request. Must be called before the |
// request is started. |
virtual void SetRequestContext( |
- net::URLRequestContextGetter* request_context_getter) = 0; |
- |
- // Mark URLRequests started by the URLFetcher to stem from the given render |
- // view. |
- virtual void AssociateWithRenderView(const GURL& first_party_for_cookies, |
- int render_process_id, |
- int render_view_id) = 0; |
+ URLRequestContextGetter* request_context_getter) = 0; |
// If |retry| is false, 5xx responses will be propagated to the observer, |
// if it is true URLFetcher will automatically re-execute the request, |
@@ -195,12 +157,12 @@ class CONTENT_EXPORT URLFetcher { |
// Retrieve the response headers from the request. Must only be called after |
// the OnURLFetchComplete callback has run. |
- virtual net::HttpResponseHeaders* GetResponseHeaders() const = 0; |
+ virtual HttpResponseHeaders* GetResponseHeaders() const = 0; |
// Retrieve the remote socket address from the request. Must only |
// be called after the OnURLFetchComplete callback has run and if |
// the request has not failed. |
- virtual net::HostPortPair GetSocketAddress() const = 0; |
+ virtual HostPortPair GetSocketAddress() const = 0; |
// Returns true if the request was delivered through a proxy. Must only |
// be called after the OnURLFetchComplete callback has run and the request |
@@ -218,14 +180,14 @@ class CONTENT_EXPORT URLFetcher { |
virtual const GURL& GetURL() const = 0; |
// The status of the URL fetch. |
- virtual const net::URLRequestStatus& GetStatus() const = 0; |
+ virtual const URLRequestStatus& GetStatus() const = 0; |
// The http response code received. Will return RESPONSE_CODE_INVALID |
// if an error prevented any response from being received. |
virtual int GetResponseCode() const = 0; |
// Cookies recieved. |
- virtual const net::ResponseCookies& GetCookies() const = 0; |
+ virtual const ResponseCookies& GetCookies() const = 0; |
// Return true if any file system operation failed. If so, set |error_code| |
// to the error code. File system errors are only possible if user called |
@@ -249,6 +211,6 @@ class CONTENT_EXPORT URLFetcher { |
FilePath* out_response_path) const = 0; |
}; |
-} // namespace content |
+} // namespace net |
-#endif // CONTENT_PUBLIC_COMMON_URL_FETCHER_H_ |
+#endif // NET_URL_REQUEST_URL_FETCHER_H_ |