| 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 CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ |
| 7 | 7 |
| 8 #include <set> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "content/public/renderer/renderer_ppapi_host.h" | 13 #include "content/public/renderer/renderer_ppapi_host.h" |
| 13 #include "ppapi/host/host_message_context.h" | 14 #include "ppapi/host/host_message_context.h" |
| 14 #include "ppapi/host/resource_host.h" | 15 #include "ppapi/host/resource_host.h" |
| 15 #include "ppapi/shared_impl/file_io_state_manager.h" | 16 #include "ppapi/shared_impl/file_io_state_manager.h" |
| 16 #include "ppapi/thunk/ppb_file_ref_api.h" | 17 #include "ppapi/thunk/ppb_file_ref_api.h" |
| 17 #include "webkit/plugins/ppapi/plugin_delegate.h" | 18 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void ExecutePlatformReadCallback(ReplyMessageContext reply_context, | 88 void ExecutePlatformReadCallback(ReplyMessageContext reply_context, |
| 88 base::PlatformFileError error_code, | 89 base::PlatformFileError error_code, |
| 89 const char* data, int bytes_read); | 90 const char* data, int bytes_read); |
| 90 void ExecutePlatformWriteCallback(ReplyMessageContext reply_context, | 91 void ExecutePlatformWriteCallback(ReplyMessageContext reply_context, |
| 91 base::PlatformFileError error_code, | 92 base::PlatformFileError error_code, |
| 92 int bytes_written); | 93 int bytes_written); |
| 93 void ExecutePlatformWillWriteCallback(ReplyMessageContext reply_context, | 94 void ExecutePlatformWillWriteCallback(ReplyMessageContext reply_context, |
| 94 base::PlatformFileError error_code, | 95 base::PlatformFileError error_code, |
| 95 int bytes_written); | 96 int bytes_written); |
| 96 | 97 |
| 98 bool IsGetOSFileDescriptorAllowed() const; |
| 99 |
| 97 // TODO(victorhsieh): eliminate plugin_delegate_ as it's no longer needed. | 100 // TODO(victorhsieh): eliminate plugin_delegate_ as it's no longer needed. |
| 98 webkit::ppapi::PluginDelegate* plugin_delegate_; // Not owned. | 101 webkit::ppapi::PluginDelegate* plugin_delegate_; // Not owned. |
| 99 | 102 |
| 100 base::PlatformFile file_; | 103 base::PlatformFile file_; |
| 101 | 104 |
| 102 // The file system type specified in the Open() call. This will be | 105 // The file system type specified in the Open() call. This will be |
| 103 // PP_FILESYSTEMTYPE_INVALID before open was called. This value does not | 106 // PP_FILESYSTEMTYPE_INVALID before open was called. This value does not |
| 104 // indicate that the open command actually succeeded. | 107 // indicate that the open command actually succeeded. |
| 105 PP_FileSystemType file_system_type_; | 108 PP_FileSystemType file_system_type_; |
| 106 | 109 |
| 107 // Valid only for PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY}. | 110 // Valid only for PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY}. |
| 108 GURL file_system_url_; | 111 GURL file_system_url_; |
| 109 | 112 |
| 110 // Callback function for notifying when the file handle is closed. | 113 // Callback function for notifying when the file handle is closed. |
| 111 PluginDelegate::NotifyCloseFileCallback notify_close_file_callback_; | 114 PluginDelegate::NotifyCloseFileCallback notify_close_file_callback_; |
| 112 | 115 |
| 113 // Pointer to a QuotaFileIO instance, which is valid only while a file | 116 // Pointer to a QuotaFileIO instance, which is valid only while a file |
| 114 // of type PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY} is opened. | 117 // of type PP_FILESYSTEMTYPE_LOCAL{PERSISTENT,TEMPORARY} is opened. |
| 115 scoped_ptr<webkit::ppapi::QuotaFileIO> quota_file_io_; | 118 scoped_ptr<webkit::ppapi::QuotaFileIO> quota_file_io_; |
| 116 | 119 |
| 117 bool is_running_in_process_; | 120 bool is_running_in_process_; |
| 118 | 121 |
| 119 base::WeakPtrFactory<PepperFileIOHost> weak_factory_; | 122 base::WeakPtrFactory<PepperFileIOHost> weak_factory_; |
| 120 | 123 |
| 121 ppapi::FileIOStateManager state_manager_; | 124 ppapi::FileIOStateManager state_manager_; |
| 122 | 125 |
| 126 // The whitelist for GetOSFileHandle specified by commandline. |
| 127 std::set<std::string> allowed_hosts_; |
| 128 |
| 123 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); | 129 DISALLOW_COPY_AND_ASSIGN(PepperFileIOHost); |
| 124 }; | 130 }; |
| 125 | 131 |
| 126 } // namespace content | 132 } // namespace content |
| 127 | 133 |
| 128 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ | 134 #endif // CONTENT_RENDERER_PEPPER_PEPPER_FILE_IO_HOST_H_ |
| 129 | |
| OLD | NEW |