| 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 |
| 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_IMPL_H_ | 14 #ifndef CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ |
| 15 #define CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ | 15 #define CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ |
| 16 #pragma once | 16 #pragma once |
| 17 | 17 |
| 18 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
| 19 #include "base/compiler_specific.h" | 19 #include "base/compiler_specific.h" |
| 20 #include "content/common/content_export.h" | 20 #include "content/common/content_export.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 URLFetcherCore; | 24 class URLFetcherCore; |
| 25 class URLFetcherDelegate; | 25 class URLFetcherDelegate; |
| 26 class URLFetcherFactory; | 26 class URLFetcherFactory; |
| 27 } // namespace content | 27 } // namespace content |
| 28 | 28 |
| 29 class CONTENT_EXPORT URLFetcherImpl : public content::URLFetcher { | 29 class CONTENT_EXPORT URLFetcherImpl : public net::URLFetcher { |
| 30 public: | 30 public: |
| 31 // |url| is the URL to send the request to. | 31 // |url| is the URL to send the request to. |
| 32 // |request_type| is the type of request to make. | 32 // |request_type| is the type of request to make. |
| 33 // |d| the object that will receive the callback on fetch completion. | 33 // |d| the object that will receive the callback on fetch completion. |
| 34 URLFetcherImpl(const GURL& url, | 34 URLFetcherImpl(const GURL& url, |
| 35 RequestType request_type, | 35 RequestType request_type, |
| 36 net::URLFetcherDelegate* d); | 36 net::URLFetcherDelegate* d); |
| 37 virtual ~URLFetcherImpl(); | 37 virtual ~URLFetcherImpl(); |
| 38 | 38 |
| 39 // content::URLFetcher implementation: | 39 // net::URLFetcher implementation: |
| 40 virtual void SetUploadData(const std::string& upload_content_type, | 40 virtual void SetUploadData(const std::string& upload_content_type, |
| 41 const std::string& upload_content) OVERRIDE; | 41 const std::string& upload_content) OVERRIDE; |
| 42 virtual void SetChunkedUpload( | 42 virtual void SetChunkedUpload( |
| 43 const std::string& upload_content_type) OVERRIDE; | 43 const std::string& upload_content_type) OVERRIDE; |
| 44 virtual void AppendChunkToUpload(const std::string& data, | 44 virtual void AppendChunkToUpload(const std::string& data, |
| 45 bool is_last_chunk) OVERRIDE; | 45 bool is_last_chunk) OVERRIDE; |
| 46 virtual void SetLoadFlags(int load_flags) OVERRIDE; | 46 virtual void SetLoadFlags(int load_flags) OVERRIDE; |
| 47 virtual int GetLoadFlags() const OVERRIDE; | 47 virtual int GetLoadFlags() const OVERRIDE; |
| 48 virtual void SetReferrer(const std::string& referrer) OVERRIDE; | 48 virtual void SetReferrer(const std::string& referrer) OVERRIDE; |
| 49 virtual void SetExtraRequestHeaders( | 49 virtual void SetExtraRequestHeaders( |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // | 108 // |
| 109 // NOTE: for safety, this should only be used through ScopedURLFetcherFactory! | 109 // NOTE: for safety, this should only be used through ScopedURLFetcherFactory! |
| 110 static void set_factory(content::URLFetcherFactory* factory); | 110 static void set_factory(content::URLFetcherFactory* factory); |
| 111 | 111 |
| 112 const scoped_refptr<content::URLFetcherCore> core_; | 112 const scoped_refptr<content::URLFetcherCore> core_; |
| 113 | 113 |
| 114 DISALLOW_COPY_AND_ASSIGN(URLFetcherImpl); | 114 DISALLOW_COPY_AND_ASSIGN(URLFetcherImpl); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 #endif // CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ | 117 #endif // CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ |
| OLD | NEW |