| 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 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_FILE_SYSTEM_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_FILE_SYSTEM_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FILE_SYSTEM_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FILE_SYSTEM_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 11 #include "ppapi/c/dev/pp_file_info_dev.h" | 10 #include "ppapi/c/dev/pp_file_info_dev.h" |
| 12 #include "ppapi/thunk/ppb_file_system_api.h" | |
| 13 #include "webkit/plugins/ppapi/resource.h" | 11 #include "webkit/plugins/ppapi/resource.h" |
| 14 | 12 |
| 15 struct PPB_FileSystem_Dev; | 13 struct PPB_FileSystem_Dev; |
| 16 | 14 |
| 17 namespace webkit { | 15 namespace webkit { |
| 18 namespace ppapi { | 16 namespace ppapi { |
| 19 | 17 |
| 20 class PluginInstance; | 18 class PluginInstance; |
| 21 | 19 |
| 22 class PPB_FileSystem_Impl : public Resource, | 20 class PPB_FileSystem_Impl : public Resource { |
| 23 public ::ppapi::thunk::PPB_FileSystem_API { | |
| 24 public: | 21 public: |
| 22 // Returns a pointer to the interface implementing PPB_FileSystem that is |
| 23 // exposed to the plugin. |
| 24 static const PPB_FileSystem_Dev* GetInterface(); |
| 25 |
| 25 PPB_FileSystem_Impl(PluginInstance* instance, PP_FileSystemType_Dev type); | 26 PPB_FileSystem_Impl(PluginInstance* instance, PP_FileSystemType_Dev type); |
| 26 ~PPB_FileSystem_Impl(); | 27 virtual PPB_FileSystem_Impl* AsPPB_FileSystem_Impl(); |
| 27 | |
| 28 static PP_Resource Create(PP_Instance instance, PP_FileSystemType_Dev type); | |
| 29 | |
| 30 // ResourceObjectBase overrides. | |
| 31 virtual ::ppapi::thunk::PPB_FileSystem_API* AsPPB_FileSystem_API() OVERRIDE; | |
| 32 | 28 |
| 33 PluginInstance* instance() { return instance_; } | 29 PluginInstance* instance() { return instance_; } |
| 34 PP_FileSystemType_Dev type() { return type_; } | 30 PP_FileSystemType_Dev type() { return type_; } |
| 35 const GURL& root_url() const { return root_url_; } | 31 const GURL& root_url() const { return root_url_; } |
| 36 void set_root_url(const GURL& root_url) { root_url_ = root_url; } | 32 void set_root_url(const GURL& root_url) { root_url_ = root_url; } |
| 37 bool opened() const { return opened_; } | 33 bool opened() const { return opened_; } |
| 38 void set_opened(bool opened) { opened_ = opened; } | 34 void set_opened(bool opened) { opened_ = opened; } |
| 39 | 35 bool called_open() const { return called_open_; } |
| 40 // PPB_FileSystem_API implementation. | 36 void set_called_open() { called_open_ = true; } |
| 41 virtual int32_t Open(int64_t expected_size, | |
| 42 PP_CompletionCallback callback) OVERRIDE; | |
| 43 virtual PP_FileSystemType_Dev GetType() OVERRIDE; | |
| 44 | 37 |
| 45 private: | 38 private: |
| 46 PluginInstance* instance_; | 39 PluginInstance* instance_; |
| 47 PP_FileSystemType_Dev type_; | 40 PP_FileSystemType_Dev type_; |
| 48 GURL root_url_; | 41 GURL root_url_; |
| 49 bool opened_; | 42 bool opened_; |
| 50 bool called_open_; | 43 bool called_open_; |
| 51 | 44 |
| 52 DISALLOW_COPY_AND_ASSIGN(PPB_FileSystem_Impl); | 45 DISALLOW_COPY_AND_ASSIGN(PPB_FileSystem_Impl); |
| 53 }; | 46 }; |
| 54 | 47 |
| 55 } // namespace ppapi | 48 } // namespace ppapi |
| 56 } // namespace webkit | 49 } // namespace webkit |
| 57 | 50 |
| 58 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FILE_SYSTEM_IMPL_H_ | 51 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FILE_SYSTEM_IMPL_H_ |
| OLD | NEW |