OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/renderer_host/pepper/pepper_file_io_host.h" | 5 #include "content/browser/renderer_host/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/files/file_util_proxy.h" | 10 #include "base/files/file_util_proxy.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 470 |
471 void PepperFileIOHost::SendOpenErrorReply( | 471 void PepperFileIOHost::SendOpenErrorReply( |
472 ppapi::host::ReplyMessageContext reply_context) { | 472 ppapi::host::ReplyMessageContext reply_context) { |
473 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_OpenReply(0, 0)); | 473 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_OpenReply(0, 0)); |
474 } | 474 } |
475 | 475 |
476 bool PepperFileIOHost::AddFileToReplyContext( | 476 bool PepperFileIOHost::AddFileToReplyContext( |
477 int32_t open_flags, | 477 int32_t open_flags, |
478 ppapi::host::ReplyMessageContext* reply_context) const { | 478 ppapi::host::ReplyMessageContext* reply_context) const { |
479 base::ProcessId plugin_process_id = | 479 base::ProcessId plugin_process_id = |
480 base::GetProcId(browser_ppapi_host_->GetPluginProcessHandle()); | 480 base::GetProcId(browser_ppapi_host_->GetPluginProcess().Handle()); |
481 if (plugin_process_id == base::kNullProcessId) | 481 if (plugin_process_id == base::kNullProcessId) |
482 plugin_process_id = resolved_render_process_id_; | 482 plugin_process_id = resolved_render_process_id_; |
483 | 483 |
484 IPC::PlatformFileForTransit transit_file = | 484 IPC::PlatformFileForTransit transit_file = |
485 BrokerGetFileHandleForProcess(file_.GetPlatformFile(), plugin_process_id, | 485 BrokerGetFileHandleForProcess(file_.GetPlatformFile(), plugin_process_id, |
486 false); | 486 false); |
487 if (transit_file == IPC::InvalidPlatformFileForTransit()) | 487 if (transit_file == IPC::InvalidPlatformFileForTransit()) |
488 return false; | 488 return false; |
489 | 489 |
490 ppapi::proxy::SerializedHandle file_handle; | 490 ppapi::proxy::SerializedHandle file_handle; |
491 // A non-zero resource id signals NaClIPCAdapter to create a NaClQuotaDesc. | 491 // A non-zero resource id signals NaClIPCAdapter to create a NaClQuotaDesc. |
492 PP_Resource quota_file_io = check_quota_ ? pp_resource() : 0; | 492 PP_Resource quota_file_io = check_quota_ ? pp_resource() : 0; |
493 file_handle.set_file_handle(transit_file, open_flags, quota_file_io); | 493 file_handle.set_file_handle(transit_file, open_flags, quota_file_io); |
494 reply_context->params.AppendHandle(file_handle); | 494 reply_context->params.AppendHandle(file_handle); |
495 return true; | 495 return true; |
496 } | 496 } |
497 | 497 |
498 } // namespace content | 498 } // namespace content |
OLD | NEW |