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" |
11 #include "base/files/file_util_proxy.h" | 11 #include "base/files/file_util_proxy.h" |
12 #include "content/child/child_thread.h" | 12 #include "content/child/child_thread.h" |
13 #include "content/child/fileapi/file_system_dispatcher.h" | 13 #include "content/child/fileapi/file_system_dispatcher.h" |
14 #include "content/child/quota_dispatcher.h" | 14 #include "content/child/quota_dispatcher.h" |
15 #include "content/common/fileapi/file_system_messages.h" | 15 #include "content/common/fileapi/file_system_messages.h" |
16 #include "content/public/common/content_client.h" | 16 #include "content/public/common/content_client.h" |
17 #include "content/public/renderer/content_renderer_client.h" | 17 #include "content/public/renderer/content_renderer_client.h" |
18 #include "content/renderer/pepper/host_globals.h" | 18 #include "content/renderer/pepper/host_globals.h" |
19 #include "content/renderer/pepper/pepper_helper_impl.h" | 19 #include "content/renderer/pepper/pepper_helper_impl.h" |
20 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 20 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
21 #include "content/renderer/pepper/ppb_file_ref_impl.h" | 21 #include "content/renderer/pepper/ppb_file_ref_impl.h" |
22 #include "content/renderer/pepper/quota_file_io.h" | 22 #include "content/renderer/pepper/quota_file_io.h" |
23 #include "content/renderer/pepper/resource_helper.h" | 23 #include "content/renderer/pepper/resource_helper.h" |
24 #include "content/renderer/render_thread_impl.h" | 24 #include "content/renderer/render_thread_impl.h" |
25 #include "ppapi/c/pp_errors.h" | 25 #include "ppapi/c/pp_errors.h" |
| 26 #include "ppapi/c/ppb_file_io.h" |
26 #include "ppapi/host/dispatch_host_message.h" | 27 #include "ppapi/host/dispatch_host_message.h" |
27 #include "ppapi/host/ppapi_host.h" | 28 #include "ppapi/host/ppapi_host.h" |
28 #include "ppapi/proxy/ppapi_messages.h" | 29 #include "ppapi/proxy/ppapi_messages.h" |
29 #include "ppapi/shared_impl/file_type_conversion.h" | 30 #include "ppapi/shared_impl/file_type_conversion.h" |
30 #include "ppapi/shared_impl/time_conversion.h" | 31 #include "ppapi/shared_impl/time_conversion.h" |
31 #include "ppapi/thunk/enter.h" | 32 #include "ppapi/thunk/enter.h" |
32 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 33 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
33 | 34 |
34 namespace content { | 35 namespace content { |
35 | 36 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 quota::kQuotaLimitTypeUnknown, | 137 quota::kQuotaLimitTypeUnknown, |
137 PepperFileIOHost::NotifyCloseFileCallback()); | 138 PepperFileIOHost::NotifyCloseFileCallback()); |
138 } | 139 } |
139 | 140 |
140 } // namespace | 141 } // namespace |
141 | 142 |
142 PepperFileIOHost::PepperFileIOHost(RendererPpapiHost* host, | 143 PepperFileIOHost::PepperFileIOHost(RendererPpapiHost* host, |
143 PP_Instance instance, | 144 PP_Instance instance, |
144 PP_Resource resource) | 145 PP_Resource resource) |
145 : ResourceHost(host->GetPpapiHost(), instance, resource), | 146 : ResourceHost(host->GetPpapiHost(), instance, resource), |
| 147 renderer_ppapi_host_(host), |
146 file_(base::kInvalidPlatformFileValue), | 148 file_(base::kInvalidPlatformFileValue), |
147 file_system_type_(PP_FILESYSTEMTYPE_INVALID), | 149 file_system_type_(PP_FILESYSTEMTYPE_INVALID), |
148 quota_policy_(quota::kQuotaLimitTypeUnknown), | 150 quota_policy_(quota::kQuotaLimitTypeUnknown), |
149 is_running_in_process_(host->IsRunningInProcess()), | 151 is_running_in_process_(host->IsRunningInProcess()), |
150 open_flags_(0), | 152 open_flags_(0), |
151 weak_factory_(this) { | 153 weak_factory_(this) { |
152 } | 154 } |
153 | 155 |
154 PepperFileIOHost::~PepperFileIOHost() { | 156 PepperFileIOHost::~PepperFileIOHost() { |
155 OnHostMsgClose(NULL); | 157 OnHostMsgClose(NULL); |
156 } | 158 } |
157 | 159 |
158 int32_t PepperFileIOHost::OnResourceMessageReceived( | 160 int32_t PepperFileIOHost::OnResourceMessageReceived( |
159 const IPC::Message& msg, | 161 const IPC::Message& msg, |
160 ppapi::host::HostMessageContext* context) { | 162 ppapi::host::HostMessageContext* context) { |
161 IPC_BEGIN_MESSAGE_MAP(PepperFileIOHost, msg) | 163 IPC_BEGIN_MESSAGE_MAP(PepperFileIOHost, msg) |
162 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Open, | 164 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Open, |
163 OnHostMsgOpen) | 165 OnHostMsgOpen) |
164 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileIO_Query, | |
165 OnHostMsgQuery) | |
166 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Touch, | 166 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Touch, |
167 OnHostMsgTouch) | 167 OnHostMsgTouch) |
168 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Read, | |
169 OnHostMsgRead) | |
170 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Write, | 168 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Write, |
171 OnHostMsgWrite) | 169 OnHostMsgWrite) |
172 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_SetLength, | 170 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_SetLength, |
173 OnHostMsgSetLength) | 171 OnHostMsgSetLength) |
174 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileIO_Flush, | 172 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileIO_Flush, |
175 OnHostMsgFlush) | 173 OnHostMsgFlush) |
176 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileIO_Close, | 174 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_FileIO_Close, |
177 OnHostMsgClose) | 175 OnHostMsgClose) |
178 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_WillWrite, | 176 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_WillWrite, |
179 OnHostMsgWillWrite) | 177 OnHostMsgWillWrite) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 base::Bind(&PepperFileIOHost::ExecutePlatformOpenFileCallback, | 240 base::Bind(&PepperFileIOHost::ExecutePlatformOpenFileCallback, |
243 weak_factory_.GetWeakPtr(), | 241 weak_factory_.GetWeakPtr(), |
244 context->MakeReplyMessageContext()))) | 242 context->MakeReplyMessageContext()))) |
245 return PP_ERROR_FAILED; | 243 return PP_ERROR_FAILED; |
246 } | 244 } |
247 | 245 |
248 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); | 246 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); |
249 return PP_OK_COMPLETIONPENDING; | 247 return PP_OK_COMPLETIONPENDING; |
250 } | 248 } |
251 | 249 |
252 int32_t PepperFileIOHost::OnHostMsgQuery( | |
253 ppapi::host::HostMessageContext* context) { | |
254 int32_t rv = state_manager_.CheckOperationState( | |
255 FileIOStateManager::OPERATION_EXCLUSIVE, true); | |
256 if (rv != PP_OK) | |
257 return rv; | |
258 | |
259 if (!base::FileUtilProxy::GetFileInfoFromPlatformFile( | |
260 RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(), | |
261 file_, | |
262 base::Bind(&PepperFileIOHost::ExecutePlatformQueryCallback, | |
263 weak_factory_.GetWeakPtr(), | |
264 context->MakeReplyMessageContext()))) | |
265 return PP_ERROR_FAILED; | |
266 | |
267 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); | |
268 return PP_OK_COMPLETIONPENDING; | |
269 } | |
270 | |
271 int32_t PepperFileIOHost::OnHostMsgTouch( | 250 int32_t PepperFileIOHost::OnHostMsgTouch( |
272 ppapi::host::HostMessageContext* context, | 251 ppapi::host::HostMessageContext* context, |
273 PP_Time last_access_time, | 252 PP_Time last_access_time, |
274 PP_Time last_modified_time) { | 253 PP_Time last_modified_time) { |
275 int32_t rv = state_manager_.CheckOperationState( | 254 int32_t rv = state_manager_.CheckOperationState( |
276 FileIOStateManager::OPERATION_EXCLUSIVE, true); | 255 FileIOStateManager::OPERATION_EXCLUSIVE, true); |
277 if (rv != PP_OK) | 256 if (rv != PP_OK) |
278 return rv; | 257 return rv; |
279 | 258 |
280 if (file_system_type_ != PP_FILESYSTEMTYPE_EXTERNAL) { | 259 if (file_system_type_ != PP_FILESYSTEMTYPE_EXTERNAL) { |
(...skipping 19 matching lines...) Expand all Loading... |
300 PPTimeToTime(last_modified_time), | 279 PPTimeToTime(last_modified_time), |
301 base::Bind(&PepperFileIOHost::ExecutePlatformGeneralCallback, | 280 base::Bind(&PepperFileIOHost::ExecutePlatformGeneralCallback, |
302 weak_factory_.GetWeakPtr(), | 281 weak_factory_.GetWeakPtr(), |
303 context->MakeReplyMessageContext()))) | 282 context->MakeReplyMessageContext()))) |
304 return PP_ERROR_FAILED; | 283 return PP_ERROR_FAILED; |
305 | 284 |
306 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); | 285 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); |
307 return PP_OK_COMPLETIONPENDING; | 286 return PP_OK_COMPLETIONPENDING; |
308 } | 287 } |
309 | 288 |
310 int32_t PepperFileIOHost::OnHostMsgRead( | |
311 ppapi::host::HostMessageContext* context, | |
312 int64_t offset, | |
313 int32_t max_read_length) { | |
314 int32_t rv = state_manager_.CheckOperationState( | |
315 FileIOStateManager::OPERATION_READ, true); | |
316 if (rv != PP_OK) | |
317 return rv; | |
318 | |
319 // Validate max_read_length before allocating below. This value is coming from | |
320 // the untrusted plugin. | |
321 if (max_read_length < 0) { | |
322 ReplyMessageContext reply_context = context->MakeReplyMessageContext(); | |
323 reply_context.params.set_result(PP_ERROR_FAILED); | |
324 host()->SendReply(reply_context, | |
325 PpapiPluginMsg_FileIO_ReadReply(std::string())); | |
326 return PP_OK_COMPLETIONPENDING; | |
327 } | |
328 | |
329 if (!base::FileUtilProxy::Read( | |
330 RenderThreadImpl::current()->GetFileThreadMessageLoopProxy().get(), | |
331 file_, | |
332 offset, | |
333 max_read_length, | |
334 base::Bind(&PepperFileIOHost::ExecutePlatformReadCallback, | |
335 weak_factory_.GetWeakPtr(), | |
336 context->MakeReplyMessageContext()))) | |
337 return PP_ERROR_FAILED; | |
338 | |
339 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_READ); | |
340 return PP_OK_COMPLETIONPENDING; | |
341 } | |
342 | |
343 int32_t PepperFileIOHost::OnHostMsgWrite( | 289 int32_t PepperFileIOHost::OnHostMsgWrite( |
344 ppapi::host::HostMessageContext* context, | 290 ppapi::host::HostMessageContext* context, |
345 int64_t offset, | 291 int64_t offset, |
346 const std::string& buffer) { | 292 const std::string& buffer) { |
347 int32_t rv = state_manager_.CheckOperationState( | 293 int32_t rv = state_manager_.CheckOperationState( |
348 FileIOStateManager::OPERATION_WRITE, true); | 294 FileIOStateManager::OPERATION_WRITE, true); |
349 if (rv != PP_OK) | 295 if (rv != PP_OK) |
350 return rv; | 296 return rv; |
351 | 297 |
352 if (quota_file_io_) { | 298 if (quota_file_io_) { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); | 428 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); |
483 return PP_OK_COMPLETIONPENDING; | 429 return PP_OK_COMPLETIONPENDING; |
484 } | 430 } |
485 | 431 |
486 int32_t PepperFileIOHost::OnHostMsgRequestOSFileHandle( | 432 int32_t PepperFileIOHost::OnHostMsgRequestOSFileHandle( |
487 ppapi::host::HostMessageContext* context) { | 433 ppapi::host::HostMessageContext* context) { |
488 if (!is_running_in_process_ && | 434 if (!is_running_in_process_ && |
489 quota_policy_ != quota::kQuotaLimitTypeUnlimited) | 435 quota_policy_ != quota::kQuotaLimitTypeUnlimited) |
490 return PP_ERROR_FAILED; | 436 return PP_ERROR_FAILED; |
491 | 437 |
492 RendererPpapiHost* renderer_ppapi_host = | |
493 RendererPpapiHost::GetForPPInstance(pp_instance()); | |
494 | |
495 // Whitelist to make it privately accessible. | 438 // Whitelist to make it privately accessible. |
496 if (!GetContentClient()->renderer()->IsPluginAllowedToCallRequestOSFileHandle( | 439 if (!GetContentClient()->renderer()->IsPluginAllowedToCallRequestOSFileHandle( |
497 renderer_ppapi_host->GetContainerForInstance(pp_instance()))) | 440 renderer_ppapi_host_->GetContainerForInstance(pp_instance()))) |
498 return PP_ERROR_NOACCESS; | 441 return PP_ERROR_NOACCESS; |
499 | 442 |
500 IPC::PlatformFileForTransit file = | 443 IPC::PlatformFileForTransit file = |
501 renderer_ppapi_host->ShareHandleWithRemote(file_, false); | 444 renderer_ppapi_host_->ShareHandleWithRemote(file_, false); |
502 if (file == IPC::InvalidPlatformFileForTransit()) | 445 if (file == IPC::InvalidPlatformFileForTransit()) |
503 return PP_ERROR_FAILED; | 446 return PP_ERROR_FAILED; |
504 ppapi::host::ReplyMessageContext reply_context = | 447 ppapi::host::ReplyMessageContext reply_context = |
505 context->MakeReplyMessageContext(); | 448 context->MakeReplyMessageContext(); |
506 ppapi::proxy::SerializedHandle file_handle; | 449 ppapi::proxy::SerializedHandle file_handle; |
507 file_handle.set_file_handle(file, open_flags_); | 450 file_handle.set_file_handle(file, open_flags_); |
508 reply_context.params.AppendHandle(file_handle); | 451 reply_context.params.AppendHandle(file_handle); |
509 host()->SendReply(reply_context, | 452 host()->SendReply(reply_context, |
510 PpapiPluginMsg_FileIO_RequestOSFileHandleReply()); | 453 PpapiPluginMsg_FileIO_RequestOSFileHandleReply()); |
511 return PP_OK_COMPLETIONPENDING; | 454 return PP_OK_COMPLETIONPENDING; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 base::PlatformFileError error_code, | 487 base::PlatformFileError error_code, |
545 base::PassPlatformFile file) { | 488 base::PassPlatformFile file) { |
546 int32_t pp_error = ::ppapi::PlatformFileErrorToPepperError(error_code); | 489 int32_t pp_error = ::ppapi::PlatformFileErrorToPepperError(error_code); |
547 if (pp_error == PP_OK) | 490 if (pp_error == PP_OK) |
548 state_manager_.SetOpenSucceed(); | 491 state_manager_.SetOpenSucceed(); |
549 | 492 |
550 DCHECK(file_ == base::kInvalidPlatformFileValue); | 493 DCHECK(file_ == base::kInvalidPlatformFileValue); |
551 file_ = file.ReleaseValue(); | 494 file_ = file.ReleaseValue(); |
552 | 495 |
553 DCHECK(!quota_file_io_.get()); | 496 DCHECK(!quota_file_io_.get()); |
554 if (file_ != base::kInvalidPlatformFileValue && | 497 if (file_ != base::kInvalidPlatformFileValue) { |
555 (file_system_type_ == PP_FILESYSTEMTYPE_LOCALTEMPORARY || | 498 if (file_system_type_ == PP_FILESYSTEMTYPE_LOCALTEMPORARY || |
556 file_system_type_ == PP_FILESYSTEMTYPE_LOCALPERSISTENT)) { | 499 file_system_type_ == PP_FILESYSTEMTYPE_LOCALPERSISTENT) { |
557 quota_file_io_.reset(new QuotaFileIO( | 500 quota_file_io_.reset(new QuotaFileIO( |
558 new QuotaFileIODelegate, file_, file_system_url_, file_system_type_)); | 501 new QuotaFileIODelegate, file_, file_system_url_, file_system_type_)); |
| 502 } |
| 503 |
| 504 IPC::PlatformFileForTransit file_for_transit = |
| 505 renderer_ppapi_host_->ShareHandleWithRemote(file_, false); |
| 506 if (!(file_for_transit == IPC::InvalidPlatformFileForTransit())) { |
| 507 // Send the file descriptor to the plugin process. This is used in the |
| 508 // plugin for any file operations that can be done there. |
| 509 // IMPORTANT: Clear PP_FILEOPENFLAG_WRITE and PP_FILEOPENFLAG_APPEND so |
| 510 // the plugin can't bypass our quota checks. |
| 511 int32_t no_write_flags = |
| 512 open_flags_ & ~(PP_FILEOPENFLAG_WRITE | PP_FILEOPENFLAG_APPEND); |
| 513 ppapi::proxy::SerializedHandle file_handle; |
| 514 file_handle.set_file_handle(file_for_transit, no_write_flags); |
| 515 reply_context.params.AppendHandle(file_handle); |
| 516 } |
559 } | 517 } |
560 | 518 |
561 reply_context.params.set_result(pp_error); | 519 reply_context.params.set_result(pp_error); |
562 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_OpenReply()); | 520 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_OpenReply()); |
563 state_manager_.SetOperationFinished(); | 521 state_manager_.SetOperationFinished(); |
564 } | 522 } |
565 | 523 |
566 void PepperFileIOHost::ExecutePlatformOpenFileSystemURLCallback( | 524 void PepperFileIOHost::ExecutePlatformOpenFileSystemURLCallback( |
567 ppapi::host::ReplyMessageContext reply_context, | 525 ppapi::host::ReplyMessageContext reply_context, |
568 base::PlatformFileError error_code, | 526 base::PlatformFileError error_code, |
569 base::PassPlatformFile file, | 527 base::PassPlatformFile file, |
570 quota::QuotaLimitType quota_policy, | 528 quota::QuotaLimitType quota_policy, |
571 const PepperFileIOHost::NotifyCloseFileCallback& callback) { | 529 const PepperFileIOHost::NotifyCloseFileCallback& callback) { |
572 if (error_code == base::PLATFORM_FILE_OK) | 530 if (error_code == base::PLATFORM_FILE_OK) |
573 notify_close_file_callback_ = callback; | 531 notify_close_file_callback_ = callback; |
574 quota_policy_ = quota_policy; | 532 quota_policy_ = quota_policy; |
575 ExecutePlatformOpenFileCallback(reply_context, error_code, file); | 533 ExecutePlatformOpenFileCallback(reply_context, error_code, file); |
576 } | 534 } |
577 | 535 |
578 void PepperFileIOHost::ExecutePlatformQueryCallback( | |
579 ppapi::host::ReplyMessageContext reply_context, | |
580 base::PlatformFileError error_code, | |
581 const base::PlatformFileInfo& file_info) { | |
582 PP_FileInfo pp_info; | |
583 ppapi::PlatformFileInfoToPepperFileInfo(file_info, file_system_type_, | |
584 &pp_info); | |
585 | |
586 int32_t pp_error = ::ppapi::PlatformFileErrorToPepperError(error_code); | |
587 reply_context.params.set_result(pp_error); | |
588 host()->SendReply(reply_context, | |
589 PpapiPluginMsg_FileIO_QueryReply(pp_info)); | |
590 state_manager_.SetOperationFinished(); | |
591 } | |
592 | |
593 void PepperFileIOHost::ExecutePlatformReadCallback( | |
594 ppapi::host::ReplyMessageContext reply_context, | |
595 base::PlatformFileError error_code, | |
596 const char* data, int bytes_read) { | |
597 int32_t pp_error = ::ppapi::PlatformFileErrorToPepperError(error_code); | |
598 | |
599 // Only send the amount of data in the string that was actually read. | |
600 std::string buffer; | |
601 if (pp_error == PP_OK) | |
602 buffer.append(data, bytes_read); | |
603 reply_context.params.set_result(ErrorOrByteNumber(pp_error, bytes_read)); | |
604 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_ReadReply(buffer)); | |
605 state_manager_.SetOperationFinished(); | |
606 } | |
607 | |
608 void PepperFileIOHost::ExecutePlatformWriteCallback( | 536 void PepperFileIOHost::ExecutePlatformWriteCallback( |
609 ppapi::host::ReplyMessageContext reply_context, | 537 ppapi::host::ReplyMessageContext reply_context, |
610 base::PlatformFileError error_code, | 538 base::PlatformFileError error_code, |
611 int bytes_written) { | 539 int bytes_written) { |
612 // On the plugin side, the callback expects a parameter with different meaning | 540 // On the plugin side, the callback expects a parameter with different meaning |
613 // depends on whether is negative or not. It is the result here. We translate | 541 // depends on whether is negative or not. It is the result here. We translate |
614 // for the callback. | 542 // for the callback. |
615 int32_t pp_error = ::ppapi::PlatformFileErrorToPepperError(error_code); | 543 int32_t pp_error = ::ppapi::PlatformFileErrorToPepperError(error_code); |
616 reply_context.params.set_result(ErrorOrByteNumber(pp_error, bytes_written)); | 544 reply_context.params.set_result(ErrorOrByteNumber(pp_error, bytes_written)); |
617 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_GeneralReply()); | 545 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_GeneralReply()); |
618 state_manager_.SetOperationFinished(); | 546 state_manager_.SetOperationFinished(); |
619 } | 547 } |
620 | 548 |
621 } // namespace content | 549 } // namespace content |
OLD | NEW |