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 "webkit/fileapi/file_system_types.h" | 11 #include "webkit/fileapi/file_system_types.h" |
12 #include "webkit/plugins/ppapi/callbacks.h" | 12 #include "webkit/plugins/ppapi/callbacks.h" |
13 #include "webkit/plugins/ppapi/file_type_conversions.h" | 13 #include "webkit/plugins/ppapi/file_type_conversions.h" |
14 #include "webkit/plugins/ppapi/plugin_module.h" | 14 #include "webkit/plugins/ppapi/plugin_module.h" |
15 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" | 15 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" |
16 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" | 16 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" |
| 17 #include "webkit/plugins/ppapi/time_conversion.h" |
17 | 18 |
18 namespace webkit { | 19 namespace webkit { |
19 namespace ppapi { | 20 namespace ppapi { |
20 | 21 |
21 FileCallbacks::FileCallbacks( | 22 FileCallbacks::FileCallbacks( |
22 const base::WeakPtr<PluginModule>& module, | 23 const base::WeakPtr<PluginModule>& module, |
23 PP_Resource resource_id, | 24 PP_Resource resource_id, |
24 PP_CompletionCallback callback, | 25 PP_CompletionCallback callback, |
25 PP_FileInfo* info, | 26 PP_FileInfo* info, |
26 scoped_refptr<PPB_FileSystem_Impl> file_system, | 27 scoped_refptr<PPB_FileSystem_Impl> file_system, |
(...skipping 17 matching lines...) Expand all Loading... |
44 | 45 |
45 void FileCallbacks::DidReadMetadata( | 46 void FileCallbacks::DidReadMetadata( |
46 const base::PlatformFileInfo& file_info, | 47 const base::PlatformFileInfo& file_info, |
47 const FilePath& unused) { | 48 const FilePath& unused) { |
48 if (callback_->completed()) | 49 if (callback_->completed()) |
49 return; | 50 return; |
50 | 51 |
51 DCHECK(info_); | 52 DCHECK(info_); |
52 DCHECK(file_system_); | 53 DCHECK(file_system_); |
53 info_->size = file_info.size; | 54 info_->size = file_info.size; |
54 info_->creation_time = file_info.creation_time.ToDoubleT(); | 55 info_->creation_time = TimeToPPTime(file_info.creation_time); |
55 info_->last_access_time = file_info.last_accessed.ToDoubleT(); | 56 info_->last_access_time = TimeToPPTime(file_info.last_accessed); |
56 info_->last_modified_time = file_info.last_modified.ToDoubleT(); | 57 info_->last_modified_time = TimeToPPTime(file_info.last_modified); |
57 info_->system_type = file_system_->type(); | 58 info_->system_type = file_system_->type(); |
58 if (file_info.is_directory) | 59 if (file_info.is_directory) |
59 info_->type = PP_FILETYPE_DIRECTORY; | 60 info_->type = PP_FILETYPE_DIRECTORY; |
60 else | 61 else |
61 info_->type = PP_FILETYPE_REGULAR; | 62 info_->type = PP_FILETYPE_REGULAR; |
62 | 63 |
63 callback_->Run(PP_OK); | 64 callback_->Run(PP_OK); |
64 } | 65 } |
65 | 66 |
66 void FileCallbacks::DidReadDirectory( | 67 void FileCallbacks::DidReadDirectory( |
(...skipping 29 matching lines...) Expand all Loading... |
96 | 97 |
97 void FileCallbacks::RunCallback(base::PlatformFileError error_code) { | 98 void FileCallbacks::RunCallback(base::PlatformFileError error_code) { |
98 if (callback_->completed()) | 99 if (callback_->completed()) |
99 return; | 100 return; |
100 | 101 |
101 callback_->Run(PlatformFileErrorToPepperError(error_code)); | 102 callback_->Run(PlatformFileErrorToPepperError(error_code)); |
102 } | 103 } |
103 | 104 |
104 } // namespace ppapi | 105 } // namespace ppapi |
105 } // namespace webkit | 106 } // namespace webkit |
OLD | NEW |