| 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/file_system.h" | 9 #include "ppapi/cpp/file_system.h" |
| 10 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
| 11 | 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>() { |
| 22 return PPB_FILEREF_INTERFACE_1_1; |
| 23 } |
| 24 |
| 21 } // namespace | 25 } // namespace |
| 22 | 26 |
| 23 FileRef::FileRef(PP_Resource resource) : Resource(resource) { | 27 FileRef::FileRef(PP_Resource resource) : Resource(resource) { |
| 24 } | 28 } |
| 25 | 29 |
| 26 FileRef::FileRef(PassRef, PP_Resource resource) : Resource(PASS_REF, resource) { | 30 FileRef::FileRef(PassRef, PP_Resource resource) : Resource(PASS_REF, resource) { |
| 27 } | 31 } |
| 28 | 32 |
| 29 FileRef::FileRef(const FileSystem& file_system, | 33 FileRef::FileRef(const FileSystem& file_system, |
| 30 const char* path) { | 34 const char* path) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 106 } |
| 103 | 107 |
| 104 int32_t FileRef::Rename(const FileRef& new_file_ref, | 108 int32_t FileRef::Rename(const FileRef& new_file_ref, |
| 105 const CompletionCallback& cc) { | 109 const CompletionCallback& cc) { |
| 106 if (!has_interface<PPB_FileRef_1_0>()) | 110 if (!has_interface<PPB_FileRef_1_0>()) |
| 107 return cc.MayForce(PP_ERROR_NOINTERFACE); | 111 return cc.MayForce(PP_ERROR_NOINTERFACE); |
| 108 return get_interface<PPB_FileRef_1_0>()->Rename( | 112 return get_interface<PPB_FileRef_1_0>()->Rename( |
| 109 pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback()); | 113 pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback()); |
| 110 } | 114 } |
| 111 | 115 |
| 116 int32_t FileRef::Query(const CompletionCallbackWithOutput<PP_FileInfo>& cc) { |
| 117 if (!has_interface<PPB_FileRef_1_1>()) |
| 118 return cc.MayForce(PP_ERROR_NOINTERFACE); |
| 119 return get_interface<PPB_FileRef_1_1>()->Query( |
| 120 pp_resource(), cc.output(), cc.pp_completion_callback()); |
| 121 } |
| 122 |
| 123 |
| 112 } // namespace pp | 124 } // namespace pp |
| OLD | NEW |