| 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 "webkit/plugins/ppapi/file_callbacks.h" | 5 #include "webkit/plugins/ppapi/file_callbacks.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ppapi/c/pp_file_info.h" | 8 #include "ppapi/c/pp_file_info.h" |
| 9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/c/ppb_file_system.h" | 10 #include "ppapi/c/ppb_file_system.h" |
| 11 #include "ppapi/shared_impl/file_type_conversion.h" | 11 #include "ppapi/shared_impl/file_type_conversion.h" |
| 12 #include "ppapi/shared_impl/time_conversion.h" | 12 #include "ppapi/shared_impl/time_conversion.h" |
| 13 #include "ppapi/shared_impl/tracked_callback.h" |
| 13 #include "webkit/fileapi/file_system_types.h" | 14 #include "webkit/fileapi/file_system_types.h" |
| 14 #include "webkit/plugins/ppapi/callbacks.h" | |
| 15 #include "webkit/plugins/ppapi/plugin_module.h" | 15 #include "webkit/plugins/ppapi/plugin_module.h" |
| 16 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" | 16 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" |
| 17 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" | 17 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" |
| 18 | 18 |
| 19 using ppapi::Resource; |
| 19 using ppapi::TimeToPPTime; | 20 using ppapi::TimeToPPTime; |
| 21 using ppapi::TrackedCallback; |
| 20 | 22 |
| 21 namespace webkit { | 23 namespace webkit { |
| 22 namespace ppapi { | 24 namespace ppapi { |
| 23 | 25 |
| 24 FileCallbacks::FileCallbacks( | 26 FileCallbacks::FileCallbacks( |
| 25 const base::WeakPtr<PluginModule>& module, | 27 Resource* resource, |
| 26 PP_Resource resource_id, | |
| 27 PP_CompletionCallback callback, | 28 PP_CompletionCallback callback, |
| 28 PP_FileInfo* info, | 29 PP_FileInfo* info, |
| 29 scoped_refptr<PPB_FileSystem_Impl> file_system, | 30 scoped_refptr<PPB_FileSystem_Impl> file_system, |
| 30 scoped_refptr<PPB_DirectoryReader_Impl> directory_reader) | 31 scoped_refptr<PPB_DirectoryReader_Impl> directory_reader) |
| 31 : callback_(new TrackedCompletionCallback(module->GetCallbackTracker(), | 32 : callback_(new TrackedCallback(resource, callback)), |
| 32 resource_id, | |
| 33 callback)), | |
| 34 info_(info), | 33 info_(info), |
| 35 file_system_(file_system), | 34 file_system_(file_system), |
| 36 directory_reader_(directory_reader) { | 35 directory_reader_(directory_reader) { |
| 37 } | 36 } |
| 38 | 37 |
| 39 FileCallbacks::~FileCallbacks() {} | 38 FileCallbacks::~FileCallbacks() {} |
| 40 | 39 |
| 41 void FileCallbacks::DidSucceed() { | 40 void FileCallbacks::DidSucceed() { |
| 42 if (callback_->completed()) | 41 if (callback_->completed()) |
| 43 return; | 42 return; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 98 |
| 100 void FileCallbacks::RunCallback(base::PlatformFileError error_code) { | 99 void FileCallbacks::RunCallback(base::PlatformFileError error_code) { |
| 101 if (callback_->completed()) | 100 if (callback_->completed()) |
| 102 return; | 101 return; |
| 103 | 102 |
| 104 callback_->Run(::ppapi::PlatformFileErrorToPepperError(error_code)); | 103 callback_->Run(::ppapi::PlatformFileErrorToPepperError(error_code)); |
| 105 } | 104 } |
| 106 | 105 |
| 107 } // namespace ppapi | 106 } // namespace ppapi |
| 108 } // namespace webkit | 107 } // namespace webkit |
| OLD | NEW |