| 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/ppb_file_system_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_file_system_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "ppapi/c/dev/ppb_file_system_dev.h" | |
| 9 #include "ppapi/c/pp_completion_callback.h" | 8 #include "ppapi/c/pp_completion_callback.h" |
| 9 #include "ppapi/c/ppb_file_system.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 14 #include "webkit/fileapi/file_system_types.h" | 14 #include "webkit/fileapi/file_system_types.h" |
| 15 #include "webkit/plugins/ppapi/common.h" | 15 #include "webkit/plugins/ppapi/common.h" |
| 16 #include "webkit/plugins/ppapi/file_callbacks.h" | 16 #include "webkit/plugins/ppapi/file_callbacks.h" |
| 17 #include "webkit/plugins/ppapi/plugin_delegate.h" | 17 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 18 #include "webkit/plugins/ppapi/plugin_module.h" | 18 #include "webkit/plugins/ppapi/plugin_module.h" |
| 19 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 19 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 20 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" | 20 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" |
| 21 #include "webkit/plugins/ppapi/resource.h" | 21 #include "webkit/plugins/ppapi/resource.h" |
| 22 #include "webkit/plugins/ppapi/resource_tracker.h" | 22 #include "webkit/plugins/ppapi/resource_tracker.h" |
| 23 | 23 |
| 24 using ppapi::thunk::PPB_FileSystem_API; | 24 using ppapi::thunk::PPB_FileSystem_API; |
| 25 | 25 |
| 26 namespace webkit { | 26 namespace webkit { |
| 27 namespace ppapi { | 27 namespace ppapi { |
| 28 | 28 |
| 29 PPB_FileSystem_Impl::PPB_FileSystem_Impl(PluginInstance* instance, | 29 PPB_FileSystem_Impl::PPB_FileSystem_Impl(PluginInstance* instance, |
| 30 PP_FileSystemType_Dev type) | 30 PP_FileSystemType type) |
| 31 : Resource(instance), | 31 : Resource(instance), |
| 32 instance_(instance), | 32 instance_(instance), |
| 33 type_(type), | 33 type_(type), |
| 34 opened_(false), | 34 opened_(false), |
| 35 called_open_(false) { | 35 called_open_(false) { |
| 36 DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID); | 36 DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID); |
| 37 } | 37 } |
| 38 | 38 |
| 39 PPB_FileSystem_Impl::~PPB_FileSystem_Impl() { | 39 PPB_FileSystem_Impl::~PPB_FileSystem_Impl() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 // static | 42 // static |
| 43 PP_Resource PPB_FileSystem_Impl::Create(PluginInstance* instance, | 43 PP_Resource PPB_FileSystem_Impl::Create(PluginInstance* instance, |
| 44 PP_FileSystemType_Dev type) { | 44 PP_FileSystemType type) { |
| 45 if (type != PP_FILESYSTEMTYPE_EXTERNAL && | 45 if (type != PP_FILESYSTEMTYPE_EXTERNAL && |
| 46 type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && | 46 type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && |
| 47 type != PP_FILESYSTEMTYPE_LOCALTEMPORARY) | 47 type != PP_FILESYSTEMTYPE_LOCALTEMPORARY) |
| 48 return 0; | 48 return 0; |
| 49 | 49 |
| 50 PPB_FileSystem_Impl* file_system = new PPB_FileSystem_Impl(instance, type); | 50 PPB_FileSystem_Impl* file_system = new PPB_FileSystem_Impl(instance, type); |
| 51 return file_system->GetReference(); | 51 return file_system->GetReference(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 PPB_FileSystem_API* PPB_FileSystem_Impl::AsPPB_FileSystem_API() { | 54 PPB_FileSystem_API* PPB_FileSystem_Impl::AsPPB_FileSystem_API() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 instance()->container()->element().document().url(), | 74 instance()->container()->element().document().url(), |
| 75 file_system_type, expected_size, | 75 file_system_type, expected_size, |
| 76 new FileCallbacks(instance()->module()->AsWeakPtr(), | 76 new FileCallbacks(instance()->module()->AsWeakPtr(), |
| 77 GetReferenceNoAddRef(), | 77 GetReferenceNoAddRef(), |
| 78 callback, NULL, | 78 callback, NULL, |
| 79 scoped_refptr<PPB_FileSystem_Impl>(this), NULL))) | 79 scoped_refptr<PPB_FileSystem_Impl>(this), NULL))) |
| 80 return PP_ERROR_FAILED; | 80 return PP_ERROR_FAILED; |
| 81 return PP_OK_COMPLETIONPENDING; | 81 return PP_OK_COMPLETIONPENDING; |
| 82 } | 82 } |
| 83 | 83 |
| 84 PP_FileSystemType_Dev PPB_FileSystem_Impl::GetType() { | 84 PP_FileSystemType PPB_FileSystem_Impl::GetType() { |
| 85 return type_; | 85 return type_; |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace ppapi | 88 } // namespace ppapi |
| 89 } // namespace webkit | 89 } // namespace webkit |
| 90 | |
| OLD | NEW |