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 #ifndef NET_URL_REQUEST_URL_FETCHER_DELEGATE_H_ | 5 #ifndef NET_URL_REQUEST_URL_FETCHER_DELEGATE_H_ |
6 #define NET_URL_REQUEST_URL_FETCHER_DELEGATE_H_ | 6 #define NET_URL_REQUEST_URL_FETCHER_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 class URLFetcher; | 16 class URLFetcher; |
17 | 17 |
18 // A delegate interface for users of URLFetcher. | 18 // A delegate interface for users of URLFetcher. |
19 class NET_EXPORT URLFetcherDelegate { | 19 class NET_EXPORT URLFetcherDelegate { |
20 public: | 20 public: |
21 // This will be called when the URL has been fetched, successfully or not. | 21 // This will be called when the URL has been fetched, successfully or not. |
22 // Use accessor methods on |source| to get the results. | 22 // Use accessor methods on |source| to get the results. |
23 virtual void OnURLFetchComplete(const URLFetcher* source) = 0; | 23 virtual void OnURLFetchComplete(const URLFetcher* source) = 0; |
24 | 24 |
25 // This will be called when some part of the response is read. |current| | 25 // This will be called when some part of the response is read. |current| |
26 // denotes the number of bytes received up to the call, and |total| is the | 26 // denotes the number of bytes received up to the call, and |total| is the |
27 // expected total size of the response (or -1 if not determined). | 27 // expected total size of the response (or -1 if not determined). |
28 virtual void OnURLFetchDownloadProgress(const URLFetcher* source, | 28 virtual void OnURLFetchDownloadProgress(const URLFetcher* source, |
29 int64 current, int64 total); | 29 int64 current, |
| 30 int64 total); |
30 | 31 |
31 // This will be called when uploading of POST or PUT requests proceeded. | 32 // This will be called when uploading of POST or PUT requests proceeded. |
32 // |current| denotes the number of bytes sent so far, and |total| is the | 33 // |current| denotes the number of bytes sent so far, and |total| is the |
33 // total size of uploading data (or -1 if chunked upload is enabled). | 34 // total size of uploading data (or -1 if chunked upload is enabled). |
34 virtual void OnURLFetchUploadProgress(const URLFetcher* source, | 35 virtual void OnURLFetchUploadProgress(const URLFetcher* source, |
35 int64 current, int64 total); | 36 int64 current, |
| 37 int64 total); |
36 | 38 |
37 protected: | 39 protected: |
38 virtual ~URLFetcherDelegate(); | 40 virtual ~URLFetcherDelegate(); |
39 }; | 41 }; |
40 | 42 |
41 } // namespace net | 43 } // namespace net |
42 | 44 |
43 #endif // NET_URL_REQUEST_URL_FETCHER_DELEGATE_H_ | 45 #endif // NET_URL_REQUEST_URL_FETCHER_DELEGATE_H_ |
OLD | NEW |