| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 * the provisions above, a recipient may use your version of this file under | 44 * the provisions above, a recipient may use your version of this file under |
| 45 * the terms of any one of the MPL, the GPL or the LGPL. | 45 * the terms of any one of the MPL, the GPL or the LGPL. |
| 46 * | 46 * |
| 47 * ***** END LICENSE BLOCK ***** */ | 47 * ***** END LICENSE BLOCK ***** */ |
| 48 | 48 |
| 49 #ifndef CONTENT_CHILD_MULTIPART_RESPONSE_DELEGATE_H_ | 49 #ifndef CONTENT_CHILD_MULTIPART_RESPONSE_DELEGATE_H_ |
| 50 #define CONTENT_CHILD_MULTIPART_RESPONSE_DELEGATE_H_ | 50 #define CONTENT_CHILD_MULTIPART_RESPONSE_DELEGATE_H_ |
| 51 | 51 |
| 52 #include <string> | 52 #include <string> |
| 53 | 53 |
| 54 #include "base/basictypes.h" | 54 #include <stddef.h> |
| 55 |
| 56 #include <stdint.h> |
| 57 |
| 58 #include "base/macros.h" |
| 55 #include "content/common/content_export.h" | 59 #include "content/common/content_export.h" |
| 56 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 60 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 57 | 61 |
| 58 namespace blink { | 62 namespace blink { |
| 59 class WebURLLoader; | 63 class WebURLLoader; |
| 60 class WebURLLoaderClient; | 64 class WebURLLoaderClient; |
| 61 } | 65 } |
| 62 | 66 |
| 63 namespace content { | 67 namespace content { |
| 64 | 68 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 81 | 85 |
| 82 // Returns the multi part boundary string from the Content-type header | 86 // Returns the multi part boundary string from the Content-type header |
| 83 // in the response. | 87 // in the response. |
| 84 // Returns true on success. | 88 // Returns true on success. |
| 85 static bool ReadMultipartBoundary(const blink::WebURLResponse& response, | 89 static bool ReadMultipartBoundary(const blink::WebURLResponse& response, |
| 86 std::string* multipart_boundary); | 90 std::string* multipart_boundary); |
| 87 | 91 |
| 88 // Returns the lower and higher content ranges from an individual multipart | 92 // Returns the lower and higher content ranges from an individual multipart |
| 89 // in a multipart response. | 93 // in a multipart response. |
| 90 // Returns true on success. | 94 // Returns true on success. |
| 91 static bool ReadContentRanges( | 95 static bool ReadContentRanges(const blink::WebURLResponse& response, |
| 92 const blink::WebURLResponse& response, | 96 int64_t* content_range_lower_bound, |
| 93 int64* content_range_lower_bound, | 97 int64_t* content_range_upper_bound, |
| 94 int64* content_range_upper_bound, | 98 int64_t* content_range_instance_size); |
| 95 int64* content_range_instance_size); | |
| 96 | 99 |
| 97 private: | 100 private: |
| 98 friend class MultipartResponseDelegateTester; // For unittests. | 101 friend class MultipartResponseDelegateTester; // For unittests. |
| 99 | 102 |
| 100 // Pointers to the client and associated loader so we can make callbacks as | 103 // Pointers to the client and associated loader so we can make callbacks as |
| 101 // we parse pieces of data. | 104 // we parse pieces of data. |
| 102 blink::WebURLLoaderClient* client_; | 105 blink::WebURLLoaderClient* client_; |
| 103 blink::WebURLLoader* loader_; | 106 blink::WebURLLoader* loader_; |
| 104 | 107 |
| 105 // The original resource response for this request. We use this as a | 108 // The original resource response for this request. We use this as a |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 144 |
| 142 // true after we've sent our first response to the WebURLLoaderClient. | 145 // true after we've sent our first response to the WebURLLoaderClient. |
| 143 bool has_sent_first_response_; | 146 bool has_sent_first_response_; |
| 144 | 147 |
| 145 DISALLOW_COPY_AND_ASSIGN(MultipartResponseDelegate); | 148 DISALLOW_COPY_AND_ASSIGN(MultipartResponseDelegate); |
| 146 }; | 149 }; |
| 147 | 150 |
| 148 } // namespace content | 151 } // namespace content |
| 149 | 152 |
| 150 #endif // CONTENT_CHILD_MULTIPART_RESPONSE_DELEGATE_H_ | 153 #endif // CONTENT_CHILD_MULTIPART_RESPONSE_DELEGATE_H_ |
| OLD | NEW |