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/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 #include "net/base/escape.h" | 10 #include "net/base/escape.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 286 |
287 bool PPB_FileRef_Impl::HasValidFileSystem() const { | 287 bool PPB_FileRef_Impl::HasValidFileSystem() const { |
288 return file_system_ && file_system_->opened(); | 288 return file_system_ && file_system_->opened(); |
289 } | 289 } |
290 | 290 |
291 bool PPB_FileRef_Impl::IsValidNonExternalFileSystem() const { | 291 bool PPB_FileRef_Impl::IsValidNonExternalFileSystem() const { |
292 return file_system_ && file_system_->opened() && | 292 return file_system_ && file_system_->opened() && |
293 file_system_->type() != PP_FILESYSTEMTYPE_EXTERNAL; | 293 file_system_->type() != PP_FILESYSTEMTYPE_EXTERNAL; |
294 } | 294 } |
295 | 295 |
| 296 int32_t PPB_FileRef_Impl::Query(PP_FileInfo* info, |
| 297 scoped_refptr<TrackedCallback> callback) { |
| 298 if (!IsValidNonExternalFileSystem()) |
| 299 return PP_ERROR_NOACCESS; |
| 300 |
| 301 PluginInstance* plugin_instance = ResourceHelper::GetPluginInstance(this); |
| 302 if (!plugin_instance) |
| 303 return PP_ERROR_FAILED; |
| 304 |
| 305 if (!plugin_instance->delegate()->Query( |
| 306 GetFileSystemURL(), |
| 307 new FileCallbacks(this, callback, info, file_system_))) |
| 308 return PP_ERROR_FAILED; |
| 309 |
| 310 return PP_OK_COMPLETIONPENDING; |
| 311 } |
| 312 |
296 } // namespace ppapi | 313 } // namespace ppapi |
297 } // namespace webkit | 314 } // namespace webkit |
OLD | NEW |