OLD | NEW |
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 // This file contains URLFetcher, a wrapper around net::URLRequest that handles | 5 // This file contains URLFetcher, a wrapper around net::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 // NOTE(willchan): Only one "IO" thread is supported for URLFetcher. This is a | 10 // NOTE(willchan): Only one "IO" thread is supported for URLFetcher. This is a |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 virtual bool GetResponseAsFilePath( | 76 virtual bool GetResponseAsFilePath( |
77 bool take_ownership, | 77 bool take_ownership, |
78 FilePath* out_response_path) const OVERRIDE; | 78 FilePath* out_response_path) const OVERRIDE; |
79 | 79 |
80 static void CancelAll(); | 80 static void CancelAll(); |
81 | 81 |
82 protected: | 82 protected: |
83 // How should the response be stored? | 83 // How should the response be stored? |
84 enum ResponseDestinationType { | 84 enum ResponseDestinationType { |
85 STRING, // Default: In a std::string | 85 STRING, // Default: In a std::string |
86 TEMP_FILE // Write to a temp file | 86 FILE // Write to a file |
87 }; | 87 }; |
88 | 88 |
89 // Returns the delegate. | 89 // Returns the delegate. |
90 content::URLFetcherDelegate* delegate() const; | 90 content::URLFetcherDelegate* delegate() const; |
91 | 91 |
92 // Used by tests. | 92 // Used by tests. |
93 const std::string& upload_data() const; | 93 const std::string& upload_data() const; |
94 | 94 |
95 // Used by tests. | 95 // Used by tests. |
96 void set_was_fetched_via_proxy(bool flag); | 96 void set_was_fetched_via_proxy(bool flag); |
(...skipping 19 matching lines...) Expand all Loading... |
116 // NOTE: for safety, this should only be used through ScopedURLFetcherFactory! | 116 // NOTE: for safety, this should only be used through ScopedURLFetcherFactory! |
117 static void set_factory(content::URLFetcherFactory* factory); | 117 static void set_factory(content::URLFetcherFactory* factory); |
118 | 118 |
119 class Core; | 119 class Core; |
120 scoped_refptr<Core> core_; | 120 scoped_refptr<Core> core_; |
121 | 121 |
122 DISALLOW_COPY_AND_ASSIGN(URLFetcherImpl); | 122 DISALLOW_COPY_AND_ASSIGN(URLFetcherImpl); |
123 }; | 123 }; |
124 | 124 |
125 #endif // CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ | 125 #endif // CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ |
OLD | NEW |