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 loader_.reset(frame->createAssociatedURLLoader()); | 239 frame->dispatchWillSendRequest(web_request); |
| 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()); |
240 if (!loader_.get()) | 248 if (!loader_.get()) |
241 return PP_ERROR_FAILED; | 249 return PP_ERROR_FAILED; |
242 | 250 |
243 loader_->loadAsynchronously(web_request, this); | 251 loader_->loadAsynchronously(web_request, this); |
244 | 252 |
245 request_info_ = scoped_refptr<URLRequestInfo>(request); | 253 request_info_ = scoped_refptr<URLRequestInfo>(request); |
246 pending_callback_ = callback; | 254 pending_callback_ = callback; |
247 | 255 |
248 // Notify completion when we receive a redirect or response headers. | 256 // Notify completion when we receive a redirect or response headers. |
249 return PP_ERROR_WOULDBLOCK; | 257 return PP_ERROR_WOULDBLOCK; |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 527 |
520 bool URLLoader::RecordDownloadProgress() const { | 528 bool URLLoader::RecordDownloadProgress() const { |
521 return request_info_ && request_info_->record_download_progress(); | 529 return request_info_ && request_info_->record_download_progress(); |
522 } | 530 } |
523 | 531 |
524 bool URLLoader::RecordUploadProgress() const { | 532 bool URLLoader::RecordUploadProgress() const { |
525 return request_info_ && request_info_->record_upload_progress(); | 533 return request_info_ && request_info_->record_upload_progress(); |
526 } | 534 } |
527 | 535 |
528 } // namespace pepper | 536 } // namespace pepper |
OLD | NEW |