| 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_internal_file_ref_backend.
h" | 5 #include "content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.
h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 return PP_OK_COMPLETIONPENDING; | 163 return PP_OK_COMPLETIONPENDING; |
| 164 } | 164 } |
| 165 | 165 |
| 166 int32_t PepperInternalFileRefBackend::Query( | 166 int32_t PepperInternalFileRefBackend::Query( |
| 167 ppapi::host::ReplyMessageContext reply_context) { | 167 ppapi::host::ReplyMessageContext reply_context) { |
| 168 if (!GetFileSystemURL().is_valid()) | 168 if (!GetFileSystemURL().is_valid()) |
| 169 return PP_ERROR_FAILED; | 169 return PP_ERROR_FAILED; |
| 170 | 170 |
| 171 GetFileSystemContext()->operation_runner()->GetMetadata( | 171 GetFileSystemContext()->operation_runner()->GetMetadata( |
| 172 GetFileSystemURL(), | 172 GetFileSystemURL(), |
| 173 storage::FileSystemOperation::GET_METADATA_FIELD_IS_DIRECTORY | |
| 174 storage::FileSystemOperation::GET_METADATA_FIELD_SIZE | |
| 175 storage::FileSystemOperation::GET_METADATA_FIELD_LAST_MODIFIED, |
| 173 base::Bind(&PepperInternalFileRefBackend::GetMetadataComplete, | 176 base::Bind(&PepperInternalFileRefBackend::GetMetadataComplete, |
| 174 weak_factory_.GetWeakPtr(), | 177 weak_factory_.GetWeakPtr(), reply_context)); |
| 175 reply_context)); | |
| 176 return PP_OK_COMPLETIONPENDING; | 178 return PP_OK_COMPLETIONPENDING; |
| 177 } | 179 } |
| 178 | 180 |
| 179 void PepperInternalFileRefBackend::GetMetadataComplete( | 181 void PepperInternalFileRefBackend::GetMetadataComplete( |
| 180 ppapi::host::ReplyMessageContext reply_context, | 182 ppapi::host::ReplyMessageContext reply_context, |
| 181 base::File::Error error, | 183 base::File::Error error, |
| 182 const base::File::Info& file_info) { | 184 const base::File::Info& file_info) { |
| 183 reply_context.params.set_result(ppapi::FileErrorToPepperError(error)); | 185 reply_context.params.set_result(ppapi::FileErrorToPepperError(error)); |
| 184 | 186 |
| 185 PP_FileInfo pp_file_info; | 187 PP_FileInfo pp_file_info; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 ChildProcessSecurityPolicyImpl* policy = | 302 ChildProcessSecurityPolicyImpl* policy = |
| 301 ChildProcessSecurityPolicyImpl::GetInstance(); | 303 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 302 if (!policy->CanReadFileSystemFile(render_process_id_, url) || | 304 if (!policy->CanReadFileSystemFile(render_process_id_, url) || |
| 303 !policy->CanWriteFileSystemFile(render_process_id_, url)) { | 305 !policy->CanWriteFileSystemFile(render_process_id_, url)) { |
| 304 return PP_ERROR_NOACCESS; | 306 return PP_ERROR_NOACCESS; |
| 305 } | 307 } |
| 306 return PP_OK; | 308 return PP_OK; |
| 307 } | 309 } |
| 308 | 310 |
| 309 } // namespace content | 311 } // namespace content |
| OLD | NEW |