| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "webkit/glue/plugins/pepper_url_request_info.h" | 5 #include "webkit/glue/plugins/pepper_url_request_info.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "net/http/http_util.h" | 10 #include "net/http/http_util.h" |
| 11 #include "third_party/ppapi/c/pp_var.h" | 11 #include "third_party/ppapi/c/pp_var.h" |
| 12 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebData.h" |
| 13 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" |
| 14 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 15 #include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h" | 15 #include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h" |
| 16 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
| 17 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" | 17 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" |
| 18 #include "webkit/glue/plugins/pepper_file_ref.h" | 18 #include "webkit/glue/plugins/pepper_file_ref.h" |
| 19 #include "webkit/glue/plugins/pepper_plugin_module.h" | 19 #include "webkit/glue/plugins/pepper_plugin_module.h" |
| 20 #include "webkit/glue/plugins/pepper_string.h" | 20 #include "webkit/glue/plugins/pepper_string.h" |
| 21 #include "webkit/glue/plugins/pepper_var.h" | 21 #include "webkit/glue/plugins/pepper_var.h" |
| 22 #include "webkit/glue/webkit_glue.h" | 22 #include "webkit/glue/webkit_glue.h" |
| 23 | 23 |
| 24 using WebKit::WebData; | 24 using WebKit::WebData; |
| 25 using WebKit::WebFileInfo; | |
| 26 using WebKit::WebHTTPBody; | 25 using WebKit::WebHTTPBody; |
| 27 using WebKit::WebString; | 26 using WebKit::WebString; |
| 28 using WebKit::WebFrame; | 27 using WebKit::WebFrame; |
| 29 using WebKit::WebURL; | 28 using WebKit::WebURL; |
| 30 using WebKit::WebURLRequest; | 29 using WebKit::WebURLRequest; |
| 31 | 30 |
| 32 namespace pepper { | 31 namespace pepper { |
| 33 | 32 |
| 34 namespace { | 33 namespace { |
| 35 | 34 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 WebString::fromUTF8(it.values())); | 209 WebString::fromUTF8(it.values())); |
| 211 } | 210 } |
| 212 } | 211 } |
| 213 } | 212 } |
| 214 | 213 |
| 215 if (!body_.empty()) { | 214 if (!body_.empty()) { |
| 216 WebHTTPBody http_body; | 215 WebHTTPBody http_body; |
| 217 http_body.initialize(); | 216 http_body.initialize(); |
| 218 for (size_t i = 0; i < body_.size(); ++i) { | 217 for (size_t i = 0; i < body_.size(); ++i) { |
| 219 if (body_[i].file_ref) { | 218 if (body_[i].file_ref) { |
| 220 WebFileInfo file_info; | |
| 221 file_info.modificationTime = body_[i].expected_last_modified_time; | |
| 222 http_body.appendFileRange( | 219 http_body.appendFileRange( |
| 223 webkit_glue::FilePathToWebString(body_[i].file_ref->system_path()), | 220 webkit_glue::FilePathToWebString(body_[i].file_ref->system_path()), |
| 224 body_[i].start_offset, | 221 body_[i].start_offset, |
| 225 body_[i].number_of_bytes, | 222 body_[i].number_of_bytes, |
| 226 file_info); | 223 body_[i].expected_last_modified_time); |
| 227 } else { | 224 } else { |
| 228 DCHECK(!body_[i].data.empty()); | 225 DCHECK(!body_[i].data.empty()); |
| 229 http_body.appendData(WebData(body_[i].data)); | 226 http_body.appendData(WebData(body_[i].data)); |
| 230 } | 227 } |
| 231 } | 228 } |
| 232 web_request.setHTTPBody(http_body); | 229 web_request.setHTTPBody(http_body); |
| 233 } | 230 } |
| 234 | 231 |
| 235 frame->setReferrerForRequest(web_request, WebURL()); // Use default. | 232 frame->setReferrerForRequest(web_request, WebURL()); // Use default. |
| 236 return web_request; | 233 return web_request; |
| 237 } | 234 } |
| 238 | 235 |
| 239 } // namespace pepper | 236 } // namespace pepper |
| OLD | NEW |