Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: net/url_request/url_fetcher.h

Issue 10554008: Move content::URLFetcher static functions to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win link error Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/public/common/url_fetcher.h ('k') | net/url_request/url_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_URL_REQUEST_URL_FETCHER_H_ 5 #ifndef NET_URL_REQUEST_URL_FETCHER_H_
6 #define NET_URL_REQUEST_URL_FETCHER_H_ 6 #define NET_URL_REQUEST_URL_FETCHER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // <winnt.h> defines a DELETE macro. 76 // <winnt.h> defines a DELETE macro.
77 PUT, 77 PUT,
78 }; 78 };
79 79
80 // Used by SetURLRequestUserData. The callback should make a fresh 80 // Used by SetURLRequestUserData. The callback should make a fresh
81 // base::SupportsUserData::Data object every time it's called. 81 // base::SupportsUserData::Data object every time it's called.
82 typedef base::Callback<base::SupportsUserData::Data*()> CreateDataCallback; 82 typedef base::Callback<base::SupportsUserData::Data*()> CreateDataCallback;
83 83
84 virtual ~URLFetcher(); 84 virtual ~URLFetcher();
85 85
86 // |url| is the URL to send the request to.
87 // |request_type| is the type of request to make.
88 // |d| the object that will receive the callback on fetch completion.
89 static URLFetcher* Create(const GURL& url,
90 URLFetcher::RequestType request_type,
91 URLFetcherDelegate* d);
92
93 // Like above, but if there's a URLFetcherFactory registered with the
94 // implementation it will be used. |id| may be used during testing to identify
95 // who is creating the URLFetcher.
96 static URLFetcher* Create(int id,
97 const GURL& url,
98 URLFetcher::RequestType request_type,
99 URLFetcherDelegate* d);
100
101 // Cancels all existing URLFetchers. Will notify the URLFetcherDelegates.
102 // Note that any new URLFetchers created while this is running will not be
103 // cancelled. Typically, one would call this in the CleanUp() method of an IO
104 // thread, so that no new URLRequests would be able to start on the IO thread
105 // anyway. This doesn't prevent new URLFetchers from trying to post to the IO
106 // thread though, even though the task won't ever run.
107 static void CancelAll();
108
109 // Normally interception is disabled for URLFetcher, but you can use this
110 // to enable it for tests. Also see ScopedURLFetcherFactory for another way
111 // of testing code that uses an URLFetcher.
112 static void SetEnableInterceptionForTests(bool enabled);
113
86 // Sets data only needed by POSTs. All callers making POST requests should 114 // Sets data only needed by POSTs. All callers making POST requests should
87 // call this before the request is started. |upload_content_type| is the MIME 115 // call this before the request is started. |upload_content_type| is the MIME
88 // type of the content, while |upload_content| is the data to be sent (the 116 // type of the content, while |upload_content| is the data to be sent (the
89 // Content-Length header value will be set to the length of this data). 117 // Content-Length header value will be set to the length of this data).
90 virtual void SetUploadData(const std::string& upload_content_type, 118 virtual void SetUploadData(const std::string& upload_content_type,
91 const std::string& upload_content) = 0; 119 const std::string& upload_content) = 0;
92 120
93 // Indicates that the POST data is sent via chunked transfer encoding. 121 // Indicates that the POST data is sent via chunked transfer encoding.
94 // This may only be called before calling Start(). 122 // This may only be called before calling Start().
95 // Use AppendChunkToUpload() to give the data chunks after calling Start(). 123 // Use AppendChunkToUpload() to give the data chunks after calling Start().
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // true, caller takes responsibility for the file, and it will not 259 // true, caller takes responsibility for the file, and it will not
232 // be removed once the URLFetcher is destroyed. User should not take 260 // be removed once the URLFetcher is destroyed. User should not take
233 // ownership more than once, or call this method after taking ownership. 261 // ownership more than once, or call this method after taking ownership.
234 virtual bool GetResponseAsFilePath(bool take_ownership, 262 virtual bool GetResponseAsFilePath(bool take_ownership,
235 FilePath* out_response_path) const = 0; 263 FilePath* out_response_path) const = 0;
236 }; 264 };
237 265
238 } // namespace net 266 } // namespace net
239 267
240 #endif // NET_URL_REQUEST_URL_FETCHER_H_ 268 #endif // NET_URL_REQUEST_URL_FETCHER_H_
OLDNEW
« no previous file with comments | « content/public/common/url_fetcher.h ('k') | net/url_request/url_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698