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/ppb_file_ref_impl.h" | 5 #include "content/renderer/pepper/ppb_file_ref_impl.h" |
6 | 6 |
7 #include "base/files/file_util_proxy.h" | 7 #include "base/files/file_util_proxy.h" |
8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "content/child/fileapi/file_system_dispatcher.h" | 11 #include "content/child/fileapi/file_system_dispatcher.h" |
12 #include "content/renderer/pepper/common.h" | 12 #include "content/renderer/pepper/common.h" |
13 #include "content/renderer/pepper/pepper_file_system_host.h" | 13 #include "content/renderer/pepper/pepper_file_system_host.h" |
14 #include "content/renderer/pepper/pepper_helper_impl.h" | 14 #include "content/renderer/pepper/pepper_helper_impl.h" |
15 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 15 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
16 #include "content/renderer/pepper/plugin_module.h" | 16 #include "content/renderer/pepper/plugin_module.h" |
17 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 17 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
18 #include "content/renderer/pepper/resource_helper.h" | 18 #include "content/renderer/pepper/resource_helper.h" |
19 #include "content/renderer/render_thread_impl.h" | 19 #include "content/renderer/render_thread_impl.h" |
20 #include "net/base/escape.h" | 20 #include "net/base/escape.h" |
21 #include "ppapi/c/pp_errors.h" | 21 #include "ppapi/c/pp_errors.h" |
| 22 #include "ppapi/c/ppb_file_io.h" |
22 #include "ppapi/host/ppapi_host.h" | 23 #include "ppapi/host/ppapi_host.h" |
23 #include "ppapi/shared_impl/file_type_conversion.h" | 24 #include "ppapi/shared_impl/file_type_conversion.h" |
24 #include "ppapi/shared_impl/time_conversion.h" | 25 #include "ppapi/shared_impl/time_conversion.h" |
25 #include "ppapi/shared_impl/var.h" | 26 #include "ppapi/shared_impl/var.h" |
26 #include "ppapi/thunk/enter.h" | 27 #include "ppapi/thunk/enter.h" |
27 #include "ppapi/thunk/ppb_file_system_api.h" | 28 #include "ppapi/thunk/ppb_file_system_api.h" |
28 #include "url/gurl.h" | 29 #include "url/gurl.h" |
29 #include "webkit/common/fileapi/directory_entry.h" | 30 #include "webkit/common/fileapi/directory_entry.h" |
30 #include "webkit/common/fileapi/file_system_util.h" | 31 #include "webkit/common/fileapi/file_system_util.h" |
31 | 32 |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 | 462 |
462 if (!file_system_) { | 463 if (!file_system_) { |
463 // External file system | 464 // External file system |
464 // We have to do something totally different for external file systems. | 465 // We have to do something totally different for external file systems. |
465 | 466 |
466 // TODO(teravest): Use the SequencedWorkerPool instead. | 467 // TODO(teravest): Use the SequencedWorkerPool instead. |
467 scoped_refptr<base::TaskRunner> task_runner = | 468 scoped_refptr<base::TaskRunner> task_runner = |
468 RenderThreadImpl::current()->GetFileThreadMessageLoopProxy(); | 469 RenderThreadImpl::current()->GetFileThreadMessageLoopProxy(); |
469 if (!plugin_instance->helper()->AsyncOpenFile( | 470 if (!plugin_instance->helper()->AsyncOpenFile( |
470 GetSystemPath(), | 471 GetSystemPath(), |
471 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, | 472 PP_FILEOPENFLAG_READ, |
472 base::Bind(&QueryCallback, task_runner, info, callback))) | 473 base::Bind(&QueryCallback, task_runner, info, callback))) |
473 return PP_ERROR_FAILED; | 474 return PP_ERROR_FAILED; |
474 } else { | 475 } else { |
475 // Non-external file system | 476 // Non-external file system |
476 if (!HasValidFileSystem()) | 477 if (!HasValidFileSystem()) |
477 return PP_ERROR_NOACCESS; | 478 return PP_ERROR_NOACCESS; |
478 | 479 |
479 PP_FileSystemType file_system_type = GetResourceHost()-> | 480 PP_FileSystemType file_system_type = GetResourceHost()-> |
480 AsPepperFileSystemHost()->GetType(); | 481 AsPepperFileSystemHost()->GetType(); |
481 FileSystemDispatcher* file_system_dispatcher = | 482 FileSystemDispatcher* file_system_dispatcher = |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 ppapi::host::ResourceHost* PPB_FileRef_Impl::GetResourceHostInternal( | 522 ppapi::host::ResourceHost* PPB_FileRef_Impl::GetResourceHostInternal( |
522 PP_Instance instance, PP_Resource resource) { | 523 PP_Instance instance, PP_Resource resource) { |
523 const ppapi::host::PpapiHost* ppapi_host = | 524 const ppapi::host::PpapiHost* ppapi_host = |
524 RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost(); | 525 RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost(); |
525 if (!resource || !ppapi_host) | 526 if (!resource || !ppapi_host) |
526 return NULL; | 527 return NULL; |
527 return ppapi_host->GetResourceHost(resource); | 528 return ppapi_host->GetResourceHost(resource); |
528 } | 529 } |
529 | 530 |
530 } // namespace content | 531 } // namespace content |
OLD | NEW |