OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 FileRef FileRef::GetParent() const { | 62 FileRef FileRef::GetParent() const { |
63 if (!has_interface<PPB_FileRef>()) | 63 if (!has_interface<PPB_FileRef>()) |
64 return FileRef(); | 64 return FileRef(); |
65 return FileRef(PassRef(), | 65 return FileRef(PassRef(), |
66 get_interface<PPB_FileRef>()->GetParent( | 66 get_interface<PPB_FileRef>()->GetParent( |
67 pp_resource())); | 67 pp_resource())); |
68 } | 68 } |
69 | 69 |
70 int32_t FileRef::MakeDirectory(const CompletionCallback& cc) { | 70 int32_t FileRef::MakeDirectory(const CompletionCallback& cc) { |
71 if (!has_interface<PPB_FileRef>()) | 71 if (!has_interface<PPB_FileRef>()) |
72 return PP_ERROR_NOINTERFACE; | 72 return cc.MayForce(PP_ERROR_NOINTERFACE); |
73 return get_interface<PPB_FileRef>()->MakeDirectory( | 73 return get_interface<PPB_FileRef>()->MakeDirectory( |
74 pp_resource(), | 74 pp_resource(), |
75 PP_FALSE, // make_ancestors | 75 PP_FALSE, // make_ancestors |
76 cc.pp_completion_callback()); | 76 cc.pp_completion_callback()); |
77 } | 77 } |
78 | 78 |
79 int32_t FileRef::MakeDirectoryIncludingAncestors( | 79 int32_t FileRef::MakeDirectoryIncludingAncestors( |
80 const CompletionCallback& cc) { | 80 const CompletionCallback& cc) { |
81 if (!has_interface<PPB_FileRef>()) | 81 if (!has_interface<PPB_FileRef>()) |
82 return PP_ERROR_NOINTERFACE; | 82 return cc.MayForce(PP_ERROR_NOINTERFACE); |
83 return get_interface<PPB_FileRef>()->MakeDirectory( | 83 return get_interface<PPB_FileRef>()->MakeDirectory( |
84 pp_resource(), | 84 pp_resource(), |
85 PP_TRUE, // make_ancestors | 85 PP_TRUE, // make_ancestors |
86 cc.pp_completion_callback()); | 86 cc.pp_completion_callback()); |
87 } | 87 } |
88 | 88 |
89 int32_t FileRef::Touch(PP_Time last_access_time, | 89 int32_t FileRef::Touch(PP_Time last_access_time, |
90 PP_Time last_modified_time, | 90 PP_Time last_modified_time, |
91 const CompletionCallback& cc) { | 91 const CompletionCallback& cc) { |
92 if (!has_interface<PPB_FileRef>()) | 92 if (!has_interface<PPB_FileRef>()) |
93 return PP_ERROR_NOINTERFACE; | 93 return cc.MayForce(PP_ERROR_NOINTERFACE); |
94 return get_interface<PPB_FileRef>()->Touch( | 94 return get_interface<PPB_FileRef>()->Touch( |
95 pp_resource(), last_access_time, last_modified_time, | 95 pp_resource(), last_access_time, last_modified_time, |
96 cc.pp_completion_callback()); | 96 cc.pp_completion_callback()); |
97 } | 97 } |
98 | 98 |
99 int32_t FileRef::Delete(const CompletionCallback& cc) { | 99 int32_t FileRef::Delete(const CompletionCallback& cc) { |
100 if (!has_interface<PPB_FileRef>()) | 100 if (!has_interface<PPB_FileRef>()) |
101 return PP_ERROR_NOINTERFACE; | 101 return cc.MayForce(PP_ERROR_NOINTERFACE); |
102 return get_interface<PPB_FileRef>()->Delete( | 102 return get_interface<PPB_FileRef>()->Delete( |
103 pp_resource(), cc.pp_completion_callback()); | 103 pp_resource(), cc.pp_completion_callback()); |
104 } | 104 } |
105 | 105 |
106 int32_t FileRef::Rename(const FileRef& new_file_ref, | 106 int32_t FileRef::Rename(const FileRef& new_file_ref, |
107 const CompletionCallback& cc) { | 107 const CompletionCallback& cc) { |
108 if (!has_interface<PPB_FileRef>()) | 108 if (!has_interface<PPB_FileRef>()) |
109 return PP_ERROR_NOINTERFACE; | 109 return cc.MayForce(PP_ERROR_NOINTERFACE); |
110 return get_interface<PPB_FileRef>()->Rename( | 110 return get_interface<PPB_FileRef>()->Rename( |
111 pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback()); | 111 pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback()); |
112 } | 112 } |
113 | 113 |
114 } // namespace pp | 114 } // namespace pp |
OLD | NEW |