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

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

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « net/url_request/url_fetcher_factory.h ('k') | net/url_request/url_fetcher_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // This file contains URLFetcher, a wrapper around URLRequest that handles
6 // low-level details like thread safety, ref counting, and incremental buffer
7 // reading. This is useful for callers who simply want to get the data from a
8 // URL and don't care about all the nitty-gritty details.
9 //
10 // NOTE(willchan): Only one "IO" thread is supported for URLFetcher. This is a
11 // temporary situation. We will work on allowing support for multiple "io"
12 // threads per process.
13
14 #ifndef NET_URL_REQUEST_URL_FETCHER_IMPL_H_
15 #define NET_URL_REQUEST_URL_FETCHER_IMPL_H_
16
17 #include <string>
18
19 #include "base/basictypes.h"
20 #include "base/compiler_specific.h"
21 #include "net/base/net_export.h"
22 #include "net/url_request/url_fetcher.h"
23
24 namespace net {
25 class URLFetcherCore;
26 class URLFetcherDelegate;
27 class URLFetcherFactory;
28
29 class NET_EXPORT_PRIVATE URLFetcherImpl : public URLFetcher {
30 public:
31 // |url| is the URL to send the request to.
32 // |request_type| is the type of request to make.
33 // |d| the object that will receive the callback on fetch completion.
34 URLFetcherImpl(const GURL& url,
35 RequestType request_type,
36 URLFetcherDelegate* d);
37 ~URLFetcherImpl() override;
38
39 // URLFetcher implementation:
40 void SetUploadData(const std::string& upload_content_type,
41 const std::string& upload_content) override;
42 void SetUploadFilePath(
43 const std::string& upload_content_type,
44 const base::FilePath& file_path,
45 uint64 range_offset,
46 uint64 range_length,
47 scoped_refptr<base::TaskRunner> file_task_runner) override;
48 void SetUploadStreamFactory(
49 const std::string& upload_content_type,
50 const CreateUploadStreamCallback& callback) override;
51 void SetChunkedUpload(const std::string& upload_content_type) override;
52 void AppendChunkToUpload(const std::string& data,
53 bool is_last_chunk) override;
54 void SetLoadFlags(int load_flags) override;
55 int GetLoadFlags() const override;
56 void SetReferrer(const std::string& referrer) override;
57 void SetReferrerPolicy(URLRequest::ReferrerPolicy referrer_policy) override;
58 void SetExtraRequestHeaders(
59 const std::string& extra_request_headers) override;
60 void AddExtraRequestHeader(const std::string& header_line) override;
61 void SetRequestContext(
62 URLRequestContextGetter* request_context_getter) override;
63 void SetFirstPartyForCookies(const GURL& first_party_for_cookies) override;
64 void SetURLRequestUserData(
65 const void* key,
66 const CreateDataCallback& create_data_callback) override;
67 void SetStopOnRedirect(bool stop_on_redirect) override;
68 void SetAutomaticallyRetryOn5xx(bool retry) override;
69 void SetMaxRetriesOn5xx(int max_retries) override;
70 int GetMaxRetriesOn5xx() const override;
71 base::TimeDelta GetBackoffDelay() const override;
72 void SetAutomaticallyRetryOnNetworkChanges(int max_retries) override;
73 void SaveResponseToFileAtPath(
74 const base::FilePath& file_path,
75 scoped_refptr<base::SequencedTaskRunner> file_task_runner) override;
76 void SaveResponseToTemporaryFile(
77 scoped_refptr<base::SequencedTaskRunner> file_task_runner) override;
78 void SaveResponseWithWriter(
79 scoped_ptr<URLFetcherResponseWriter> response_writer) override;
80 HttpResponseHeaders* GetResponseHeaders() const override;
81 HostPortPair GetSocketAddress() const override;
82 bool WasFetchedViaProxy() const override;
83 void Start() override;
84 const GURL& GetOriginalURL() const override;
85 const GURL& GetURL() const override;
86 const URLRequestStatus& GetStatus() const override;
87 int GetResponseCode() const override;
88 const ResponseCookies& GetCookies() const override;
89 void ReceivedContentWasMalformed() override;
90 bool GetResponseAsString(std::string* out_response_string) const override;
91 bool GetResponseAsFilePath(bool take_ownership,
92 base::FilePath* out_response_path) const override;
93
94 static void CancelAll();
95
96 static void SetIgnoreCertificateRequests(bool ignored);
97
98 // TODO(akalin): Make these private again once URLFetcher::Create()
99 // is in net/.
100
101 static URLFetcherFactory* factory();
102
103 // Sets the factory used by the static method Create to create a URLFetcher.
104 // URLFetcher does not take ownership of |factory|. A value of NULL results
105 // in a URLFetcher being created directly.
106 //
107 // NOTE: for safety, this should only be used through ScopedURLFetcherFactory!
108 static void set_factory(URLFetcherFactory* factory);
109
110 protected:
111 // Returns the delegate.
112 URLFetcherDelegate* delegate() const;
113
114 private:
115 friend class URLFetcherTest;
116
117 // Only used by URLFetcherTest, returns the number of URLFetcher::Core objects
118 // actively running.
119 static int GetNumFetcherCores();
120
121 const scoped_refptr<URLFetcherCore> core_;
122
123 DISALLOW_COPY_AND_ASSIGN(URLFetcherImpl);
124 };
125
126 } // namespace net
127
128 #endif // NET_URL_REQUEST_URL_FETCHER_IMPL_H_
OLDNEW
« no previous file with comments | « net/url_request/url_fetcher_factory.h ('k') | net/url_request/url_fetcher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698