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_plugin_delegate_impl.h" |
14 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 15 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
15 #include "content/renderer/pepper/plugin_delegate.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/host/ppapi_host.h" | 22 #include "ppapi/host/ppapi_host.h" |
23 #include "ppapi/shared_impl/file_type_conversion.h" | 23 #include "ppapi/shared_impl/file_type_conversion.h" |
24 #include "ppapi/shared_impl/time_conversion.h" | 24 #include "ppapi/shared_impl/time_conversion.h" |
25 #include "ppapi/shared_impl/var.h" | 25 #include "ppapi/shared_impl/var.h" |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 ResourceHelper::GetPluginInstance(this); | 458 ResourceHelper::GetPluginInstance(this); |
459 if (!plugin_instance.get()) | 459 if (!plugin_instance.get()) |
460 return PP_ERROR_FAILED; | 460 return PP_ERROR_FAILED; |
461 | 461 |
462 if (!file_system_) { | 462 if (!file_system_) { |
463 // External file system | 463 // External file system |
464 // We have to do something totally different for external file systems. | 464 // We have to do something totally different for external file systems. |
465 | 465 |
466 // TODO(teravest): Use the SequencedWorkerPool instead. | 466 // TODO(teravest): Use the SequencedWorkerPool instead. |
467 scoped_refptr<base::TaskRunner> task_runner = | 467 scoped_refptr<base::TaskRunner> task_runner = |
468 plugin_instance->delegate()->GetFileThreadMessageLoopProxy(); | 468 RenderThreadImpl::current()->GetFileThreadMessageLoopProxy(); |
469 if (!plugin_instance->delegate()->AsyncOpenFile( | 469 if (!plugin_instance->delegate()->AsyncOpenFile( |
470 GetSystemPath(), | 470 GetSystemPath(), |
471 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, | 471 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, |
472 base::Bind(&QueryCallback, task_runner, info, callback))) | 472 base::Bind(&QueryCallback, task_runner, info, callback))) |
473 return PP_ERROR_FAILED; | 473 return PP_ERROR_FAILED; |
474 } else { | 474 } else { |
475 // Non-external file system | 475 // Non-external file system |
476 if (!HasValidFileSystem()) | 476 if (!HasValidFileSystem()) |
477 return PP_ERROR_NOACCESS; | 477 return PP_ERROR_NOACCESS; |
478 | 478 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 ppapi::host::ResourceHost* PPB_FileRef_Impl::GetResourceHostInternal( | 521 ppapi::host::ResourceHost* PPB_FileRef_Impl::GetResourceHostInternal( |
522 PP_Instance instance, PP_Resource resource) { | 522 PP_Instance instance, PP_Resource resource) { |
523 const ppapi::host::PpapiHost* ppapi_host = | 523 const ppapi::host::PpapiHost* ppapi_host = |
524 RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost(); | 524 RendererPpapiHost::GetForPPInstance(instance)->GetPpapiHost(); |
525 if (!resource || !ppapi_host) | 525 if (!resource || !ppapi_host) |
526 return NULL; | 526 return NULL; |
527 return ppapi_host->GetResourceHost(resource); | 527 return ppapi_host->GetResourceHost(resource); |
528 } | 528 } |
529 | 529 |
530 } // namespace content | 530 } // namespace content |
OLD | NEW |