| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 WebFrame* frame = GetFrame(instance_); | 226 WebFrame* frame = GetFrame(instance_); |
| 227 if (!frame) | 227 if (!frame) |
| 228 return PP_ERROR_FAILED; | 228 return PP_ERROR_FAILED; |
| 229 WebURLRequest web_request(request->ToWebURLRequest(frame)); | 229 WebURLRequest web_request(request->ToWebURLRequest(frame)); |
| 230 | 230 |
| 231 int32_t rv = CanRequest(frame, web_request.url()); | 231 int32_t rv = CanRequest(frame, web_request.url()); |
| 232 if (rv != PP_OK) | 232 if (rv != PP_OK) |
| 233 return rv; | 233 return rv; |
| 234 | 234 |
| 235 frame->dispatchWillSendRequest(web_request); | 235 loader_.reset(frame->createAssociatedURLLoader()); |
| 236 | |
| 237 // Sets the appcache host id to allow retrieval from the appcache. | |
| 238 if (WebApplicationCacheHostImpl* appcache_host = | |
| 239 WebApplicationCacheHostImpl::FromFrame(frame)) { | |
| 240 appcache_host->willStartSubResourceRequest(web_request); | |
| 241 } | |
| 242 | |
| 243 loader_.reset(WebKit::webKitClient()->createURLLoader()); | |
| 244 if (!loader_.get()) | 236 if (!loader_.get()) |
| 245 return PP_ERROR_FAILED; | 237 return PP_ERROR_FAILED; |
| 246 | 238 |
| 247 loader_->loadAsynchronously(web_request, this); | 239 loader_->loadAsynchronously(web_request, this); |
| 248 | 240 |
| 249 request_info_ = scoped_refptr<URLRequestInfo>(request); | 241 request_info_ = scoped_refptr<URLRequestInfo>(request); |
| 250 pending_callback_ = callback; | 242 pending_callback_ = callback; |
| 251 | 243 |
| 252 // Notify completion when we receive a redirect or response headers. | 244 // Notify completion when we receive a redirect or response headers. |
| 253 return PP_ERROR_WOULDBLOCK; | 245 return PP_ERROR_WOULDBLOCK; |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 | 515 |
| 524 bool URLLoader::RecordDownloadProgress() const { | 516 bool URLLoader::RecordDownloadProgress() const { |
| 525 return request_info_ && request_info_->record_download_progress(); | 517 return request_info_ && request_info_->record_download_progress(); |
| 526 } | 518 } |
| 527 | 519 |
| 528 bool URLLoader::RecordUploadProgress() const { | 520 bool URLLoader::RecordUploadProgress() const { |
| 529 return request_info_ && request_info_->record_upload_progress(); | 521 return request_info_ && request_info_->record_upload_progress(); |
| 530 } | 522 } |
| 531 | 523 |
| 532 } // namespace pepper | 524 } // namespace pepper |
| OLD | NEW |