| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 return PP_ERROR_BADARGUMENT; | 142 return PP_ERROR_BADARGUMENT; |
| 143 | 143 |
| 144 EnterResourceNoLock<PPB_FileRef_API> enter(file_ref_resource, true); | 144 EnterResourceNoLock<PPB_FileRef_API> enter(file_ref_resource, true); |
| 145 if (enter.failed()) | 145 if (enter.failed()) |
| 146 return PP_ERROR_BADRESOURCE; | 146 return PP_ERROR_BADRESOURCE; |
| 147 | 147 |
| 148 PPB_FileRef_API* file_ref_api = enter.object(); | 148 PPB_FileRef_API* file_ref_api = enter.object(); |
| 149 PP_FileSystemType type = file_ref_api->GetFileSystemType(); | 149 PP_FileSystemType type = file_ref_api->GetFileSystemType(); |
| 150 if (type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && | 150 if (type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && |
| 151 type != PP_FILESYSTEMTYPE_LOCALTEMPORARY && | 151 type != PP_FILESYSTEMTYPE_LOCALTEMPORARY && |
| 152 type != PP_FILESYSTEMTYPE_EXTERNAL) | 152 type != PP_FILESYSTEMTYPE_EXTERNAL && |
| 153 type != PP_FILESYSTEMTYPE_ISOLATED) |
| 153 return PP_ERROR_FAILED; | 154 return PP_ERROR_FAILED; |
| 154 file_system_type_ = type; | 155 file_system_type_ = type; |
| 155 | 156 |
| 156 if (!plugin_delegate_) | 157 if (!plugin_delegate_) |
| 157 return PP_ERROR_FAILED; | 158 return PP_ERROR_FAILED; |
| 158 | 159 |
| 159 PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(file_ref_api); | 160 PPB_FileRef_Impl* file_ref = static_cast<PPB_FileRef_Impl*>(file_ref_api); |
| 160 if (file_ref->HasValidFileSystem()) { | 161 if (file_ref->HasValidFileSystem()) { |
| 161 file_system_url_ = file_ref->GetFileSystemURL(); | 162 file_system_url_ = file_ref->GetFileSystemURL(); |
| 162 if (!plugin_delegate_->AsyncOpenFileSystemURL( | 163 if (!plugin_delegate_->AsyncOpenFileSystemURL( |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // On the plugin side, the callback expects a parameter with different meaning | 558 // 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 | 559 // depends on whether is negative or not. It is the result here. We translate |
| 559 // for the callback. | 560 // for the callback. |
| 560 int32_t pp_error = ::ppapi::PlatformFileErrorToPepperError(error_code); | 561 int32_t pp_error = ::ppapi::PlatformFileErrorToPepperError(error_code); |
| 561 reply_context.params.set_result(ErrorOrByteNumber(pp_error, bytes_written)); | 562 reply_context.params.set_result(ErrorOrByteNumber(pp_error, bytes_written)); |
| 562 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_GeneralReply()); | 563 host()->SendReply(reply_context, PpapiPluginMsg_FileIO_GeneralReply()); |
| 563 state_manager_.SetOperationFinished(); | 564 state_manager_.SetOperationFinished(); |
| 564 } | 565 } |
| 565 | 566 |
| 566 } // namespace content | 567 } // namespace content |
| OLD | NEW |