| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 public: | 68 public: |
| 69 MultipartResponseDelegate(WebKit::WebURLLoaderClient* client, | 69 MultipartResponseDelegate(WebKit::WebURLLoaderClient* client, |
| 70 WebKit::WebURLLoader* loader, | 70 WebKit::WebURLLoader* loader, |
| 71 const WebKit::WebURLResponse& response, | 71 const WebKit::WebURLResponse& response, |
| 72 const std::string& boundary); | 72 const std::string& boundary); |
| 73 | 73 |
| 74 // Passed through from ResourceHandleInternal | 74 // Passed through from ResourceHandleInternal |
| 75 void OnReceivedData(const char* data, int data_len); | 75 void OnReceivedData(const char* data, int data_len); |
| 76 void OnCompletedRequest(); | 76 void OnCompletedRequest(); |
| 77 | 77 |
| 78 // The request has been canceled, so stop making calls to the client. |
| 79 void Cancel() { |
| 80 client_ = NULL; |
| 81 loader_ = NULL; |
| 82 } |
| 83 |
| 78 // Returns the multi part boundary string from the Content-type header | 84 // Returns the multi part boundary string from the Content-type header |
| 79 // in the response. | 85 // in the response. |
| 80 // Returns true on success. | 86 // Returns true on success. |
| 81 static bool ReadMultipartBoundary(const WebKit::WebURLResponse& response, | 87 static bool ReadMultipartBoundary(const WebKit::WebURLResponse& response, |
| 82 std::string* multipart_boundary); | 88 std::string* multipart_boundary); |
| 83 | 89 |
| 84 // Returns the lower and higher content ranges from an individual multipart | 90 // Returns the lower and higher content ranges from an individual multipart |
| 85 // in a multipart response. | 91 // in a multipart response. |
| 86 // Returns true on success. | 92 // Returns true on success. |
| 87 static bool ReadContentRanges(const WebKit::WebURLResponse& response, | 93 static bool ReadContentRanges(const WebKit::WebURLResponse& response, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 138 |
| 133 // true after we've sent our first response to the WebURLLoaderClient. | 139 // true after we've sent our first response to the WebURLLoaderClient. |
| 134 bool has_sent_first_response_; | 140 bool has_sent_first_response_; |
| 135 | 141 |
| 136 DISALLOW_COPY_AND_ASSIGN(MultipartResponseDelegate); | 142 DISALLOW_COPY_AND_ASSIGN(MultipartResponseDelegate); |
| 137 }; | 143 }; |
| 138 | 144 |
| 139 } // namespace webkit_glue | 145 } // namespace webkit_glue |
| 140 | 146 |
| 141 #endif | 147 #endif |
| OLD | NEW |