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

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

Issue 8342016: Revert 106142 - Add a new globals object for PPAPI tracking information. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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
Property Changes:
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/src/webkit/plugins/ppapi/ppb_flash_file_impl.cc:r3734-4217,4606-5108,5177-5263
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/shared_impl/time_conversion.h" 14 #include "ppapi/shared_impl/time_conversion.h"
15 #include "ppapi/thunk/enter.h" 15 #include "ppapi/thunk/enter.h"
16 #include "webkit/plugins/ppapi/common.h" 16 #include "webkit/plugins/ppapi/common.h"
17 #include "webkit/plugins/ppapi/file_path.h" 17 #include "webkit/plugins/ppapi/file_path.h"
18 #include "webkit/plugins/ppapi/file_type_conversions.h" 18 #include "webkit/plugins/ppapi/file_type_conversions.h"
19 #include "webkit/plugins/ppapi/host_globals.h"
20 #include "webkit/plugins/ppapi/plugin_delegate.h" 19 #include "webkit/plugins/ppapi/plugin_delegate.h"
21 #include "webkit/plugins/ppapi/plugin_module.h" 20 #include "webkit/plugins/ppapi/plugin_module.h"
22 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 21 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
23 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" 22 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
24 #include "webkit/plugins/ppapi/resource_helper.h" 23 #include "webkit/plugins/ppapi/resource_helper.h"
25 #include "webkit/plugins/ppapi/resource_tracker.h" 24 #include "webkit/plugins/ppapi/resource_tracker.h"
26 25
27 #if defined(OS_WIN) 26 #if defined(OS_WIN)
28 #include "base/utf_string_conversions.h" 27 #include "base/utf_string_conversions.h"
29 #endif 28 #endif
(...skipping 30 matching lines...) Expand all
60 } 59 }
61 60
62 int32_t OpenModuleLocalFile(PP_Instance pp_instance, 61 int32_t OpenModuleLocalFile(PP_Instance pp_instance,
63 const char* path, 62 const char* path,
64 int32_t mode, 63 int32_t mode,
65 PP_FileHandle* file) { 64 PP_FileHandle* file) {
66 int flags = 0; 65 int flags = 0;
67 if (!path || !PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) || !file) 66 if (!path || !PepperFileOpenFlagsToPlatformFileFlags(mode, &flags) || !file)
68 return PP_ERROR_BADARGUMENT; 67 return PP_ERROR_BADARGUMENT;
69 68
70 PluginInstance* instance = 69 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
71 HostGlobals::Get()->host_resource_tracker()->GetInstance(pp_instance);
72 if (!instance) 70 if (!instance)
73 return PP_ERROR_FAILED; 71 return PP_ERROR_FAILED;
74 72
75 base::PlatformFile base_file; 73 base::PlatformFile base_file;
76 base::PlatformFileError result = instance->delegate()->OpenFile( 74 base::PlatformFileError result = instance->delegate()->OpenFile(
77 PepperFilePath::MakeModuleLocal(instance->module(), path), 75 PepperFilePath::MakeModuleLocal(instance->module(), path),
78 flags, 76 flags,
79 &base_file); 77 &base_file);
80 *file = base_file; 78 *file = base_file;
81 return PlatformFileErrorToPepperError(result); 79 return PlatformFileErrorToPepperError(result);
82 } 80 }
83 81
84 int32_t RenameModuleLocalFile(PP_Instance pp_instance, 82 int32_t RenameModuleLocalFile(PP_Instance pp_instance,
85 const char* from_path, 83 const char* from_path,
86 const char* to_path) { 84 const char* to_path) {
87 if (!from_path || !to_path) 85 if (!from_path || !to_path)
88 return PP_ERROR_BADARGUMENT; 86 return PP_ERROR_BADARGUMENT;
89 87
90 PluginInstance* instance = 88 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
91 HostGlobals::Get()->host_resource_tracker()->GetInstance(pp_instance);
92 if (!instance) 89 if (!instance)
93 return PP_ERROR_FAILED; 90 return PP_ERROR_FAILED;
94 91
95 base::PlatformFileError result = instance->delegate()->RenameFile( 92 base::PlatformFileError result = instance->delegate()->RenameFile(
96 PepperFilePath::MakeModuleLocal(instance->module(), from_path), 93 PepperFilePath::MakeModuleLocal(instance->module(), from_path),
97 PepperFilePath::MakeModuleLocal(instance->module(), to_path)); 94 PepperFilePath::MakeModuleLocal(instance->module(), to_path));
98 return PlatformFileErrorToPepperError(result); 95 return PlatformFileErrorToPepperError(result);
99 } 96 }
100 97
101 int32_t DeleteModuleLocalFileOrDir(PP_Instance pp_instance, 98 int32_t DeleteModuleLocalFileOrDir(PP_Instance pp_instance,
102 const char* path, 99 const char* path,
103 PP_Bool recursive) { 100 PP_Bool recursive) {
104 if (!path) 101 if (!path)
105 return PP_ERROR_BADARGUMENT; 102 return PP_ERROR_BADARGUMENT;
106 103
107 PluginInstance* instance = 104 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
108 HostGlobals::Get()->host_resource_tracker()->GetInstance(pp_instance);
109 if (!instance) 105 if (!instance)
110 return PP_ERROR_FAILED; 106 return PP_ERROR_FAILED;
111 107
112 base::PlatformFileError result = instance->delegate()->DeleteFileOrDir( 108 base::PlatformFileError result = instance->delegate()->DeleteFileOrDir(
113 PepperFilePath::MakeModuleLocal(instance->module(), path), 109 PepperFilePath::MakeModuleLocal(instance->module(), path),
114 PPBoolToBool(recursive)); 110 PPBoolToBool(recursive));
115 return PlatformFileErrorToPepperError(result); 111 return PlatformFileErrorToPepperError(result);
116 } 112 }
117 113
118 int32_t CreateModuleLocalDir(PP_Instance pp_instance, const char* path) { 114 int32_t CreateModuleLocalDir(PP_Instance pp_instance, const char* path) {
119 if (!path) 115 if (!path)
120 return PP_ERROR_BADARGUMENT; 116 return PP_ERROR_BADARGUMENT;
121 117
122 PluginInstance* instance = 118 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
123 HostGlobals::Get()->host_resource_tracker()->GetInstance(pp_instance);
124 if (!instance) 119 if (!instance)
125 return PP_ERROR_FAILED; 120 return PP_ERROR_FAILED;
126 121
127 base::PlatformFileError result = instance->delegate()->CreateDir( 122 base::PlatformFileError result = instance->delegate()->CreateDir(
128 PepperFilePath::MakeModuleLocal(instance->module(), path)); 123 PepperFilePath::MakeModuleLocal(instance->module(), path));
129 return PlatformFileErrorToPepperError(result); 124 return PlatformFileErrorToPepperError(result);
130 } 125 }
131 126
132 int32_t QueryModuleLocalFile(PP_Instance pp_instance, 127 int32_t QueryModuleLocalFile(PP_Instance pp_instance,
133 const char* path, 128 const char* path,
134 PP_FileInfo* info) { 129 PP_FileInfo* info) {
135 if (!path || !info) 130 if (!path || !info)
136 return PP_ERROR_BADARGUMENT; 131 return PP_ERROR_BADARGUMENT;
137 132
138 PluginInstance* instance = 133 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
139 HostGlobals::Get()->host_resource_tracker()->GetInstance(pp_instance);
140 if (!instance) 134 if (!instance)
141 return PP_ERROR_FAILED; 135 return PP_ERROR_FAILED;
142 136
143 base::PlatformFileInfo file_info; 137 base::PlatformFileInfo file_info;
144 base::PlatformFileError result = instance->delegate()->QueryFile( 138 base::PlatformFileError result = instance->delegate()->QueryFile(
145 PepperFilePath::MakeModuleLocal(instance->module(), path), 139 PepperFilePath::MakeModuleLocal(instance->module(), path),
146 &file_info); 140 &file_info);
147 if (result == base::PLATFORM_FILE_OK) { 141 if (result == base::PLATFORM_FILE_OK) {
148 info->size = file_info.size; 142 info->size = file_info.size;
149 info->creation_time = TimeToPPTime(file_info.creation_time); 143 info->creation_time = TimeToPPTime(file_info.creation_time);
150 info->last_access_time = TimeToPPTime(file_info.last_accessed); 144 info->last_access_time = TimeToPPTime(file_info.last_accessed);
151 info->last_modified_time = TimeToPPTime(file_info.last_modified); 145 info->last_modified_time = TimeToPPTime(file_info.last_modified);
152 info->system_type = PP_FILESYSTEMTYPE_EXTERNAL; 146 info->system_type = PP_FILESYSTEMTYPE_EXTERNAL;
153 if (file_info.is_directory) 147 if (file_info.is_directory)
154 info->type = PP_FILETYPE_DIRECTORY; 148 info->type = PP_FILETYPE_DIRECTORY;
155 else 149 else
156 info->type = PP_FILETYPE_REGULAR; 150 info->type = PP_FILETYPE_REGULAR;
157 } 151 }
158 return PlatformFileErrorToPepperError(result); 152 return PlatformFileErrorToPepperError(result);
159 } 153 }
160 154
161 int32_t GetModuleLocalDirContents(PP_Instance pp_instance, 155 int32_t GetModuleLocalDirContents(PP_Instance pp_instance,
162 const char* path, 156 const char* path,
163 PP_DirContents_Dev** contents) { 157 PP_DirContents_Dev** contents) {
164 if (!path || !contents) 158 if (!path || !contents)
165 return PP_ERROR_BADARGUMENT; 159 return PP_ERROR_BADARGUMENT;
166 PluginInstance* instance = 160 PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
167 HostGlobals::Get()->host_resource_tracker()->GetInstance(pp_instance);
168 if (!instance) 161 if (!instance)
169 return PP_ERROR_FAILED; 162 return PP_ERROR_FAILED;
170 163
171 *contents = NULL; 164 *contents = NULL;
172 DirContents pepper_contents; 165 DirContents pepper_contents;
173 base::PlatformFileError result = instance->delegate()->GetDirContents( 166 base::PlatformFileError result = instance->delegate()->GetDirContents(
174 PepperFilePath::MakeModuleLocal(instance->module(), path), 167 PepperFilePath::MakeModuleLocal(instance->module(), path),
175 &pepper_contents); 168 &pepper_contents);
176 169
177 if (result != base::PLATFORM_FILE_OK) 170 if (result != base::PLATFORM_FILE_OK)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 275
283 } // namespace 276 } // namespace
284 277
285 // static 278 // static
286 const PPB_Flash_File_FileRef* PPB_Flash_File_FileRef_Impl::GetInterface() { 279 const PPB_Flash_File_FileRef* PPB_Flash_File_FileRef_Impl::GetInterface() {
287 return &ppb_flash_file_fileref; 280 return &ppb_flash_file_fileref;
288 } 281 }
289 282
290 } // namespace ppapi 283 } // namespace ppapi
291 } // namespace webkit 284 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_flash_clipboard_impl.cc ('k') | webkit/plugins/ppapi/ppb_flash_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698