Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: webkit/plugins/ppapi/ppb_flash_file_impl.cc

Issue 7237044: Make PP_TimeTicks actually be a tick counter rather than be the same as the (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/ppb_flash_file_impl.h" 5 #include "webkit/plugins/ppapi/ppb_flash_file_impl.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "ppapi/c/pp_file_info.h" 11 #include "ppapi/c/pp_file_info.h"
12 #include "ppapi/c/ppb_file_io.h" 12 #include "ppapi/c/ppb_file_io.h"
13 #include "ppapi/c/private/ppb_flash_file.h" 13 #include "ppapi/c/private/ppb_flash_file.h"
14 #include "ppapi/thunk/enter.h" 14 #include "ppapi/thunk/enter.h"
15 #include "webkit/plugins/ppapi/common.h" 15 #include "webkit/plugins/ppapi/common.h"
16 #include "webkit/plugins/ppapi/file_path.h" 16 #include "webkit/plugins/ppapi/file_path.h"
17 #include "webkit/plugins/ppapi/file_type_conversions.h" 17 #include "webkit/plugins/ppapi/file_type_conversions.h"
18 #include "webkit/plugins/ppapi/plugin_delegate.h" 18 #include "webkit/plugins/ppapi/plugin_delegate.h"
19 #include "webkit/plugins/ppapi/plugin_module.h" 19 #include "webkit/plugins/ppapi/plugin_module.h"
20 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 20 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
21 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" 21 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
22 #include "webkit/plugins/ppapi/resource_tracker.h" 22 #include "webkit/plugins/ppapi/resource_tracker.h"
23 #include "webkit/plugins/ppapi/time_conversion.h"
23 24
24 #if defined(OS_WIN) 25 #if defined(OS_WIN)
25 #include "base/utf_string_conversions.h" 26 #include "base/utf_string_conversions.h"
26 #endif 27 #endif
27 28
28 using ppapi::thunk::EnterResource; 29 using ppapi::thunk::EnterResource;
29 using ppapi::thunk::PPB_FileRef_API; 30 using ppapi::thunk::PPB_FileRef_API;
30 31
31 namespace webkit { 32 namespace webkit {
32 namespace ppapi { 33 namespace ppapi {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); 131 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
131 if (!instance) 132 if (!instance)
132 return PP_ERROR_FAILED; 133 return PP_ERROR_FAILED;
133 134
134 base::PlatformFileInfo file_info; 135 base::PlatformFileInfo file_info;
135 base::PlatformFileError result = instance->delegate()->QueryFile( 136 base::PlatformFileError result = instance->delegate()->QueryFile(
136 PepperFilePath::MakeModuleLocal(instance->module(), path), 137 PepperFilePath::MakeModuleLocal(instance->module(), path),
137 &file_info); 138 &file_info);
138 if (result == base::PLATFORM_FILE_OK) { 139 if (result == base::PLATFORM_FILE_OK) {
139 info->size = file_info.size; 140 info->size = file_info.size;
140 info->creation_time = file_info.creation_time.ToDoubleT(); 141 info->creation_time = TimeToPPTime(file_info.creation_time);
141 info->last_access_time = file_info.last_accessed.ToDoubleT(); 142 info->last_access_time = TimeToPPTime(file_info.last_accessed);
142 info->last_modified_time = file_info.last_modified.ToDoubleT(); 143 info->last_modified_time = TimeToPPTime(file_info.last_modified);
143 info->system_type = PP_FILESYSTEMTYPE_EXTERNAL; 144 info->system_type = PP_FILESYSTEMTYPE_EXTERNAL;
144 if (file_info.is_directory) 145 if (file_info.is_directory)
145 info->type = PP_FILETYPE_DIRECTORY; 146 info->type = PP_FILETYPE_DIRECTORY;
146 else 147 else
147 info->type = PP_FILETYPE_REGULAR; 148 info->type = PP_FILETYPE_REGULAR;
148 } 149 }
149 return PlatformFileErrorToPepperError(result); 150 return PlatformFileErrorToPepperError(result);
150 } 151 }
151 152
152 int32_t GetModuleLocalDirContents(PP_Instance pp_instance, 153 int32_t GetModuleLocalDirContents(PP_Instance pp_instance,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 PluginInstance* instance = file_ref->instance(); 247 PluginInstance* instance = file_ref->instance();
247 if (!instance) 248 if (!instance)
248 return PP_ERROR_FAILED; 249 return PP_ERROR_FAILED;
249 250
250 base::PlatformFileInfo file_info; 251 base::PlatformFileInfo file_info;
251 base::PlatformFileError result = instance->delegate()->QueryFile( 252 base::PlatformFileError result = instance->delegate()->QueryFile(
252 PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()), 253 PepperFilePath::MakeAbsolute(file_ref->GetSystemPath()),
253 &file_info); 254 &file_info);
254 if (result == base::PLATFORM_FILE_OK) { 255 if (result == base::PLATFORM_FILE_OK) {
255 info->size = file_info.size; 256 info->size = file_info.size;
256 info->creation_time = file_info.creation_time.ToDoubleT(); 257 info->creation_time = TimeToPPTime(file_info.creation_time);
257 info->last_access_time = file_info.last_accessed.ToDoubleT(); 258 info->last_access_time = TimeToPPTime(file_info.last_accessed);
258 info->last_modified_time = file_info.last_modified.ToDoubleT(); 259 info->last_modified_time = TimeToPPTime(file_info.last_modified);
259 info->system_type = PP_FILESYSTEMTYPE_EXTERNAL; 260 info->system_type = PP_FILESYSTEMTYPE_EXTERNAL;
260 if (file_info.is_directory) 261 if (file_info.is_directory)
261 info->type = PP_FILETYPE_DIRECTORY; 262 info->type = PP_FILETYPE_DIRECTORY;
262 else 263 else
263 info->type = PP_FILETYPE_REGULAR; 264 info->type = PP_FILETYPE_REGULAR;
264 } 265 }
265 return PlatformFileErrorToPepperError(result); 266 return PlatformFileErrorToPepperError(result);
266 } 267 }
267 268
268 const PPB_Flash_File_FileRef ppb_flash_file_fileref = { 269 const PPB_Flash_File_FileRef ppb_flash_file_fileref = {
269 &OpenFileRefFile, 270 &OpenFileRefFile,
270 &QueryFileRefFile, 271 &QueryFileRefFile,
271 }; 272 };
272 273
273 } // namespace 274 } // namespace
274 275
275 // static 276 // static
276 const PPB_Flash_File_FileRef* PPB_Flash_File_FileRef_Impl::GetInterface() { 277 const PPB_Flash_File_FileRef* PPB_Flash_File_FileRef_Impl::GetInterface() {
277 return &ppb_flash_file_fileref; 278 return &ppb_flash_file_fileref;
278 } 279 }
279 280
280 } // namespace ppapi 281 } // namespace ppapi
281 } // namespace webkit 282 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698