Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_file_ref_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_file_ref_impl.h" |
| 6 | 6 |
| 7 #include "base/platform_file.h" | 7 #include "base/platform_file.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 11 #include "net/base/escape.h" | 11 #include "net/base/escape.h" |
| 12 #include "ppapi/c/pp_errors.h" | 12 #include "ppapi/c/pp_errors.h" |
| 13 #include "ppapi/c/pp_file_info.h" | |
|
yzshen1
2013/04/08 21:05:16
This include is already in the .h file. You don't
victorhsieh
2013/04/08 23:44:38
Done.
| |
| 13 #include "ppapi/shared_impl/file_type_conversion.h" | 14 #include "ppapi/shared_impl/file_type_conversion.h" |
| 14 #include "ppapi/shared_impl/time_conversion.h" | 15 #include "ppapi/shared_impl/time_conversion.h" |
| 15 #include "ppapi/shared_impl/var.h" | 16 #include "ppapi/shared_impl/var.h" |
| 16 #include "ppapi/thunk/enter.h" | 17 #include "ppapi/thunk/enter.h" |
| 17 #include "ppapi/thunk/ppb_file_system_api.h" | 18 #include "ppapi/thunk/ppb_file_system_api.h" |
| 18 #include "webkit/plugins/ppapi/common.h" | 19 #include "webkit/plugins/ppapi/common.h" |
| 19 #include "webkit/plugins/ppapi/file_callbacks.h" | 20 #include "webkit/plugins/ppapi/file_callbacks.h" |
| 20 #include "webkit/plugins/ppapi/plugin_delegate.h" | 21 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 21 #include "webkit/plugins/ppapi/plugin_module.h" | 22 #include "webkit/plugins/ppapi/plugin_module.h" |
| 22 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 23 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 23 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" | |
| 24 #include "webkit/plugins/ppapi/resource_helper.h" | 24 #include "webkit/plugins/ppapi/resource_helper.h" |
| 25 | 25 |
| 26 using ppapi::HostResource; | 26 using ppapi::HostResource; |
| 27 using ppapi::PPB_FileRef_CreateInfo; | 27 using ppapi::PPB_FileRef_CreateInfo; |
| 28 using ppapi::PPTimeToTime; | 28 using ppapi::PPTimeToTime; |
| 29 using ppapi::StringVar; | 29 using ppapi::StringVar; |
| 30 using ppapi::TrackedCallback; | 30 using ppapi::TrackedCallback; |
| 31 using ppapi::thunk::EnterResourceNoLock; | 31 using ppapi::thunk::EnterResourceNoLock; |
| 32 using ppapi::thunk::PPB_FileRef_API; | 32 using ppapi::thunk::PPB_FileRef_API; |
| 33 using ppapi::thunk::PPB_FileSystem_API; | 33 using ppapi::thunk::PPB_FileSystem_API; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 callback))) { | 142 callback))) { |
| 143 base::FileUtilProxy::Close( | 143 base::FileUtilProxy::Close( |
| 144 task_runner, file, base::Bind(&IgnoreCloseCallback)); | 144 task_runner, file, base::Bind(&IgnoreCloseCallback)); |
| 145 callback->Run(PP_ERROR_FAILED); | 145 callback->Run(PP_ERROR_FAILED); |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace | 149 } // namespace |
| 150 | 150 |
| 151 PPB_FileRef_Impl::PPB_FileRef_Impl(const PPB_FileRef_CreateInfo& info, | 151 PPB_FileRef_Impl::PPB_FileRef_Impl(const PPB_FileRef_CreateInfo& info, |
| 152 PPB_FileSystem_Impl* file_system) | 152 PP_Resource file_system) |
| 153 : PPB_FileRef_Shared(::ppapi::OBJECT_IS_IMPL, info), | 153 : PPB_FileRef_Shared(::ppapi::OBJECT_IS_IMPL, info), |
| 154 file_system_(file_system), | 154 file_system_(file_system), |
| 155 external_file_system_path_() { | 155 external_file_system_path_() { |
| 156 } | 156 } |
| 157 | 157 |
| 158 PPB_FileRef_Impl::PPB_FileRef_Impl(const PPB_FileRef_CreateInfo& info, | 158 PPB_FileRef_Impl::PPB_FileRef_Impl(const PPB_FileRef_CreateInfo& info, |
| 159 const base::FilePath& external_file_path) | 159 const base::FilePath& external_file_path) |
| 160 : PPB_FileRef_Shared(::ppapi::OBJECT_IS_IMPL, info), | 160 : PPB_FileRef_Shared(::ppapi::OBJECT_IS_IMPL, info), |
| 161 file_system_(), | 161 file_system_(), |
| 162 external_file_system_path_(external_file_path) { | 162 external_file_system_path_(external_file_path) { |
| 163 } | 163 } |
| 164 | 164 |
| 165 PPB_FileRef_Impl::~PPB_FileRef_Impl() { | 165 PPB_FileRef_Impl::~PPB_FileRef_Impl() { |
| 166 } | 166 } |
| 167 | 167 |
| 168 // static | 168 // static |
| 169 PPB_FileRef_Impl* PPB_FileRef_Impl::CreateInternal(PP_Resource pp_file_system, | 169 PPB_FileRef_Impl* PPB_FileRef_Impl::CreateInternal(PP_Instance instance, |
| 170 PP_Resource pp_file_system, | |
| 170 const std::string& path) { | 171 const std::string& path) { |
| 171 EnterResourceNoLock<PPB_FileSystem_API> enter(pp_file_system, true); | 172 PluginInstance* plugin_instance = |
| 172 if (enter.failed()) | 173 ResourceHelper::PPInstanceToPluginInstance(instance); |
| 174 if (!plugin_instance || !plugin_instance->delegate()) | |
| 173 return 0; | 175 return 0; |
| 174 | 176 |
| 175 PPB_FileSystem_Impl* file_system = | 177 PP_FileSystemType type = |
| 176 static_cast<PPB_FileSystem_Impl*>(enter.object()); | 178 plugin_instance->delegate()->GetFileSystemType(instance, pp_file_system); |
| 177 if (!file_system->pp_instance()) | 179 if (type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && |
| 178 return 0; | 180 type != PP_FILESYSTEMTYPE_LOCALTEMPORARY && |
| 179 | 181 type != PP_FILESYSTEMTYPE_EXTERNAL) |
| 180 if (file_system->type() != PP_FILESYSTEMTYPE_LOCALPERSISTENT && | |
| 181 file_system->type() != PP_FILESYSTEMTYPE_LOCALTEMPORARY && | |
| 182 file_system->type() != PP_FILESYSTEMTYPE_EXTERNAL) | |
| 183 return 0; | 182 return 0; |
| 184 | 183 |
| 185 PPB_FileRef_CreateInfo info; | 184 PPB_FileRef_CreateInfo info; |
| 186 info.resource = HostResource::MakeInstanceOnly(file_system->pp_instance()); | 185 info.resource = HostResource::MakeInstanceOnly(instance); |
| 187 info.file_system_type = file_system->type(); | 186 info.file_system_type = type; |
| 188 | 187 |
| 189 // Validate the path. | 188 // Validate the path. |
| 190 info.path = path; | 189 info.path = path; |
| 191 if (!IsValidLocalPath(info.path)) | 190 if (!IsValidLocalPath(info.path)) |
| 192 return 0; | 191 return 0; |
| 193 TrimTrailingSlash(&info.path); | 192 TrimTrailingSlash(&info.path); |
| 194 | 193 |
| 195 info.name = GetNameForVirtualFilePath(info.path); | 194 info.name = GetNameForVirtualFilePath(info.path); |
| 196 | 195 |
| 197 return new PPB_FileRef_Impl(info, file_system); | 196 return new PPB_FileRef_Impl(info, pp_file_system); |
| 198 } | 197 } |
| 199 | 198 |
| 200 // static | 199 // static |
| 201 PPB_FileRef_Impl* PPB_FileRef_Impl::CreateExternal( | 200 PPB_FileRef_Impl* PPB_FileRef_Impl::CreateExternal( |
| 202 PP_Instance instance, | 201 PP_Instance instance, |
| 203 const base::FilePath& external_file_path, | 202 const base::FilePath& external_file_path, |
| 204 const std::string& display_name) { | 203 const std::string& display_name) { |
| 205 PPB_FileRef_CreateInfo info; | 204 PPB_FileRef_CreateInfo info; |
| 206 info.resource = HostResource::MakeInstanceOnly(instance); | 205 info.resource = HostResource::MakeInstanceOnly(instance); |
| 207 info.file_system_type = PP_FILESYSTEMTYPE_EXTERNAL; | 206 info.file_system_type = PP_FILESYSTEMTYPE_EXTERNAL; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 222 // There should always be a leading slash at least! | 221 // There should always be a leading slash at least! |
| 223 size_t pos = virtual_path.rfind('/'); | 222 size_t pos = virtual_path.rfind('/'); |
| 224 CHECK(pos != std::string::npos); | 223 CHECK(pos != std::string::npos); |
| 225 | 224 |
| 226 // If the path is "/foo", then we want to include the slash. | 225 // If the path is "/foo", then we want to include the slash. |
| 227 if (pos == 0) | 226 if (pos == 0) |
| 228 pos++; | 227 pos++; |
| 229 std::string parent_path = virtual_path.substr(0, pos); | 228 std::string parent_path = virtual_path.substr(0, pos); |
| 230 | 229 |
| 231 scoped_refptr<PPB_FileRef_Impl> parent_ref( | 230 scoped_refptr<PPB_FileRef_Impl> parent_ref( |
| 232 CreateInternal(file_system_->pp_resource(), parent_path)); | 231 CreateInternal(pp_instance(), file_system_, parent_path)); |
| 233 if (!parent_ref.get()) | 232 if (!parent_ref.get()) |
| 234 return 0; | 233 return 0; |
| 235 return parent_ref->GetReference(); | 234 return parent_ref->GetReference(); |
| 236 } | 235 } |
| 237 | 236 |
| 238 int32_t PPB_FileRef_Impl::MakeDirectory( | 237 int32_t PPB_FileRef_Impl::MakeDirectory( |
| 239 PP_Bool make_ancestors, | 238 PP_Bool make_ancestors, |
| 240 scoped_refptr<TrackedCallback> callback) { | 239 scoped_refptr<TrackedCallback> callback) { |
| 241 if (!IsValidNonExternalFileSystem()) | 240 if (!IsValidNonExternalFileSystem()) |
| 242 return PP_ERROR_NOACCESS; | 241 return PP_ERROR_NOACCESS; |
| 243 | 242 |
| 244 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); | 243 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); |
| 245 if (!plugin_instance) | 244 if (!plugin_instance) |
| 246 return PP_ERROR_FAILED; | 245 return PP_ERROR_FAILED; |
| 247 if (!plugin_instance->delegate()->MakeDirectory( | 246 if (!plugin_instance->delegate()->MakeDirectory( |
| 248 GetFileSystemURL(), PP_ToBool(make_ancestors), | 247 GetFileSystemURL(), PP_ToBool(make_ancestors), |
| 249 new FileCallbacks(this, callback, NULL, NULL))) | 248 new FileCallbacks(this, callback, NULL))) |
| 250 return PP_ERROR_FAILED; | 249 return PP_ERROR_FAILED; |
| 251 return PP_OK_COMPLETIONPENDING; | 250 return PP_OK_COMPLETIONPENDING; |
| 252 } | 251 } |
| 253 | 252 |
| 254 int32_t PPB_FileRef_Impl::Touch(PP_Time last_access_time, | 253 int32_t PPB_FileRef_Impl::Touch(PP_Time last_access_time, |
| 255 PP_Time last_modified_time, | 254 PP_Time last_modified_time, |
| 256 scoped_refptr<TrackedCallback> callback) { | 255 scoped_refptr<TrackedCallback> callback) { |
| 257 if (!IsValidNonExternalFileSystem()) | 256 if (!IsValidNonExternalFileSystem()) |
| 258 return PP_ERROR_NOACCESS; | 257 return PP_ERROR_NOACCESS; |
| 259 | 258 |
| 260 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); | 259 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); |
| 261 if (!plugin_instance) | 260 if (!plugin_instance) |
| 262 return PP_ERROR_FAILED; | 261 return PP_ERROR_FAILED; |
| 263 if (!plugin_instance->delegate()->Touch( | 262 if (!plugin_instance->delegate()->Touch( |
| 264 GetFileSystemURL(), | 263 GetFileSystemURL(), |
| 265 PPTimeToTime(last_access_time), | 264 PPTimeToTime(last_access_time), |
| 266 PPTimeToTime(last_modified_time), | 265 PPTimeToTime(last_modified_time), |
| 267 new FileCallbacks(this, callback, NULL, NULL))) | 266 new FileCallbacks(this, callback, NULL))) |
| 268 return PP_ERROR_FAILED; | 267 return PP_ERROR_FAILED; |
| 269 return PP_OK_COMPLETIONPENDING; | 268 return PP_OK_COMPLETIONPENDING; |
| 270 } | 269 } |
| 271 | 270 |
| 272 int32_t PPB_FileRef_Impl::Delete(scoped_refptr<TrackedCallback> callback) { | 271 int32_t PPB_FileRef_Impl::Delete(scoped_refptr<TrackedCallback> callback) { |
| 273 if (!IsValidNonExternalFileSystem()) | 272 if (!IsValidNonExternalFileSystem()) |
| 274 return PP_ERROR_NOACCESS; | 273 return PP_ERROR_NOACCESS; |
| 275 | 274 |
| 276 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); | 275 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); |
| 277 if (!plugin_instance) | 276 if (!plugin_instance) |
| 278 return PP_ERROR_FAILED; | 277 return PP_ERROR_FAILED; |
| 279 if (!plugin_instance->delegate()->Delete( | 278 if (!plugin_instance->delegate()->Delete( |
| 280 GetFileSystemURL(), | 279 GetFileSystemURL(), |
| 281 new FileCallbacks(this, callback, NULL, NULL))) | 280 new FileCallbacks(this, callback, NULL))) |
| 282 return PP_ERROR_FAILED; | 281 return PP_ERROR_FAILED; |
| 283 return PP_OK_COMPLETIONPENDING; | 282 return PP_OK_COMPLETIONPENDING; |
| 284 } | 283 } |
| 285 | 284 |
| 286 int32_t PPB_FileRef_Impl::Rename(PP_Resource new_pp_file_ref, | 285 int32_t PPB_FileRef_Impl::Rename(PP_Resource new_pp_file_ref, |
| 287 scoped_refptr<TrackedCallback> callback) { | 286 scoped_refptr<TrackedCallback> callback) { |
| 288 EnterResourceNoLock<PPB_FileRef_API> enter(new_pp_file_ref, true); | 287 EnterResourceNoLock<PPB_FileRef_API> enter(new_pp_file_ref, true); |
| 289 if (enter.failed()) | 288 if (enter.failed()) |
| 290 return PP_ERROR_BADRESOURCE; | 289 return PP_ERROR_BADRESOURCE; |
| 291 PPB_FileRef_Impl* new_file_ref = | 290 PPB_FileRef_Impl* new_file_ref = |
| 292 static_cast<PPB_FileRef_Impl*>(enter.object()); | 291 static_cast<PPB_FileRef_Impl*>(enter.object()); |
| 293 | 292 |
| 294 if (!IsValidNonExternalFileSystem() || | 293 if (!IsValidNonExternalFileSystem() || |
| 295 file_system_.get() != new_file_ref->file_system_.get()) | 294 file_system_ != new_file_ref->file_system_) |
| 296 return PP_ERROR_NOACCESS; | 295 return PP_ERROR_NOACCESS; |
| 297 | 296 |
| 298 // TODO(viettrungluu): Also cancel when the new file ref is destroyed? | 297 // TODO(viettrungluu): Also cancel when the new file ref is destroyed? |
| 299 // http://crbug.com/67624 | 298 // http://crbug.com/67624 |
| 300 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); | 299 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); |
| 301 if (!plugin_instance) | 300 if (!plugin_instance) |
| 302 return PP_ERROR_FAILED; | 301 return PP_ERROR_FAILED; |
| 303 if (!plugin_instance->delegate()->Rename( | 302 if (!plugin_instance->delegate()->Rename( |
| 304 GetFileSystemURL(), new_file_ref->GetFileSystemURL(), | 303 GetFileSystemURL(), new_file_ref->GetFileSystemURL(), |
| 305 new FileCallbacks(this, callback, NULL, NULL))) | 304 new FileCallbacks(this, callback, NULL))) |
| 306 return PP_ERROR_FAILED; | 305 return PP_ERROR_FAILED; |
| 307 return PP_OK_COMPLETIONPENDING; | 306 return PP_OK_COMPLETIONPENDING; |
| 308 } | 307 } |
| 309 | 308 |
| 310 PP_Var PPB_FileRef_Impl::GetAbsolutePath() { | 309 PP_Var PPB_FileRef_Impl::GetAbsolutePath() { |
| 311 if (GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL) | 310 if (GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL) |
| 312 return GetPath(); | 311 return GetPath(); |
| 313 if (!external_path_var_.get()) { | 312 if (!external_path_var_.get()) { |
| 314 external_path_var_ = new StringVar( | 313 external_path_var_ = new StringVar( |
| 315 external_file_system_path_.AsUTF8Unsafe()); | 314 external_file_system_path_.AsUTF8Unsafe()); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 333 return GURL(); | 332 return GURL(); |
| 334 } | 333 } |
| 335 | 334 |
| 336 const std::string& virtual_path = GetCreateInfo().path; | 335 const std::string& virtual_path = GetCreateInfo().path; |
| 337 CHECK(!virtual_path.empty()); // Should always be at least "/". | 336 CHECK(!virtual_path.empty()); // Should always be at least "/". |
| 338 | 337 |
| 339 // Since |virtual_path_| starts with a '/', it looks like an absolute path. | 338 // Since |virtual_path_| starts with a '/', it looks like an absolute path. |
| 340 // We need to trim off the '/' before calling Resolve, as FileSystem URLs | 339 // We need to trim off the '/' before calling Resolve, as FileSystem URLs |
| 341 // start with a storage type identifier that looks like a path segment. | 340 // start with a storage type identifier that looks like a path segment. |
| 342 | 341 |
| 343 return file_system_->root_url().Resolve( | 342 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); |
| 344 net::EscapePath(virtual_path.substr(1))); | 343 PluginDelegate* delegate = |
| 344 plugin_instance ? plugin_instance->delegate() : NULL; | |
| 345 if (!delegate) | |
| 346 return GURL(); | |
| 347 return GURL(delegate->GetFileSystemRootUrl(pp_instance(), file_system_)) | |
| 348 .Resolve(net::EscapePath(virtual_path.substr(1))); | |
| 349 } | |
| 350 | |
| 351 bool PPB_FileRef_Impl::IsValidNonExternalFileSystem() const { | |
| 352 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); | |
| 353 PluginDelegate* delegate = | |
| 354 plugin_instance ? plugin_instance->delegate() : NULL; | |
| 355 return delegate && | |
| 356 delegate->IsFileSystemOpened(pp_instance(), file_system_) && | |
| 357 delegate->GetFileSystemType(pp_instance(), file_system_) != | |
| 358 PP_FILESYSTEMTYPE_EXTERNAL; | |
| 345 } | 359 } |
| 346 | 360 |
| 347 bool PPB_FileRef_Impl::HasValidFileSystem() const { | 361 bool PPB_FileRef_Impl::HasValidFileSystem() const { |
| 348 return file_system_ && file_system_->opened(); | 362 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); |
| 349 } | 363 PluginDelegate* delegate = |
| 350 | 364 plugin_instance ? plugin_instance->delegate() : NULL; |
| 351 bool PPB_FileRef_Impl::IsValidNonExternalFileSystem() const { | 365 return delegate && delegate->IsFileSystemOpened(pp_instance(), file_system_); |
| 352 return file_system_ && file_system_->opened() && | |
| 353 file_system_->type() != PP_FILESYSTEMTYPE_EXTERNAL; | |
| 354 } | 366 } |
| 355 | 367 |
| 356 int32_t PPB_FileRef_Impl::Query(PP_FileInfo* info, | 368 int32_t PPB_FileRef_Impl::Query(PP_FileInfo* info, |
| 357 scoped_refptr<TrackedCallback> callback) { | 369 scoped_refptr<TrackedCallback> callback) { |
| 358 scoped_refptr<PluginInstance> plugin_instance = | 370 scoped_refptr<PluginInstance> plugin_instance = |
| 359 ResourceHelper::GetPluginInstance(this); | 371 ResourceHelper::GetPluginInstance(this); |
| 360 if (!plugin_instance.get()) | 372 if (!plugin_instance.get()) |
| 361 return PP_ERROR_FAILED; | 373 return PP_ERROR_FAILED; |
| 362 | 374 |
| 363 if (!file_system_) { | 375 if (!file_system_) { |
| 364 // External file system | 376 // External file system |
| 365 // We have to do something totally different for external file systems. | 377 // We have to do something totally different for external file systems. |
| 366 | 378 |
| 367 // TODO(teravest): Use the SequencedWorkerPool instead. | 379 // TODO(teravest): Use the SequencedWorkerPool instead. |
| 368 scoped_refptr<base::TaskRunner> task_runner = | 380 scoped_refptr<base::TaskRunner> task_runner = |
| 369 plugin_instance->delegate()->GetFileThreadMessageLoopProxy(); | 381 plugin_instance->delegate()->GetFileThreadMessageLoopProxy(); |
| 370 if (!plugin_instance->delegate()->AsyncOpenFile( | 382 if (!plugin_instance->delegate()->AsyncOpenFile( |
| 371 GetSystemPath(), | 383 GetSystemPath(), |
| 372 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, | 384 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, |
| 373 base::Bind(&QueryCallback, task_runner, info, callback))) | 385 base::Bind(&QueryCallback, task_runner, info, callback))) |
| 374 return PP_ERROR_FAILED; | 386 return PP_ERROR_FAILED; |
| 375 } else { | 387 } else { |
| 376 // Non-external file system | 388 // Non-external file system |
| 377 if (!HasValidFileSystem()) | 389 if (!HasValidFileSystem()) |
| 378 return PP_ERROR_NOACCESS; | 390 return PP_ERROR_NOACCESS; |
| 379 | 391 |
| 392 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); | |
| 393 PluginDelegate* delegate = | |
| 394 plugin_instance ? plugin_instance->delegate() : NULL; | |
| 395 DCHECK(delegate); | |
|
yzshen1
2013/04/08 21:05:16
Why we DCHECK here while testing NULL elsewhere?
victorhsieh
2013/04/08 23:44:38
I don't know. Fixed :P
| |
| 396 | |
| 380 if (!plugin_instance->delegate()->Query( | 397 if (!plugin_instance->delegate()->Query( |
| 381 GetFileSystemURL(), | 398 GetFileSystemURL(), |
| 382 new FileCallbacks(this, callback, info, file_system_))) | 399 new FileCallbacks(this, callback, info, |
| 400 delegate->GetFileSystemType(pp_instance(), | |
| 401 file_system_)))) | |
| 383 return PP_ERROR_FAILED; | 402 return PP_ERROR_FAILED; |
| 384 | 403 |
| 385 } | 404 } |
| 386 return PP_OK_COMPLETIONPENDING; | 405 return PP_OK_COMPLETIONPENDING; |
| 387 } | 406 } |
| 388 | 407 |
| 389 } // namespace ppapi | 408 } // namespace ppapi |
| 390 } // namespace webkit | 409 } // namespace webkit |
| OLD | NEW |