| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
| 11 // temporary situation. We will work on allowing support for multiple "io" | 11 // temporary situation. We will work on allowing support for multiple "io" |
| 12 // threads per process. | 12 // threads per process. |
| 13 | 13 |
| 14 #ifndef CONTENT_COMMON_NET_URL_FETCHER_H_ | 14 #ifndef CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ |
| 15 #define CONTENT_COMMON_NET_URL_FETCHER_H_ | 15 #define CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ |
| 16 #pragma once | 16 #pragma once |
| 17 | 17 |
| 18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
| 19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
| 20 #include "base/time.h" | 20 #include "base/time.h" |
| 21 #include "content/public/common/url_fetcher.h" | 21 #include "content/public/common/url_fetcher.h" |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class URLFetcherFactory; | 24 class URLFetcherFactory; |
| 25 } | 25 } |
| 26 | 26 |
| 27 class CONTENT_EXPORT URLFetcher : public content::URLFetcher{ | 27 class CONTENT_EXPORT URLFetcherImpl : public content::URLFetcher{ |
| 28 public: | 28 public: |
| 29 // |url| is the URL to send the request to. | 29 // |url| is the URL to send the request to. |
| 30 // |request_type| is the type of request to make. | 30 // |request_type| is the type of request to make. |
| 31 // |d| the object that will receive the callback on fetch completion. | 31 // |d| the object that will receive the callback on fetch completion. |
| 32 URLFetcher(const GURL& url, | 32 URLFetcherImpl(const GURL& url, |
| 33 RequestType request_type, | 33 RequestType request_type, |
| 34 content::URLFetcherDelegate* d); | 34 content::URLFetcherDelegate* d); |
| 35 virtual ~URLFetcher(); | 35 virtual ~URLFetcherImpl(); |
| 36 | 36 |
| 37 // content::URLFetcher implementation: | 37 // content::URLFetcher implementation: |
| 38 virtual void SetUploadData(const std::string& upload_content_type, | 38 virtual void SetUploadData(const std::string& upload_content_type, |
| 39 const std::string& upload_content) OVERRIDE; | 39 const std::string& upload_content) OVERRIDE; |
| 40 virtual void SetChunkedUpload( | 40 virtual void SetChunkedUpload( |
| 41 const std::string& upload_content_type) OVERRIDE; | 41 const std::string& upload_content_type) OVERRIDE; |
| 42 virtual void AppendChunkToUpload(const std::string& data, | 42 virtual void AppendChunkToUpload(const std::string& data, |
| 43 bool is_last_chunk) OVERRIDE; | 43 bool is_last_chunk) OVERRIDE; |
| 44 virtual void SetLoadFlags(int load_flags) OVERRIDE; | 44 virtual void SetLoadFlags(int load_flags) OVERRIDE; |
| 45 virtual int GetLoadFlags() const OVERRIDE; | 45 virtual int GetLoadFlags() const OVERRIDE; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // Sets the factory used by the static method Create to create a URLFetcher. | 111 // Sets the factory used by the static method Create to create a URLFetcher. |
| 112 // URLFetcher does not take ownership of |factory|. A value of NULL results | 112 // URLFetcher does not take ownership of |factory|. A value of NULL results |
| 113 // in a URLFetcher being created directly. | 113 // in a URLFetcher being created directly. |
| 114 // | 114 // |
| 115 // NOTE: for safety, this should only be used through ScopedURLFetcherFactory! | 115 // NOTE: for safety, this should only be used through ScopedURLFetcherFactory! |
| 116 static void set_factory(content::URLFetcherFactory* factory); | 116 static void set_factory(content::URLFetcherFactory* factory); |
| 117 | 117 |
| 118 class Core; | 118 class Core; |
| 119 scoped_refptr<Core> core_; | 119 scoped_refptr<Core> core_; |
| 120 | 120 |
| 121 DISALLOW_COPY_AND_ASSIGN(URLFetcher); | 121 DISALLOW_COPY_AND_ASSIGN(URLFetcherImpl); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 #endif // CONTENT_COMMON_NET_URL_FETCHER_H_ | 124 #endif // CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ |
| OLD | NEW |