OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 27 matching lines...) Expand all Loading... | |
38 | 38 |
39 class WebURLLoader; | 39 class WebURLLoader; |
40 class WebURLRequest; | 40 class WebURLRequest; |
41 class WebURLResponse; | 41 class WebURLResponse; |
42 struct WebURLError; | 42 struct WebURLError; |
43 | 43 |
44 class BLINK_PLATFORM_EXPORT WebURLLoaderClient { | 44 class BLINK_PLATFORM_EXPORT WebURLLoaderClient { |
45 public: | 45 public: |
46 // Called when following a redirect. |newRequest| contains the request | 46 // Called when following a redirect. |newRequest| contains the request |
47 // generated by the redirect. The client may modify |newRequest|. | 47 // generated by the redirect. The client may modify |newRequest|. |
48 // |encodedDataLength| is the size of the data that came from the network | |
49 // for this redirect, or zero if the redirect was served from cache. | |
48 virtual void willFollowRedirect( | 50 virtual void willFollowRedirect( |
49 WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirect Response) { } | 51 WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirect Response, int64_t encodedDataLength) {} |
50 | 52 |
51 // Called to report upload progress. The bytes reported correspond to | 53 // Called to report upload progress. The bytes reported correspond to |
52 // the HTTP message body. | 54 // the HTTP message body. |
53 virtual void didSendData( | 55 virtual void didSendData( |
54 WebURLLoader*, unsigned long long bytesSent, unsigned long long totalByt esToBeSent) { } | 56 WebURLLoader*, unsigned long long bytesSent, unsigned long long totalByt esToBeSent) { } |
55 | 57 |
56 // Called when response headers are received. | 58 // Called when response headers are received. |
57 virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) { } | 59 virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) { } |
58 | 60 |
59 // Called when response headers are received. | 61 // Called when response headers are received. |
60 // The ownership of |handle| is transferred to the callee. | 62 // The ownership of |handle| is transferred to the callee. |
61 virtual void didReceiveResponse(WebURLLoader* loader, const WebURLResponse& response, WebDataConsumerHandle* handle) | 63 virtual void didReceiveResponse(WebURLLoader* loader, const WebURLResponse& response, WebDataConsumerHandle* handle) |
62 { | 64 { |
63 delete handle; | 65 delete handle; |
64 didReceiveResponse(loader, response); | 66 didReceiveResponse(loader, response); |
65 } | 67 } |
66 | 68 |
67 // Called when a chunk of response data is downloaded. This is only called | 69 // Called when a chunk of response data is downloaded. This is only called |
68 // if WebURLRequest's downloadToFile flag was set to true. | 70 // if WebURLRequest's downloadToFile flag was set to true. |
69 virtual void didDownloadData(WebURLLoader*, int dataLength, int encodedDataL ength) { } | 71 virtual void didDownloadData(WebURLLoader*, int dataLength, int encodedDataL ength) { } |
70 | 72 |
71 // Called when a chunk of response data is received. | 73 // Called when a chunk of response data is received. |dataLength| is the |
72 virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength, int encodedDataLength) { } | 74 // number of bytes pointed to by |data|. |encodedDataLength| is the number |
75 // of bytes actually received from network to serve this chunk, including | |
76 // HTTP headers and framing if relevant. It is 0 if the response was served | |
77 // from cache, and -1 if this information is unavailable. | |
kinuko
2016/07/07 05:11:40
nit: does it make sense to have TODO to address th
Adam Rice
2016/07/07 07:40:01
Yes. I have added one.
| |
78 // |encodedBodyLength| is the number of bytes used to store this chunk, | |
79 // possibly encrypted, excluding headers or framing. It is set even if the | |
80 // response was served from cache. | |
81 virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength, int encodedDataLength, int encodedBodyLength) {} | |
73 | 82 |
74 // Called when a chunk of renderer-generated metadata is received from the c ache. | 83 // Called when a chunk of renderer-generated metadata is received from the c ache. |
75 virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int d ataLength) { } | 84 virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int d ataLength) { } |
76 | 85 |
77 // Called when the load completes successfully. | 86 // Called when the load completes successfully. |
78 // |totalEncodedDataLength| may be equal to kUnknownEncodedDataLength. | 87 // |totalEncodedDataLength| may be equal to kUnknownEncodedDataLength. |
79 virtual void didFinishLoading(WebURLLoader* loader, double finishTime, int64 _t totalEncodedDataLength) { } | 88 virtual void didFinishLoading(WebURLLoader* loader, double finishTime, int64 _t totalEncodedDataLength) { } |
80 | 89 |
81 // Called when the load completes with an error. | 90 // Called when the load completes with an error. |
82 virtual void didFail(WebURLLoader*, const WebURLError&) { } | 91 virtual void didFail(WebURLLoader*, const WebURLError&) { } |
83 | 92 |
84 // Value passed to didFinishLoading when total encoded data length isn't kno wn. | 93 // Value passed to didFinishLoading when total encoded data length isn't kno wn. |
85 static const int64_t kUnknownEncodedDataLength = -1; | 94 static const int64_t kUnknownEncodedDataLength = -1; |
86 | 95 |
87 protected: | 96 protected: |
88 virtual ~WebURLLoaderClient() { } | 97 virtual ~WebURLLoaderClient() { } |
89 }; | 98 }; |
90 | 99 |
91 } // namespace blink | 100 } // namespace blink |
92 | 101 |
93 #endif | 102 #endif |
OLD | NEW |