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 "webkit/plugins/ppapi/ppb_file_ref_impl.h" | 5 #include "webkit/plugins/ppapi/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 "net/base/escape.h" | 11 #include "net/base/escape.h" |
12 #include "ppapi/c/pp_errors.h" | 12 #include "ppapi/c/pp_errors.h" |
| 13 #include "ppapi/c/ppb_file_io.h" |
13 #include "ppapi/shared_impl/file_type_conversion.h" | 14 #include "ppapi/shared_impl/file_type_conversion.h" |
14 #include "ppapi/shared_impl/time_conversion.h" | 15 #include "ppapi/shared_impl/time_conversion.h" |
15 #include "ppapi/shared_impl/var.h" | 16 #include "ppapi/shared_impl/var.h" |
16 #include "ppapi/thunk/enter.h" | 17 #include "ppapi/thunk/enter.h" |
17 #include "ppapi/thunk/ppb_file_system_api.h" | 18 #include "ppapi/thunk/ppb_file_system_api.h" |
18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
19 #include "webkit/common/fileapi/directory_entry.h" | 20 #include "webkit/common/fileapi/directory_entry.h" |
20 #include "webkit/common/fileapi/file_system_util.h" | 21 #include "webkit/common/fileapi/file_system_util.h" |
21 #include "webkit/plugins/ppapi/common.h" | 22 #include "webkit/plugins/ppapi/common.h" |
22 #include "webkit/plugins/ppapi/plugin_delegate.h" | 23 #include "webkit/plugins/ppapi/plugin_delegate.h" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 448 |
448 if (!file_system_) { | 449 if (!file_system_) { |
449 // External file system | 450 // External file system |
450 // We have to do something totally different for external file systems. | 451 // We have to do something totally different for external file systems. |
451 | 452 |
452 // TODO(teravest): Use the SequencedWorkerPool instead. | 453 // TODO(teravest): Use the SequencedWorkerPool instead. |
453 scoped_refptr<base::TaskRunner> task_runner = | 454 scoped_refptr<base::TaskRunner> task_runner = |
454 plugin_instance->delegate()->GetFileThreadMessageLoopProxy(); | 455 plugin_instance->delegate()->GetFileThreadMessageLoopProxy(); |
455 if (!plugin_instance->delegate()->AsyncOpenFile( | 456 if (!plugin_instance->delegate()->AsyncOpenFile( |
456 GetSystemPath(), | 457 GetSystemPath(), |
457 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, | 458 PP_FILEOPENFLAG_READ, |
458 base::Bind(&QueryCallback, task_runner, info, callback))) | 459 base::Bind(&QueryCallback, task_runner, info, callback))) |
459 return PP_ERROR_FAILED; | 460 return PP_ERROR_FAILED; |
460 } else { | 461 } else { |
461 // Non-external file system | 462 // Non-external file system |
462 if (!HasValidFileSystem()) | 463 if (!HasValidFileSystem()) |
463 return PP_ERROR_NOACCESS; | 464 return PP_ERROR_NOACCESS; |
464 | 465 |
465 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); | 466 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); |
466 PluginDelegate* delegate = | 467 PluginDelegate* delegate = |
467 plugin_instance ? plugin_instance->delegate() : NULL; | 468 plugin_instance ? plugin_instance->delegate() : NULL; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 plugin_instance->delegate()->ReadDirectoryEntries( | 502 plugin_instance->delegate()->ReadDirectoryEntries( |
502 GetFileSystemURL(), | 503 GetFileSystemURL(), |
503 base::Bind(&DidReadDirectory, | 504 base::Bind(&DidReadDirectory, |
504 callback, base::Unretained(this), files, file_types), | 505 callback, base::Unretained(this), files, file_types), |
505 base::Bind(&DidFinishFileOperation, callback)); | 506 base::Bind(&DidFinishFileOperation, callback)); |
506 return PP_OK_COMPLETIONPENDING; | 507 return PP_OK_COMPLETIONPENDING; |
507 } | 508 } |
508 | 509 |
509 } // namespace ppapi | 510 } // namespace ppapi |
510 } // namespace webkit | 511 } // namespace webkit |
OLD | NEW |