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" |
(...skipping 10 matching lines...) Expand all Loading... |
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, int64 total); |
30 | 30 |
31 // This will be called when some part of the response is read. | |
32 // |download_data| contains the current bytes received since the last call. | |
33 // This will be called after ShouldSendDownloadData() and only if the latter | |
34 // returns true. | |
35 virtual void OnURLFetchDownloadData(const URLFetcher* source, | |
36 scoped_ptr<std::string> download_data); | |
37 | |
38 // This indicates if OnURLFetchDownloadData should be called. | |
39 // This will be called before OnURLFetchDownloadData is called, and only if | |
40 // this returns true. | |
41 // Default implementation is false. | |
42 virtual bool ShouldSendDownloadData(); | |
43 | |
44 // This will be called when uploading of POST or PUT requests proceeded. | 31 // This will be called when uploading of POST or PUT requests proceeded. |
45 // |current| denotes the number of bytes sent so far, and |total| is the | 32 // |current| denotes the number of bytes sent so far, and |total| is the |
46 // total size of uploading data (or -1 if chunked upload is enabled). | 33 // total size of uploading data (or -1 if chunked upload is enabled). |
47 virtual void OnURLFetchUploadProgress(const URLFetcher* source, | 34 virtual void OnURLFetchUploadProgress(const URLFetcher* source, |
48 int64 current, int64 total); | 35 int64 current, int64 total); |
49 | 36 |
50 protected: | 37 protected: |
51 virtual ~URLFetcherDelegate(); | 38 virtual ~URLFetcherDelegate(); |
52 }; | 39 }; |
53 | 40 |
54 } // namespace net | 41 } // namespace net |
55 | 42 |
56 #endif // NET_URL_REQUEST_URL_FETCHER_DELEGATE_H_ | 43 #endif // NET_URL_REQUEST_URL_FETCHER_DELEGATE_H_ |
OLD | NEW |