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