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/renderer/pepper/common.h" | 11 #include "content/renderer/pepper/common.h" |
12 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 12 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
13 #include "content/renderer/pepper/plugin_delegate.h" | 13 #include "content/renderer/pepper/plugin_delegate.h" |
14 #include "content/renderer/pepper/plugin_module.h" | 14 #include "content/renderer/pepper/plugin_module.h" |
15 #include "content/renderer/pepper/resource_helper.h" | 15 #include "content/renderer/pepper/resource_helper.h" |
16 #include "net/base/escape.h" | 16 #include "net/base/escape.h" |
17 #include "ppapi/c/pp_errors.h" | 17 #include "ppapi/c/pp_errors.h" |
| 18 #include "ppapi/c/ppb_file_io.h" |
18 #include "ppapi/shared_impl/file_type_conversion.h" | 19 #include "ppapi/shared_impl/file_type_conversion.h" |
19 #include "ppapi/shared_impl/time_conversion.h" | 20 #include "ppapi/shared_impl/time_conversion.h" |
20 #include "ppapi/shared_impl/var.h" | 21 #include "ppapi/shared_impl/var.h" |
21 #include "ppapi/thunk/enter.h" | 22 #include "ppapi/thunk/enter.h" |
22 #include "ppapi/thunk/ppb_file_system_api.h" | 23 #include "ppapi/thunk/ppb_file_system_api.h" |
23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
24 #include "webkit/common/fileapi/directory_entry.h" | 25 #include "webkit/common/fileapi/directory_entry.h" |
25 #include "webkit/common/fileapi/file_system_util.h" | 26 #include "webkit/common/fileapi/file_system_util.h" |
26 | 27 |
27 using ppapi::HostResource; | 28 using ppapi::HostResource; |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 | 454 |
454 if (!file_system_) { | 455 if (!file_system_) { |
455 // External file system | 456 // External file system |
456 // We have to do something totally different for external file systems. | 457 // We have to do something totally different for external file systems. |
457 | 458 |
458 // TODO(teravest): Use the SequencedWorkerPool instead. | 459 // TODO(teravest): Use the SequencedWorkerPool instead. |
459 scoped_refptr<base::TaskRunner> task_runner = | 460 scoped_refptr<base::TaskRunner> task_runner = |
460 plugin_instance->delegate()->GetFileThreadMessageLoopProxy(); | 461 plugin_instance->delegate()->GetFileThreadMessageLoopProxy(); |
461 if (!plugin_instance->delegate()->AsyncOpenFile( | 462 if (!plugin_instance->delegate()->AsyncOpenFile( |
462 GetSystemPath(), | 463 GetSystemPath(), |
463 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, | 464 PP_FILEOPENFLAG_READ, |
464 base::Bind(&QueryCallback, task_runner, info, callback))) | 465 base::Bind(&QueryCallback, task_runner, info, callback))) |
465 return PP_ERROR_FAILED; | 466 return PP_ERROR_FAILED; |
466 } else { | 467 } else { |
467 // Non-external file system | 468 // Non-external file system |
468 if (!HasValidFileSystem()) | 469 if (!HasValidFileSystem()) |
469 return PP_ERROR_NOACCESS; | 470 return PP_ERROR_NOACCESS; |
470 | 471 |
471 PepperPluginInstanceImpl* plugin_instance = | 472 PepperPluginInstanceImpl* plugin_instance = |
472 ResourceHelper::GetPluginInstance(this); | 473 ResourceHelper::GetPluginInstance(this); |
473 PluginDelegate* delegate = | 474 PluginDelegate* delegate = |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 // be dangerous. | 509 // be dangerous. |
509 plugin_instance->delegate()->ReadDirectoryEntries( | 510 plugin_instance->delegate()->ReadDirectoryEntries( |
510 GetFileSystemURL(), | 511 GetFileSystemURL(), |
511 base::Bind(&DidReadDirectory, | 512 base::Bind(&DidReadDirectory, |
512 callback, base::Unretained(this), files, file_types), | 513 callback, base::Unretained(this), files, file_types), |
513 base::Bind(&DidFinishFileOperation, callback)); | 514 base::Bind(&DidFinishFileOperation, callback)); |
514 return PP_OK_COMPLETIONPENDING; | 515 return PP_OK_COMPLETIONPENDING; |
515 } | 516 } |
516 | 517 |
517 } // namespace content | 518 } // namespace content |
OLD | NEW |