OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_file_io_host.h" | 5 #include "content/renderer/pepper/pepper_file_io_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 context->MakeReplyMessageContext()))) | 419 context->MakeReplyMessageContext()))) |
420 return PP_ERROR_FAILED; | 420 return PP_ERROR_FAILED; |
421 | 421 |
422 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); | 422 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); |
423 return PP_OK_COMPLETIONPENDING; | 423 return PP_OK_COMPLETIONPENDING; |
424 } | 424 } |
425 | 425 |
426 int32_t PepperFileIOHost::OnHostMsgRequestOSFileHandle( | 426 int32_t PepperFileIOHost::OnHostMsgRequestOSFileHandle( |
427 ppapi::host::HostMessageContext* context) { | 427 ppapi::host::HostMessageContext* context) { |
428 if (!is_running_in_process_ && | 428 if (!is_running_in_process_ && |
429 quota_policy_ != quota::kQuotaLimitTypeUnlimited && | 429 quota_policy_ != quota::kQuotaLimitTypeUnlimited) |
430 // TODO(hamaji): Remove the whitelist once it turned out the | |
431 // quota check is sufficient. http://crbug.com/226386 | |
432 !GetContentClient()->renderer()->IsRequestOSFileHandleAllowedForURL( | |
433 file_system_url_)) | |
434 return PP_ERROR_FAILED; | 430 return PP_ERROR_FAILED; |
435 | 431 |
436 RendererPpapiHost* renderer_ppapi_host = | 432 RendererPpapiHost* renderer_ppapi_host = |
437 RendererPpapiHost::GetForPPInstance(pp_instance()); | 433 RendererPpapiHost::GetForPPInstance(pp_instance()); |
438 | 434 |
439 IPC::PlatformFileForTransit file = | 435 IPC::PlatformFileForTransit file = |
440 renderer_ppapi_host->ShareHandleWithRemote(file_, false); | 436 renderer_ppapi_host->ShareHandleWithRemote(file_, false); |
441 if (file == IPC::InvalidPlatformFileForTransit()) | 437 if (file == IPC::InvalidPlatformFileForTransit()) |
442 return PP_ERROR_FAILED; | 438 return PP_ERROR_FAILED; |
443 ppapi::host::ReplyMessageContext reply_context = | 439 ppapi::host::ReplyMessageContext reply_context = |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 // On the plugin side, the callback expects a parameter with different meaning | 553 // On the plugin side, the callback expects a parameter with different meaning |
558 // depends on whether is negative or not. It is the result here. We translate | 554 // depends on whether is negative or not. It is the result here. We translate |
559 // for the callback. | 555 // for the callback. |
560 int32_t pp_error = ::ppapi::PlatformFileErrorToPepperError(error_code); | 556 int32_t pp_error = ::ppapi::PlatformFileErrorToPepperError(error_code); |
561 reply_context.params.set_result(ErrorOrByteNumber(pp_error, bytes_written)); | 557 reply_context.params.set_result(ErrorOrByteNumber(pp_error, bytes_written)); |
562 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_GeneralReply()); | 558 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_GeneralReply()); |
563 state_manager_.SetOperationFinished(); | 559 state_manager_.SetOperationFinished(); |
564 } | 560 } |
565 | 561 |
566 } // namespace content | 562 } // namespace content |
OLD | NEW |