| 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 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_FILE_REF_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_FILE_REF_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FILE_REF_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FILE_REF_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 #include "ppapi/c/pp_file_info.h" |
| 12 #include "ppapi/c/ppb_file_ref.h" | 13 #include "ppapi/c/ppb_file_ref.h" |
| 13 #include "ppapi/shared_impl/ppb_file_ref_shared.h" | 14 #include "ppapi/shared_impl/ppb_file_ref_shared.h" |
| 14 #include "ppapi/shared_impl/var.h" | 15 #include "ppapi/shared_impl/var.h" |
| 15 #include "webkit/glue/webkit_glue_export.h" | 16 #include "webkit/glue/webkit_glue_export.h" |
| 16 | 17 |
| 17 namespace webkit { | 18 namespace webkit { |
| 18 namespace ppapi { | 19 namespace ppapi { |
| 19 | 20 |
| 20 using ::ppapi::StringVar; | 21 using ::ppapi::StringVar; |
| 21 | 22 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 46 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; | 47 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; |
| 47 virtual int32_t Touch( | 48 virtual int32_t Touch( |
| 48 PP_Time last_access_time, | 49 PP_Time last_access_time, |
| 49 PP_Time last_modified_time, | 50 PP_Time last_modified_time, |
| 50 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; | 51 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; |
| 51 virtual int32_t Delete( | 52 virtual int32_t Delete( |
| 52 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; | 53 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; |
| 53 virtual int32_t Rename( | 54 virtual int32_t Rename( |
| 54 PP_Resource new_file_ref, | 55 PP_Resource new_file_ref, |
| 55 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; | 56 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; |
| 57 virtual int32_t Query( |
| 58 PP_FileInfo* info, |
| 59 scoped_refptr< ::ppapi::TrackedCallback> callback) OVERRIDE; |
| 56 virtual PP_Var GetAbsolutePath(); | 60 virtual PP_Var GetAbsolutePath(); |
| 57 | 61 |
| 58 PPB_FileSystem_Impl* file_system() const { return file_system_.get(); } | 62 PPB_FileSystem_Impl* file_system() const { return file_system_.get(); } |
| 59 | 63 |
| 60 // Returns the system path corresponding to this file. Valid only for | 64 // Returns the system path corresponding to this file. Valid only for |
| 61 // external filesystems. | 65 // external filesystems. |
| 62 base::FilePath GetSystemPath() const; | 66 base::FilePath GetSystemPath() const; |
| 63 | 67 |
| 64 // Returns the FileSystem API URL corresponding to this file. | 68 // Returns the FileSystem API URL corresponding to this file. |
| 65 GURL GetFileSystemURL() const; | 69 GURL GetFileSystemURL() const; |
| 66 | 70 |
| 67 // Checks if file ref has file system instance and if the instance is opened. | 71 // Checks if file ref has file system instance and if the instance is opened. |
| 68 bool HasValidFileSystem() const; | 72 bool HasValidFileSystem() const; |
| 69 private: | 73 private: |
| 74 // Callbacks to support FileRef::Query. |
| 75 void QueryCallback(PP_FileInfo* info, |
| 76 scoped_refptr< ::ppapi::TrackedCallback> callback, |
| 77 base::PlatformFileError error_code, |
| 78 base::PassPlatformFile passed_file); |
| 79 void GetFileInfoCallback(base::PlatformFile file, |
| 80 PP_FileInfo* info, |
| 81 scoped_refptr< ::ppapi::TrackedCallback> callback, |
| 82 base::PlatformFileError error_code, |
| 83 const base::PlatformFileInfo& file_info); |
| 84 |
| 70 // Many mutation functions are allow only to non-external filesystems, This | 85 // Many mutation functions are allow only to non-external filesystems, This |
| 71 // function returns true if the filesystem is opened and isn't external as an | 86 // function returns true if the filesystem is opened and isn't external as an |
| 72 // access check for these functions. | 87 // access check for these functions. |
| 73 bool IsValidNonExternalFileSystem() const; | 88 bool IsValidNonExternalFileSystem() const; |
| 74 | 89 |
| 75 // Null for external filesystems. | 90 // Null for external filesystems. |
| 76 scoped_refptr<PPB_FileSystem_Impl> file_system_; | 91 scoped_refptr<PPB_FileSystem_Impl> file_system_; |
| 77 | 92 |
| 78 // Used only for external filesystems. | 93 // Used only for external filesystems. |
| 79 base::FilePath external_file_system_path_; | 94 base::FilePath external_file_system_path_; |
| 80 | 95 |
| 81 // Lazily initialized var created from the external path. This is so we can | 96 // Lazily initialized var created from the external path. This is so we can |
| 82 // return the identical string object every time it is requested. | 97 // return the identical string object every time it is requested. |
| 83 scoped_refptr<StringVar> external_path_var_; | 98 scoped_refptr<StringVar> external_path_var_; |
| 84 | 99 |
| 85 DISALLOW_COPY_AND_ASSIGN(PPB_FileRef_Impl); | 100 DISALLOW_COPY_AND_ASSIGN(PPB_FileRef_Impl); |
| 86 }; | 101 }; |
| 87 | 102 |
| 88 } // namespace ppapi | 103 } // namespace ppapi |
| 89 } // namespace webkit | 104 } // namespace webkit |
| 90 | 105 |
| 91 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FILE_REF_IMPL_H_ | 106 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FILE_REF_IMPL_H_ |
| OLD | NEW |