| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/glue/plugins/pepper_directory_reader.h" | 5 #include "webkit/glue/plugins/pepper_directory_reader.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "ppapi/c/pp_completion_callback.h" | 9 #include "ppapi/c/pp_completion_callback.h" |
| 10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| 11 #include "ppapi/c/dev/ppb_directory_reader_dev.h" | 11 #include "ppapi/c/dev/ppb_directory_reader_dev.h" |
| 12 #include "webkit/glue/plugins/pepper_file_callbacks.h" | 12 #include "webkit/glue/plugins/pepper_file_callbacks.h" |
| 13 #include "webkit/glue/plugins/pepper_common.h" |
| 13 #include "webkit/glue/plugins/pepper_file_ref.h" | 14 #include "webkit/glue/plugins/pepper_file_ref.h" |
| 14 #include "webkit/glue/plugins/pepper_file_system.h" | 15 #include "webkit/glue/plugins/pepper_file_system.h" |
| 15 #include "webkit/glue/plugins/pepper_plugin_delegate.h" | 16 #include "webkit/glue/plugins/pepper_plugin_delegate.h" |
| 16 #include "webkit/glue/plugins/pepper_plugin_instance.h" | 17 #include "webkit/glue/plugins/pepper_plugin_instance.h" |
| 17 #include "webkit/glue/plugins/pepper_plugin_module.h" | 18 #include "webkit/glue/plugins/pepper_plugin_module.h" |
| 18 #include "webkit/glue/plugins/pepper_resource_tracker.h" | 19 #include "webkit/glue/plugins/pepper_resource_tracker.h" |
| 19 | 20 |
| 20 namespace pepper { | 21 namespace pepper { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 44 PP_Resource Create(PP_Resource directory_ref_id) { | 45 PP_Resource Create(PP_Resource directory_ref_id) { |
| 45 scoped_refptr<FileRef> directory_ref( | 46 scoped_refptr<FileRef> directory_ref( |
| 46 Resource::GetAs<FileRef>(directory_ref_id)); | 47 Resource::GetAs<FileRef>(directory_ref_id)); |
| 47 if (!directory_ref) | 48 if (!directory_ref) |
| 48 return 0; | 49 return 0; |
| 49 | 50 |
| 50 DirectoryReader* reader = new DirectoryReader(directory_ref); | 51 DirectoryReader* reader = new DirectoryReader(directory_ref); |
| 51 return reader->GetReference(); | 52 return reader->GetReference(); |
| 52 } | 53 } |
| 53 | 54 |
| 54 bool IsDirectoryReader(PP_Resource resource) { | 55 PP_Bool IsDirectoryReader(PP_Resource resource) { |
| 55 return !!Resource::GetAs<DirectoryReader>(resource); | 56 return BoolToPPBool(!!Resource::GetAs<DirectoryReader>(resource)); |
| 56 } | 57 } |
| 57 | 58 |
| 58 int32_t GetNextEntry(PP_Resource reader_id, | 59 int32_t GetNextEntry(PP_Resource reader_id, |
| 59 PP_DirectoryEntry_Dev* entry, | 60 PP_DirectoryEntry_Dev* entry, |
| 60 PP_CompletionCallback callback) { | 61 PP_CompletionCallback callback) { |
| 61 scoped_refptr<DirectoryReader> reader( | 62 scoped_refptr<DirectoryReader> reader( |
| 62 Resource::GetAs<DirectoryReader>(reader_id)); | 63 Resource::GetAs<DirectoryReader>(reader_id)); |
| 63 if (!reader) | 64 if (!reader) |
| 64 return PP_ERROR_BADRESOURCE; | 65 return PP_ERROR_BADRESOURCE; |
| 65 | 66 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 147 |
| 147 if (!has_more_) { | 148 if (!has_more_) { |
| 148 entry_->file_ref = 0; | 149 entry_->file_ref = 0; |
| 149 return true; | 150 return true; |
| 150 } | 151 } |
| 151 | 152 |
| 152 return false; | 153 return false; |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace pepper | 156 } // namespace pepper |
| OLD | NEW |