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_loader.h" | 5 #include "webkit/glue/plugins/pepper_url_loader.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/c/pp_completion_callback.h" | 8 #include "ppapi/c/pp_completion_callback.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/c/ppb_url_loader.h" | 10 #include "ppapi/c/ppb_url_loader.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 229 |
230 WebFrame* frame = GetFrame(instance_); | 230 WebFrame* frame = GetFrame(instance_); |
231 if (!frame) | 231 if (!frame) |
232 return PP_ERROR_FAILED; | 232 return PP_ERROR_FAILED; |
233 WebURLRequest web_request(request->ToWebURLRequest(frame)); | 233 WebURLRequest web_request(request->ToWebURLRequest(frame)); |
234 | 234 |
235 int32_t rv = CanRequest(frame, web_request.url()); | 235 int32_t rv = CanRequest(frame, web_request.url()); |
236 if (rv != PP_OK) | 236 if (rv != PP_OK) |
237 return rv; | 237 return rv; |
238 | 238 |
239 frame->dispatchWillSendRequest(web_request); | 239 loader_.reset(frame->createAssociatedURLLoader()); |
240 | |
241 // Sets the appcache host id to allow retrieval from the appcache. | |
242 if (WebApplicationCacheHostImpl* appcache_host = | |
243 WebApplicationCacheHostImpl::FromFrame(frame)) { | |
244 appcache_host->willStartSubResourceRequest(web_request); | |
245 } | |
246 | |
247 loader_.reset(WebKit::webKitClient()->createURLLoader()); | |
248 if (!loader_.get()) | 240 if (!loader_.get()) |
249 return PP_ERROR_FAILED; | 241 return PP_ERROR_FAILED; |
250 | 242 |
251 loader_->loadAsynchronously(web_request, this); | 243 loader_->loadAsynchronously(web_request, this); |
252 | 244 |
253 request_info_ = scoped_refptr<URLRequestInfo>(request); | 245 request_info_ = scoped_refptr<URLRequestInfo>(request); |
254 pending_callback_ = callback; | 246 pending_callback_ = callback; |
255 | 247 |
256 // Notify completion when we receive a redirect or response headers. | 248 // Notify completion when we receive a redirect or response headers. |
257 return PP_ERROR_WOULDBLOCK; | 249 return PP_ERROR_WOULDBLOCK; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 519 |
528 bool URLLoader::RecordDownloadProgress() const { | 520 bool URLLoader::RecordDownloadProgress() const { |
529 return request_info_ && request_info_->record_download_progress(); | 521 return request_info_ && request_info_->record_download_progress(); |
530 } | 522 } |
531 | 523 |
532 bool URLLoader::RecordUploadProgress() const { | 524 bool URLLoader::RecordUploadProgress() const { |
533 return request_info_ && request_info_->record_upload_progress(); | 525 return request_info_ && request_info_->record_upload_progress(); |
534 } | 526 } |
535 | 527 |
536 } // namespace pepper | 528 } // namespace pepper |
OLD | NEW |