OLD | NEW |
---|---|
1 // Copyright (c) 2010 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/dev/file_ref_dev.h" | 5 #include "ppapi/cpp/dev/file_ref_dev.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/dev/file_system_dev.h" | 9 #include "ppapi/cpp/dev/file_system_dev.h" |
10 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
11 | 11 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 FileRef_Dev FileRef_Dev::GetParent() const { | 62 FileRef_Dev FileRef_Dev::GetParent() const { |
63 if (!has_interface<PPB_FileRef_Dev>()) | 63 if (!has_interface<PPB_FileRef_Dev>()) |
64 return FileRef_Dev(); | 64 return FileRef_Dev(); |
65 return FileRef_Dev(PassRef(), | 65 return FileRef_Dev(PassRef(), |
66 get_interface<PPB_FileRef_Dev>()->GetParent( | 66 get_interface<PPB_FileRef_Dev>()->GetParent( |
67 pp_resource())); | 67 pp_resource())); |
68 } | 68 } |
69 | 69 |
70 int32_t FileRef_Dev::MakeDirectory(const CompletionCallback& cc) { | 70 int32_t FileRef_Dev::MakeDirectory(const CompletionCallback& cc) { |
71 if (!has_interface<PPB_FileRef_Dev>()) | 71 if (!has_interface<PPB_FileRef_Dev>()) |
72 return PP_ERROR_NOINTERFACE; | 72 return cc.MayForce(static_cast<int32_t>(PP_ERROR_NOINTERFACE)); |
piman
2011/06/07 17:32:14
no need for static_cast ? here and below
polina
2011/06/09 23:53:51
Done.
| |
73 return get_interface<PPB_FileRef_Dev>()->MakeDirectory( | 73 return get_interface<PPB_FileRef_Dev>()->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_Dev::MakeDirectoryIncludingAncestors( | 79 int32_t FileRef_Dev::MakeDirectoryIncludingAncestors( |
80 const CompletionCallback& cc) { | 80 const CompletionCallback& cc) { |
81 if (!has_interface<PPB_FileRef_Dev>()) | 81 if (!has_interface<PPB_FileRef_Dev>()) |
82 return PP_ERROR_NOINTERFACE; | 82 return cc.MayForce(static_cast<int32_t>(PP_ERROR_NOINTERFACE)); |
83 return get_interface<PPB_FileRef_Dev>()->MakeDirectory( | 83 return get_interface<PPB_FileRef_Dev>()->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_Dev::Touch(PP_Time last_access_time, | 89 int32_t FileRef_Dev::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_Dev>()) | 92 if (!has_interface<PPB_FileRef_Dev>()) |
93 return PP_ERROR_NOINTERFACE; | 93 return cc.MayForce(static_cast<int32_t>(PP_ERROR_NOINTERFACE)); |
94 return get_interface<PPB_FileRef_Dev>()->Touch( | 94 return get_interface<PPB_FileRef_Dev>()->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_Dev::Delete(const CompletionCallback& cc) { | 99 int32_t FileRef_Dev::Delete(const CompletionCallback& cc) { |
100 if (!has_interface<PPB_FileRef_Dev>()) | 100 if (!has_interface<PPB_FileRef_Dev>()) |
101 return PP_ERROR_NOINTERFACE; | 101 return cc.MayForce(static_cast<int32_t>(PP_ERROR_NOINTERFACE)); |
102 return get_interface<PPB_FileRef_Dev>()->Delete( | 102 return get_interface<PPB_FileRef_Dev>()->Delete( |
103 pp_resource(), cc.pp_completion_callback()); | 103 pp_resource(), cc.pp_completion_callback()); |
104 } | 104 } |
105 | 105 |
106 int32_t FileRef_Dev::Rename(const FileRef_Dev& new_file_ref, | 106 int32_t FileRef_Dev::Rename(const FileRef_Dev& new_file_ref, |
107 const CompletionCallback& cc) { | 107 const CompletionCallback& cc) { |
108 if (!has_interface<PPB_FileRef_Dev>()) | 108 if (!has_interface<PPB_FileRef_Dev>()) |
109 return PP_ERROR_NOINTERFACE; | 109 return cc.MayForce(static_cast<int32_t>(PP_ERROR_NOINTERFACE)); |
110 return get_interface<PPB_FileRef_Dev>()->Rename( | 110 return get_interface<PPB_FileRef_Dev>()->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 |