| 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 "ppapi/cpp/file_ref.h" | 5 #include "ppapi/cpp/file_ref.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/cpp/completion_callback.h" | 8 #include "ppapi/cpp/completion_callback.h" |
| 9 #include "ppapi/cpp/directory_entry.h" |
| 9 #include "ppapi/cpp/file_system.h" | 10 #include "ppapi/cpp/file_system.h" |
| 10 #include "ppapi/cpp/module_impl.h" | 11 #include "ppapi/cpp/module_impl.h" |
| 11 | 12 |
| 12 | |
| 13 namespace pp { | 13 namespace pp { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 template <> const char* interface_name<PPB_FileRef_1_0>() { | 17 template <> const char* interface_name<PPB_FileRef_1_0>() { |
| 18 return PPB_FILEREF_INTERFACE_1_0; | 18 return PPB_FILEREF_INTERFACE_1_0; |
| 19 } | 19 } |
| 20 | 20 |
| 21 template <> const char* interface_name<PPB_FileRef_1_1>() { | 21 template <> const char* interface_name<PPB_FileRef_1_1>() { |
| 22 return PPB_FILEREF_INTERFACE_1_1; | 22 return PPB_FILEREF_INTERFACE_1_1; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 return cc.MayForce(PP_ERROR_NOINTERFACE); | 163 return cc.MayForce(PP_ERROR_NOINTERFACE); |
| 164 } | 164 } |
| 165 | 165 |
| 166 int32_t FileRef::Query(const CompletionCallbackWithOutput<PP_FileInfo>& cc) { | 166 int32_t FileRef::Query(const CompletionCallbackWithOutput<PP_FileInfo>& cc) { |
| 167 if (!has_interface<PPB_FileRef_1_1>()) | 167 if (!has_interface<PPB_FileRef_1_1>()) |
| 168 return cc.MayForce(PP_ERROR_NOINTERFACE); | 168 return cc.MayForce(PP_ERROR_NOINTERFACE); |
| 169 return get_interface<PPB_FileRef_1_1>()->Query( | 169 return get_interface<PPB_FileRef_1_1>()->Query( |
| 170 pp_resource(), cc.output(), cc.pp_completion_callback()); | 170 pp_resource(), cc.output(), cc.pp_completion_callback()); |
| 171 } | 171 } |
| 172 | 172 |
| 173 int32_t FileRef::ReadDirectoryEntries( |
| 174 const CompletionCallbackWithOutput<std::vector<DirectoryEntry> >& |
| 175 callback) { |
| 176 if (!has_interface<PPB_FileRef_1_1>()) |
| 177 return callback.MayForce(PP_ERROR_NOINTERFACE); |
| 178 return get_interface<PPB_FileRef_1_1>()->ReadDirectoryEntries( |
| 179 pp_resource(), callback.output(), callback.pp_completion_callback()); |
| 180 } |
| 173 | 181 |
| 174 } // namespace pp | 182 } // namespace pp |
| OLD | NEW |