Chromium Code Reviews| 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 } | 468 } |
| 469 | 469 |
| 470 void PPB_URLLoader_Impl::didFinishLoading(WebURLLoader* loader, | 470 void PPB_URLLoader_Impl::didFinishLoading(WebURLLoader* loader, |
| 471 double finish_time) { | 471 double finish_time) { |
| 472 done_status_ = PP_OK; | 472 done_status_ = PP_OK; |
| 473 RunCallback(done_status_); | 473 RunCallback(done_status_); |
| 474 } | 474 } |
| 475 | 475 |
| 476 void PPB_URLLoader_Impl::didFail(WebURLLoader* loader, | 476 void PPB_URLLoader_Impl::didFail(WebURLLoader* loader, |
| 477 const WebURLError& error) { | 477 const WebURLError& error) { |
| 478 // TODO(darin): Provide more detailed error information. | 478 // If a URL load fails, return PP_ERROR_NOACCESS instead of the more generic |
| 479 done_status_ = PP_ERROR_FAILED; | 479 // PP_ERROR_FAILED. There is no simple concept of error codes in the |
| 480 // underlying WebKit loader framework. | |
| 481 done_status_ = PP_ERROR_NOACCESS; | |
|
darin (slow to review)
2011/06/11 05:13:12
Well, the error codes actually are defined by Chro
| |
| 480 RunCallback(done_status_); | 482 RunCallback(done_status_); |
| 481 } | 483 } |
| 482 | 484 |
| 483 int32_t PPB_URLLoader_Impl::ValidateCallback(PP_CompletionCallback callback) { | 485 int32_t PPB_URLLoader_Impl::ValidateCallback(PP_CompletionCallback callback) { |
| 484 // We only support non-blocking calls. | 486 // We only support non-blocking calls. |
| 485 if (!callback.func) | 487 if (!callback.func) |
| 486 return PP_ERROR_BADARGUMENT; | 488 return PP_ERROR_BADARGUMENT; |
| 487 | 489 |
| 488 if (pending_callback_.get() && !pending_callback_->completed()) | 490 if (pending_callback_.get() && !pending_callback_->completed()) |
| 489 return PP_ERROR_INPROGRESS; | 491 return PP_ERROR_INPROGRESS; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 573 bool PPB_URLLoader_Impl::RecordDownloadProgress() const { | 575 bool PPB_URLLoader_Impl::RecordDownloadProgress() const { |
| 574 return request_info_ && request_info_->record_download_progress(); | 576 return request_info_ && request_info_->record_download_progress(); |
| 575 } | 577 } |
| 576 | 578 |
| 577 bool PPB_URLLoader_Impl::RecordUploadProgress() const { | 579 bool PPB_URLLoader_Impl::RecordUploadProgress() const { |
| 578 return request_info_ && request_info_->record_upload_progress(); | 580 return request_info_ && request_info_->record_upload_progress(); |
| 579 } | 581 } |
| 580 | 582 |
| 581 } // namespace ppapi | 583 } // namespace ppapi |
| 582 } // namespace webkit | 584 } // namespace webkit |
| OLD | NEW |