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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 private: | 69 private: |
70 int32_t ReadValidated(int64_t offset, | 70 int32_t ReadValidated(int64_t offset, |
71 int32_t bytes_to_read, | 71 int32_t bytes_to_read, |
72 const PP_ArrayOutput& array_output, | 72 const PP_ArrayOutput& array_output, |
73 scoped_refptr<TrackedCallback> callback); | 73 scoped_refptr<TrackedCallback> callback); |
| 74 void CloseFileHandle(); |
74 | 75 |
75 // Handlers of reply messages. Note that all of them have a callback | 76 // Reply message handlers for operations that are done in the host. |
76 // parameters bound when call to the host. | |
77 void OnPluginMsgGeneralComplete(scoped_refptr<TrackedCallback> callback, | 77 void OnPluginMsgGeneralComplete(scoped_refptr<TrackedCallback> callback, |
78 const ResourceMessageReplyParams& params); | 78 const ResourceMessageReplyParams& params); |
79 void OnPluginMsgOpenFileComplete(scoped_refptr<TrackedCallback> callback, | 79 void OnPluginMsgOpenFileComplete(scoped_refptr<TrackedCallback> callback, |
80 const ResourceMessageReplyParams& params); | 80 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( | 81 void OnPluginMsgRequestOSFileHandleComplete( |
90 scoped_refptr<TrackedCallback> callback, | 82 scoped_refptr<TrackedCallback> callback, |
91 PP_FileHandle* output_handle, | 83 PP_FileHandle* output_handle, |
92 const ResourceMessageReplyParams& params); | 84 const ResourceMessageReplyParams& params); |
93 | 85 |
| 86 // Reply message handlers for operations that are done in the plugin. |
| 87 void OnQueryComplete(scoped_refptr<TrackedCallback> callback, |
| 88 PP_FileInfo* output_info, |
| 89 base::PlatformFileError error_code, |
| 90 const base::PlatformFileInfo& file_info); |
| 91 void OnReadComplete(scoped_refptr<TrackedCallback> callback, |
| 92 PP_ArrayOutput array_output, |
| 93 base::PlatformFileError error_code, |
| 94 const char* data, int bytes_read); |
| 95 |
| 96 PP_FileHandle file_handle_; |
| 97 PP_FileSystemType file_system_type_; |
94 FileIOStateManager state_manager_; | 98 FileIOStateManager state_manager_; |
95 | 99 |
96 DISALLOW_COPY_AND_ASSIGN(FileIOResource); | 100 DISALLOW_COPY_AND_ASSIGN(FileIOResource); |
97 }; | 101 }; |
98 | 102 |
99 } // namespace proxy | 103 } // namespace proxy |
100 } // namespace ppapi | 104 } // namespace ppapi |
101 | 105 |
102 #endif // PPAPI_PROXY_FILE_IO_RESOURCE_H_ | 106 #endif // PPAPI_PROXY_FILE_IO_RESOURCE_H_ |
OLD | NEW |