| OLD | NEW |
| 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 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_url_loader_impl.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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 WebFrame* frame = GetFrame(instance_); | 243 WebFrame* frame = GetFrame(instance_); |
| 244 if (!frame) | 244 if (!frame) |
| 245 return PP_ERROR_FAILED; | 245 return PP_ERROR_FAILED; |
| 246 WebURLRequest web_request(request->ToWebURLRequest(frame)); | 246 WebURLRequest web_request(request->ToWebURLRequest(frame)); |
| 247 | 247 |
| 248 rv = CanRequest(frame, web_request.url()); | 248 rv = CanRequest(frame, web_request.url()); |
| 249 if (rv != PP_OK) | 249 if (rv != PP_OK) |
| 250 return rv; | 250 return rv; |
| 251 | 251 |
| 252 frame->dispatchWillSendRequest(web_request); | 252 loader_.reset(frame->createAssociatedURLLoader()); |
| 253 | |
| 254 // Sets the appcache host id to allow retrieval from the appcache. | |
| 255 if (WebApplicationCacheHostImpl* appcache_host = | |
| 256 WebApplicationCacheHostImpl::FromFrame(frame)) { | |
| 257 appcache_host->willStartSubResourceRequest(web_request); | |
| 258 } | |
| 259 | |
| 260 loader_.reset(WebKit::webKitClient()->createURLLoader()); | |
| 261 if (!loader_.get()) | 253 if (!loader_.get()) |
| 262 return PP_ERROR_FAILED; | 254 return PP_ERROR_FAILED; |
| 263 | 255 |
| 264 loader_->loadAsynchronously(web_request, this); | 256 loader_->loadAsynchronously(web_request, this); |
| 265 | 257 |
| 266 request_info_ = scoped_refptr<PPB_URLRequestInfo_Impl>(request); | 258 request_info_ = scoped_refptr<PPB_URLRequestInfo_Impl>(request); |
| 267 | 259 |
| 268 // Notify completion when we receive a redirect or response headers. | 260 // Notify completion when we receive a redirect or response headers. |
| 269 RegisterCallback(callback); | 261 RegisterCallback(callback); |
| 270 return PP_ERROR_WOULDBLOCK; | 262 return PP_ERROR_WOULDBLOCK; |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 return request_info_ && request_info_->record_download_progress(); | 564 return request_info_ && request_info_->record_download_progress(); |
| 573 } | 565 } |
| 574 | 566 |
| 575 bool PPB_URLLoader_Impl::RecordUploadProgress() const { | 567 bool PPB_URLLoader_Impl::RecordUploadProgress() const { |
| 576 return request_info_ && request_info_->record_upload_progress(); | 568 return request_info_ && request_info_->record_upload_progress(); |
| 577 } | 569 } |
| 578 | 570 |
| 579 } // namespace ppapi | 571 } // namespace ppapi |
| 580 } // namespace webkit | 572 } // namespace webkit |
| 581 | 573 |
| OLD | NEW |