| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 ResourceHandleInternal (resource_handle_win) that | 5 // A delegate class of ResourceHandleInternal (resource_handle_win) that |
| 6 // handles multipart/x-mixed-replace data. We special case | 6 // handles multipart/x-mixed-replace data. We special case |
| 7 // multipart/x-mixed-replace because WebCore expects a separate | 7 // multipart/x-mixed-replace because WebCore expects a separate |
| 8 // didReceiveResponse for each new message part. | 8 // didReceiveResponse for each new message part. |
| 9 // | 9 // |
| 10 // Most of the logic and edge case handling are based on the Mozilla's | 10 // Most of the logic and edge case handling are based on the Mozilla's |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 public: | 65 public: |
| 66 MultipartResponseDelegate(WebCore::ResourceHandleClient* client, | 66 MultipartResponseDelegate(WebCore::ResourceHandleClient* client, |
| 67 WebCore::ResourceHandle* job, | 67 WebCore::ResourceHandle* job, |
| 68 const WebCore::ResourceResponse& response, | 68 const WebCore::ResourceResponse& response, |
| 69 const std::string& boundary); | 69 const std::string& boundary); |
| 70 | 70 |
| 71 // Passed through from ResourceHandleInternal | 71 // Passed through from ResourceHandleInternal |
| 72 void OnReceivedData(const char* data, int data_len); | 72 void OnReceivedData(const char* data, int data_len); |
| 73 void OnCompletedRequest(); | 73 void OnCompletedRequest(); |
| 74 | 74 |
| 75 // Returns the multi part boundary string from the Content-type header |
| 76 // in the response. |
| 77 // Returns true on success. |
| 78 static bool ReadMultipartBoundary(const WebCore::ResourceResponse& response, |
| 79 std::string* multipart_boundary); |
| 80 |
| 81 // Returns the lower and higher content ranges from an individual multipart |
| 82 // in a multipart response. |
| 83 // Returns true on success. |
| 84 static bool ReadContentRanges(const WebCore::ResourceResponse& response, |
| 85 int* content_range_lower_bound, |
| 86 int* content_range_upper_bound); |
| 87 |
| 75 private: | 88 private: |
| 76 // Pointers back to our owning object so we can make callbacks as we parse | 89 // Pointers back to our owning object so we can make callbacks as we parse |
| 77 // pieces of data. | 90 // pieces of data. |
| 78 WebCore::ResourceHandleClient* client_; | 91 WebCore::ResourceHandleClient* client_; |
| 79 WebCore::ResourceHandle* job_; | 92 WebCore::ResourceHandle* job_; |
| 80 | 93 |
| 81 // The original resource response for this request. We use this as a | 94 // The original resource response for this request. We use this as a |
| 82 // starting point for each parts response. | 95 // starting point for each parts response. |
| 83 WebCore::ResourceResponse original_response_; | 96 WebCore::ResourceResponse original_response_; |
| 84 | 97 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 106 bool first_received_data_; | 119 bool first_received_data_; |
| 107 | 120 |
| 108 // true if we're truncated in the middle of a header | 121 // true if we're truncated in the middle of a header |
| 109 bool processing_headers_; | 122 bool processing_headers_; |
| 110 | 123 |
| 111 // true when we're done sending information. At that point, we stop | 124 // true when we're done sending information. At that point, we stop |
| 112 // processing AddData requests. | 125 // processing AddData requests. |
| 113 bool stop_sending_; | 126 bool stop_sending_; |
| 114 }; | 127 }; |
| 115 | 128 |
| OLD | NEW |