| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // A delegate class of WebURLLoaderImpl that handles multipart/x-mixed-replace | 5 // A delegate class of WebURLLoaderImpl that handles multipart/x-mixed-replace |
| 6 // data. We special case multipart/x-mixed-replace because WebCore expects a | 6 // data. We special case multipart/x-mixed-replace because WebCore expects a |
| 7 // separate didReceiveResponse for each new message part. | 7 // separate didReceiveResponse for each new message part. |
| 8 // | 8 // |
| 9 // Most of the logic and edge case handling are based on the Mozilla's | 9 // Most of the logic and edge case handling are based on the Mozilla's |
| 10 // implementation in netwerk/streamconv/converters/nsMultiMixedConv.cpp. | 10 // implementation in netwerk/streamconv/converters/nsMultiMixedConv.cpp. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Passed through from ResourceHandleInternal | 76 // Passed through from ResourceHandleInternal |
| 77 void OnReceivedData(const char* data, int data_len, int encoded_data_length); | 77 void OnReceivedData(const char* data, int data_len, int encoded_data_length); |
| 78 void OnCompletedRequest(); | 78 void OnCompletedRequest(); |
| 79 | 79 |
| 80 // The request has been canceled, so stop making calls to the client. | 80 // The request has been canceled, so stop making calls to the client. |
| 81 void Cancel() { | 81 void Cancel() { |
| 82 client_ = NULL; | 82 client_ = NULL; |
| 83 loader_ = NULL; | 83 loader_ = NULL; |
| 84 } | 84 } |
| 85 | 85 |
| 86 // Returns the multi part boundary string from the Content-type header | |
| 87 // in the response. | |
| 88 // Returns true on success. | |
| 89 static bool ReadMultipartBoundary(const blink::WebURLResponse& response, | |
| 90 std::string* multipart_boundary); | |
| 91 | |
| 92 // Returns the lower and higher content ranges from an individual multipart | 86 // Returns the lower and higher content ranges from an individual multipart |
| 93 // in a multipart response. | 87 // in a multipart response. |
| 94 // Returns true on success. | 88 // Returns true on success. |
| 95 static bool ReadContentRanges(const blink::WebURLResponse& response, | 89 static bool ReadContentRanges(const blink::WebURLResponse& response, |
| 96 int64_t* content_range_lower_bound, | 90 int64_t* content_range_lower_bound, |
| 97 int64_t* content_range_upper_bound, | 91 int64_t* content_range_upper_bound, |
| 98 int64_t* content_range_instance_size); | 92 int64_t* content_range_instance_size); |
| 99 | 93 |
| 100 private: | 94 private: |
| 101 friend class MultipartResponseDelegateTester; // For unittests. | 95 friend class MultipartResponseDelegateTester; // For unittests. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 138 |
| 145 // true after we've sent our first response to the WebURLLoaderClient. | 139 // true after we've sent our first response to the WebURLLoaderClient. |
| 146 bool has_sent_first_response_; | 140 bool has_sent_first_response_; |
| 147 | 141 |
| 148 DISALLOW_COPY_AND_ASSIGN(MultipartResponseDelegate); | 142 DISALLOW_COPY_AND_ASSIGN(MultipartResponseDelegate); |
| 149 }; | 143 }; |
| 150 | 144 |
| 151 } // namespace content | 145 } // namespace content |
| 152 | 146 |
| 153 #endif // CONTENT_CHILD_MULTIPART_RESPONSE_DELEGATE_H_ | 147 #endif // CONTENT_CHILD_MULTIPART_RESPONSE_DELEGATE_H_ |
| OLD | NEW |