| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // This file contains URLFetcher, a wrapper around URLRequest that handles | 5 // This file contains URLFetcher, a wrapper around URLRequest that handles |
| 6 // low-level details like thread safety, ref counting, and incremental buffer | 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 | 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. | 8 // URL and don't care about all the nitty-gritty details. |
| 9 | 9 |
| 10 #ifndef CHROME_BROWSER_URL_FETCHER_H_ | 10 #ifndef CHROME_BROWSER_URL_FETCHER_H_ |
| 11 #define CHROME_BROWSER_URL_FETCHER_H_ | 11 #define CHROME_BROWSER_URL_FETCHER_H_ |
| 12 | 12 |
| 13 #include "base/leak_tracker.h" | 13 #include "base/leak_tracker.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
| 16 #include "chrome/browser/net/url_fetcher_protect.h" | 16 #include "chrome/browser/net/url_fetcher_protect.h" |
| 17 | 17 |
| 18 class GURL; | 18 class GURL; |
| 19 typedef std::vector<std::string> ResponseCookies; | 19 typedef std::vector<std::string> ResponseCookies; |
| 20 class URLFetcher; | 20 class URLFetcher; |
| 21 class URLRequestContext; | 21 class URLRequestContextGetter; |
| 22 class URLRequestStatus; | 22 class URLRequestStatus; |
| 23 | 23 |
| 24 namespace net { | 24 namespace net { |
| 25 class HttpResponseHeaders; | 25 class HttpResponseHeaders; |
| 26 } | 26 } |
| 27 | 27 |
| 28 // To use this class, create an instance with the desired URL and a pointer to | 28 // To use this class, create an instance with the desired URL and a pointer to |
| 29 // the object to be notified when the URL has been loaded: | 29 // the object to be notified when the URL has been loaded: |
| 30 // URLFetcher* fetcher = new URLFetcher("http://www.google.com", this); | 30 // URLFetcher* fetcher = new URLFetcher("http://www.google.com", this); |
| 31 // | 31 // |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 // Returns the current load flags. | 137 // Returns the current load flags. |
| 138 int load_flags() const; | 138 int load_flags() const; |
| 139 | 139 |
| 140 // Set extra headers on the request. Must be called before the request | 140 // Set extra headers on the request. Must be called before the request |
| 141 // is started. | 141 // is started. |
| 142 void set_extra_request_headers(const std::string& extra_request_headers); | 142 void set_extra_request_headers(const std::string& extra_request_headers); |
| 143 | 143 |
| 144 // Set the URLRequestContext on the request. Must be called before the | 144 // Set the URLRequestContext on the request. Must be called before the |
| 145 // request is started. | 145 // request is started. |
| 146 void set_request_context(URLRequestContext* request_context); | 146 void set_request_context(URLRequestContextGetter* request_context_getter); |
| 147 | 147 |
| 148 // Retrieve the response headers from the request. Must only be called after | 148 // Retrieve the response headers from the request. Must only be called after |
| 149 // the OnURLFetchComplete callback has run. | 149 // the OnURLFetchComplete callback has run. |
| 150 net::HttpResponseHeaders* response_headers() const; | 150 net::HttpResponseHeaders* response_headers() const; |
| 151 | 151 |
| 152 // Start the request. After this is called, you may not change any other | 152 // Start the request. After this is called, you may not change any other |
| 153 // settings. | 153 // settings. |
| 154 virtual void Start(); | 154 virtual void Start(); |
| 155 | 155 |
| 156 // Return the URL that this fetcher is processing. | 156 // Return the URL that this fetcher is processing. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 176 static Factory* factory_; | 176 static Factory* factory_; |
| 177 | 177 |
| 178 base::LeakTracker<URLFetcher> leak_tracker_; | 178 base::LeakTracker<URLFetcher> leak_tracker_; |
| 179 | 179 |
| 180 static bool g_interception_enabled; | 180 static bool g_interception_enabled; |
| 181 | 181 |
| 182 DISALLOW_EVIL_CONSTRUCTORS(URLFetcher); | 182 DISALLOW_EVIL_CONSTRUCTORS(URLFetcher); |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 #endif // CHROME_BROWSER_URL_FETCHER_H_ | 185 #endif // CHROME_BROWSER_URL_FETCHER_H_ |
| OLD | NEW |