Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: content/child/multipart_response_delegate.h

Issue 384273003: Move multipart_response_delegate.* from webkit/ to content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android_webview fix Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 28 matching lines...) Expand all
39 * of those above. If you wish to allow use of your version of this file only 39 * of those above. If you wish to allow use of your version of this file only
40 * under the terms of either the GPL or the LGPL, and not to allow others to 40 * under the terms of either the GPL or the LGPL, and not to allow others to
41 * use your version of this file under the terms of the MPL, indicate your 41 * use your version of this file under the terms of the MPL, indicate your
42 * decision by deleting the provisions above and replace them with the notice 42 * decision by deleting the provisions above and replace them with the notice
43 * and other provisions required by the GPL or the LGPL. If you do not delete 43 * and other provisions required by the GPL or the LGPL. If you do not delete
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 WEBKIT_CHILD_MULTIPART_RESPONSE_DELEGATE_H_ 49 #ifndef CONTENT_CHILD_MULTIPART_RESPONSE_DELEGATE_H_
50 #define WEBKIT_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 "base/basictypes.h"
55 #include "content/common/content_export.h"
55 #include "third_party/WebKit/public/platform/WebURLResponse.h" 56 #include "third_party/WebKit/public/platform/WebURLResponse.h"
56 #include "webkit/child/webkit_child_export.h"
57 57
58 namespace blink { 58 namespace blink {
59 class WebURLLoader; 59 class WebURLLoader;
60 class WebURLLoaderClient; 60 class WebURLLoaderClient;
61 } 61 }
62 62
63 namespace content { 63 namespace content {
64 // Used by unit tests to access private members.
65 class MultipartResponseDelegateTester;
66 }
67 64
68 namespace webkit_glue { 65 class CONTENT_EXPORT MultipartResponseDelegate {
69
70 class WEBKIT_CHILD_EXPORT MultipartResponseDelegate {
71 public: 66 public:
72 MultipartResponseDelegate(blink::WebURLLoaderClient* client, 67 MultipartResponseDelegate(blink::WebURLLoaderClient* client,
73 blink::WebURLLoader* loader, 68 blink::WebURLLoader* loader,
74 const blink::WebURLResponse& response, 69 const blink::WebURLResponse& response,
75 const std::string& boundary); 70 const std::string& boundary);
76 71
77 // Passed through from ResourceHandleInternal 72 // Passed through from ResourceHandleInternal
78 void OnReceivedData(const char* data, int data_len, int encoded_data_length); 73 void OnReceivedData(const char* data, int data_len, int encoded_data_length);
79 void OnCompletedRequest(); 74 void OnCompletedRequest();
80 75
(...skipping 12 matching lines...) Expand all
93 // Returns the lower and higher content ranges from an individual multipart 88 // Returns the lower and higher content ranges from an individual multipart
94 // in a multipart response. 89 // in a multipart response.
95 // Returns true on success. 90 // Returns true on success.
96 static bool ReadContentRanges( 91 static bool ReadContentRanges(
97 const blink::WebURLResponse& response, 92 const blink::WebURLResponse& response,
98 int64* content_range_lower_bound, 93 int64* content_range_lower_bound,
99 int64* content_range_upper_bound, 94 int64* content_range_upper_bound,
100 int64* content_range_instance_size); 95 int64* content_range_instance_size);
101 96
102 private: 97 private:
103 friend class content::MultipartResponseDelegateTester; // For unittests. 98 friend class MultipartResponseDelegateTester; // For unittests.
104 99
105 // Pointers to the client and associated loader so we can make callbacks as 100 // Pointers to the client and associated loader so we can make callbacks as
106 // we parse pieces of data. 101 // we parse pieces of data.
107 blink::WebURLLoaderClient* client_; 102 blink::WebURLLoaderClient* client_;
108 blink::WebURLLoader* loader_; 103 blink::WebURLLoader* loader_;
109 104
110 // The original resource response for this request. We use this as a 105 // The original resource response for this request. We use this as a
111 // starting point for each parts response. 106 // starting point for each parts response.
112 blink::WebURLResponse original_response_; 107 blink::WebURLResponse original_response_;
113 108
(...skipping 29 matching lines...) Expand all
143 // true when we're done sending information. At that point, we stop 138 // true when we're done sending information. At that point, we stop
144 // processing AddData requests. 139 // processing AddData requests.
145 bool stop_sending_; 140 bool stop_sending_;
146 141
147 // true after we've sent our first response to the WebURLLoaderClient. 142 // true after we've sent our first response to the WebURLLoaderClient.
148 bool has_sent_first_response_; 143 bool has_sent_first_response_;
149 144
150 DISALLOW_COPY_AND_ASSIGN(MultipartResponseDelegate); 145 DISALLOW_COPY_AND_ASSIGN(MultipartResponseDelegate);
151 }; 146 };
152 147
153 } // namespace webkit_glue 148 } // namespace content
154 149
155 #endif // WEBKIT_CHILD_MULTIPART_RESPONSE_DELEGATE_H_ 150 #endif // CONTENT_CHILD_MULTIPART_RESPONSE_DELEGATE_H_
OLDNEW
« no previous file with comments | « android_webview/tools/third_party_files_whitelist.txt ('k') | content/child/multipart_response_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698