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 PPAPI_PROXY_FILE_IO_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_FILE_IO_RESOURCE_H_ |
6 #define PPAPI_PROXY_FILE_IO_RESOURCE_H_ | 6 #define PPAPI_PROXY_FILE_IO_RESOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/c/private/pp_file_handle.h" | 10 #include "ppapi/c/private/pp_file_handle.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 virtual int32_t RequestOSFileHandle( | 59 virtual int32_t RequestOSFileHandle( |
60 PP_FileHandle* handle, | 60 PP_FileHandle* handle, |
61 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 61 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
62 virtual int32_t WillWrite(int64_t offset, | 62 virtual int32_t WillWrite(int64_t offset, |
63 int32_t bytes_to_write, | 63 int32_t bytes_to_write, |
64 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 64 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
65 virtual int32_t WillSetLength( | 65 virtual int32_t WillSetLength( |
66 int64_t length, | 66 int64_t length, |
67 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 67 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
68 | 68 |
| 69 // FileUtilProxy callbacks. These must be public so we can invoke them |
| 70 // from outside the class. |
| 71 void OnQueryComplete(scoped_refptr<TrackedCallback> callback, |
| 72 PP_FileInfo* output_info, |
| 73 base::PlatformFileError error_code, |
| 74 const base::PlatformFileInfo& file_info); |
| 75 void OnReadComplete(scoped_refptr<TrackedCallback> callback, |
| 76 PP_ArrayOutput array_output, |
| 77 base::PlatformFileError error_code, |
| 78 const char* data, int bytes_read); |
| 79 |
69 private: | 80 private: |
70 int32_t ReadValidated(int64_t offset, | 81 int32_t ReadValidated(int64_t offset, |
71 int32_t bytes_to_read, | 82 int32_t bytes_to_read, |
72 const PP_ArrayOutput& array_output, | 83 const PP_ArrayOutput& array_output, |
73 scoped_refptr<TrackedCallback> callback); | 84 scoped_refptr<TrackedCallback> callback); |
| 85 void CloseFileHandle(); |
74 | 86 |
75 // Handlers of reply messages. Note that all of them have a callback | 87 // Reply message handlers. |
76 // parameters bound when call to the host. | |
77 void OnPluginMsgGeneralComplete(scoped_refptr<TrackedCallback> callback, | 88 void OnPluginMsgGeneralComplete(scoped_refptr<TrackedCallback> callback, |
78 const ResourceMessageReplyParams& params); | 89 const ResourceMessageReplyParams& params); |
79 void OnPluginMsgOpenFileComplete(scoped_refptr<TrackedCallback> callback, | 90 void OnPluginMsgOpenFileComplete(scoped_refptr<TrackedCallback> callback, |
80 const ResourceMessageReplyParams& params); | 91 const ResourceMessageReplyParams& params); |
81 void OnPluginMsgQueryComplete(scoped_refptr<TrackedCallback> callback, | |
82 PP_FileInfo* output_info_, | |
83 const ResourceMessageReplyParams& params, | |
84 const PP_FileInfo& info); | |
85 void OnPluginMsgReadComplete(scoped_refptr<TrackedCallback> callback, | |
86 PP_ArrayOutput array_output, | |
87 const ResourceMessageReplyParams& params, | |
88 const std::string& data); | |
89 void OnPluginMsgRequestOSFileHandleComplete( | 92 void OnPluginMsgRequestOSFileHandleComplete( |
90 scoped_refptr<TrackedCallback> callback, | 93 scoped_refptr<TrackedCallback> callback, |
91 PP_FileHandle* output_handle, | 94 PP_FileHandle* output_handle, |
92 const ResourceMessageReplyParams& params); | 95 const ResourceMessageReplyParams& params); |
93 | 96 |
| 97 PP_FileHandle file_handle_; |
| 98 PP_FileSystemType file_system_type_; |
94 FileIOStateManager state_manager_; | 99 FileIOStateManager state_manager_; |
95 | 100 |
96 DISALLOW_COPY_AND_ASSIGN(FileIOResource); | 101 DISALLOW_COPY_AND_ASSIGN(FileIOResource); |
97 }; | 102 }; |
98 | 103 |
99 } // namespace proxy | 104 } // namespace proxy |
100 } // namespace ppapi | 105 } // namespace ppapi |
101 | 106 |
102 #endif // PPAPI_PROXY_FILE_IO_RESOURCE_H_ | 107 #endif // PPAPI_PROXY_FILE_IO_RESOURCE_H_ |
OLD | NEW |