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

Side by Side Diff: content/common/net/url_fetcher_core.h

Issue 10383271: Make AssociateWithRenderView() a free function in the 'content' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: actually rename fn Created 8 years, 7 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
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 CONTENT_COMMON_NET_URL_FETCHER_CORE_H_ 5 #ifndef CONTENT_COMMON_NET_URL_FETCHER_CORE_H_
6 #define CONTENT_COMMON_NET_URL_FETCHER_CORE_H_ 6 #define CONTENT_COMMON_NET_URL_FETCHER_CORE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback_forward.h"
14 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
15 #include "base/debug/stack_trace.h" 14 #include "base/debug/stack_trace.h"
16 #include "base/file_path.h" 15 #include "base/file_path.h"
17 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
18 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
20 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
21 #include "base/platform_file.h" 20 #include "base/platform_file.h"
22 #include "base/supports_user_data.h"
23 #include "base/timer.h" 21 #include "base/timer.h"
24 #include "content/public/common/url_fetcher.h" 22 #include "content/public/common/url_fetcher.h"
25 #include "googleurl/src/gurl.h" 23 #include "googleurl/src/gurl.h"
26 #include "net/base/host_port_pair.h" 24 #include "net/base/host_port_pair.h"
27 #include "net/http/http_request_headers.h" 25 #include "net/http/http_request_headers.h"
26 #include "net/url_request/url_fetcher.h"
28 #include "net/url_request/url_request.h" 27 #include "net/url_request/url_request.h"
29 #include "net/url_request/url_request_status.h" 28 #include "net/url_request/url_request_status.h"
30 29
31 namespace base { 30 namespace base {
32 class MessageLoopProxy; 31 class MessageLoopProxy;
33 } // namespace base 32 } // namespace base
34 33
35 namespace net { 34 namespace net {
36 class HttpResponseHeaders; 35 class HttpResponseHeaders;
37 class IOBuffer; 36 class IOBuffer;
38 class URLRequestContextGetter; 37 class URLRequestContextGetter;
39 class URLRequestThrottlerEntryInterface; 38 class URLRequestThrottlerEntryInterface;
40 } // namespace net 39 } // namespace net
41 40
42 namespace content { 41 namespace content {
43 42
44 class URLFetcherDelegate; 43 class URLFetcherDelegate;
45 44
46 class URLFetcherCore 45 class URLFetcherCore
47 : public base::RefCountedThreadSafe<URLFetcherCore>, 46 : public base::RefCountedThreadSafe<URLFetcherCore>,
48 public net::URLRequest::Delegate { 47 public net::URLRequest::Delegate {
49 public: 48 public:
50 // Used by SetURLRequestUserData. The callback should make a fresh
51 // Data* object every time it's called.
52 typedef base::Callback<base::SupportsUserData::Data*()> CreateDataCallback;
53
54 URLFetcherCore(URLFetcher* fetcher, 49 URLFetcherCore(URLFetcher* fetcher,
55 const GURL& original_url, 50 const GURL& original_url,
56 URLFetcher::RequestType request_type, 51 URLFetcher::RequestType request_type,
57 URLFetcherDelegate* d); 52 URLFetcherDelegate* d);
58 53
59 // Starts the load. It's important that this not happen in the constructor 54 // Starts the load. It's important that this not happen in the constructor
60 // because it causes the IO thread to begin AddRef()ing and Release()ing 55 // because it causes the IO thread to begin AddRef()ing and Release()ing
61 // us. If our caller hasn't had time to fully construct us and take a 56 // us. If our caller hasn't had time to fully construct us and take a
62 // reference, the IO thread could interrupt things, run a task, Release() 57 // reference, the IO thread could interrupt things, run a task, Release()
63 // us, and destroy us, leaving the caller with an already-destroyed object 58 // us, and destroy us, leaving the caller with an already-destroyed object
(...skipping 16 matching lines...) Expand all
80 void AppendChunkToUpload(const std::string& data, bool is_last_chunk); 75 void AppendChunkToUpload(const std::string& data, bool is_last_chunk);
81 // |flags| are flags to apply to the load operation--these should be 76 // |flags| are flags to apply to the load operation--these should be
82 // one or more of the LOAD_* flags defined in net/base/load_flags.h. 77 // one or more of the LOAD_* flags defined in net/base/load_flags.h.
83 void SetLoadFlags(int load_flags); 78 void SetLoadFlags(int load_flags);
84 int GetLoadFlags() const; 79 int GetLoadFlags() const;
85 void SetReferrer(const std::string& referrer); 80 void SetReferrer(const std::string& referrer);
86 void SetExtraRequestHeaders(const std::string& extra_request_headers); 81 void SetExtraRequestHeaders(const std::string& extra_request_headers);
87 void AddExtraRequestHeader(const std::string& header_line); 82 void AddExtraRequestHeader(const std::string& header_line);
88 void GetExtraRequestHeaders(net::HttpRequestHeaders* headers) const; 83 void GetExtraRequestHeaders(net::HttpRequestHeaders* headers) const;
89 void SetRequestContext(net::URLRequestContextGetter* request_context_getter); 84 void SetRequestContext(net::URLRequestContextGetter* request_context_getter);
85 // Set the URL that should be consulted for the third-party cookie
86 // blocking policy.
90 void SetFirstPartyForCookies(const GURL& first_party_for_cookies); 87 void SetFirstPartyForCookies(const GURL& first_party_for_cookies);
91 // Whenever a URLRequest object is created, SetUserData() will be 88 // Set the key and data callback that is used when setting the user
92 // called on it with the given key and the result of the given 89 // data on any URLRequest objects this object creates.
93 // callback.
94 void SetURLRequestUserData( 90 void SetURLRequestUserData(
95 const void* key, const CreateDataCallback& create_data_callback); 91 const void* key,
92 const net::URLFetcher::CreateDataCallback& create_data_callback);
96 void SetAutomaticallyRetryOn5xx(bool retry); 93 void SetAutomaticallyRetryOn5xx(bool retry);
97 void SetMaxRetries(int max_retries); 94 void SetMaxRetries(int max_retries);
98 int GetMaxRetries() const; 95 int GetMaxRetries() const;
99 base::TimeDelta GetBackoffDelay() const; 96 base::TimeDelta GetBackoffDelay() const;
100 void SaveResponseToFileAtPath( 97 void SaveResponseToFileAtPath(
101 const FilePath& file_path, 98 const FilePath& file_path,
102 scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy); 99 scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy);
103 void SaveResponseToTemporaryFile( 100 void SaveResponseToTemporaryFile(
104 scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy); 101 scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy);
105 net::HttpResponseHeaders* GetResponseHeaders() const; 102 net::HttpResponseHeaders* GetResponseHeaders() const;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 int response_code_; // HTTP status code for the request 315 int response_code_; // HTTP status code for the request
319 std::string data_; // Results of the request, when we are 316 std::string data_; // Results of the request, when we are
320 // storing the response as a string. 317 // storing the response as a string.
321 scoped_refptr<net::IOBuffer> buffer_; 318 scoped_refptr<net::IOBuffer> buffer_;
322 // Read buffer 319 // Read buffer
323 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 320 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
324 // Cookie/cache info for the request 321 // Cookie/cache info for the request
325 GURL first_party_for_cookies_; // The first party URL for the request 322 GURL first_party_for_cookies_; // The first party URL for the request
326 // The user data to add to each newly-created URLRequest. 323 // The user data to add to each newly-created URLRequest.
327 const void* url_request_data_key_; 324 const void* url_request_data_key_;
328 CreateDataCallback url_request_create_data_callback_; 325 net::URLFetcher::CreateDataCallback url_request_create_data_callback_;
329 net::ResponseCookies cookies_; // Response cookies 326 net::ResponseCookies cookies_; // Response cookies
330 net::HttpRequestHeaders extra_request_headers_; 327 net::HttpRequestHeaders extra_request_headers_;
331 scoped_refptr<net::HttpResponseHeaders> response_headers_; 328 scoped_refptr<net::HttpResponseHeaders> response_headers_;
332 bool was_fetched_via_proxy_; 329 bool was_fetched_via_proxy_;
333 net::HostPortPair socket_address_; 330 net::HostPortPair socket_address_;
334 331
335 std::string upload_content_; // HTTP POST payload 332 std::string upload_content_; // HTTP POST payload
336 std::string upload_content_type_; // MIME type of POST payload 333 std::string upload_content_type_; // MIME type of POST payload
337 std::string referrer_; // HTTP Referer header value 334 std::string referrer_; // HTTP Referer header value
338 bool is_chunked_upload_; // True if using chunked transfer encoding 335 bool is_chunked_upload_; // True if using chunked transfer encoding
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 base::debug::StackTrace stack_trace_; 396 base::debug::StackTrace stack_trace_;
400 397
401 static base::LazyInstance<Registry> g_registry; 398 static base::LazyInstance<Registry> g_registry;
402 399
403 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); 400 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore);
404 }; 401 };
405 402
406 } // namespace content 403 } // namespace content
407 404
408 #endif // CONTENT_COMMON_NET_URL_FETCHER_CORE_H_ 405 #endif // CONTENT_COMMON_NET_URL_FETCHER_CORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | content/common/net/url_fetcher_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698