| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_NACL_LOADER_NACL_IPC_ADAPTER_H_ | 5 #ifndef COMPONENTS_NACL_LOADER_NACL_IPC_ADAPTER_H_ |
| 6 #define COMPONENTS_NACL_LOADER_NACL_IPC_ADAPTER_H_ | 6 #define COMPONENTS_NACL_LOADER_NACL_IPC_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 #include "ipc/ipc_listener.h" | 25 #include "ipc/ipc_listener.h" |
| 26 #include "ipc/ipc_platform_file.h" | 26 #include "ipc/ipc_platform_file.h" |
| 27 #include "ppapi/c/pp_stdint.h" | 27 #include "ppapi/c/pp_stdint.h" |
| 28 #include "ppapi/proxy/nacl_message_scanner.h" | 28 #include "ppapi/proxy/nacl_message_scanner.h" |
| 29 | 29 |
| 30 struct NaClDesc; | 30 struct NaClDesc; |
| 31 struct NaClImcTypedMsgHdr; | 31 struct NaClImcTypedMsgHdr; |
| 32 struct PP_Size; | 32 struct PP_Size; |
| 33 | 33 |
| 34 namespace base { |
| 35 class SingleThreadTaskRunner; |
| 36 } |
| 37 |
| 34 namespace IPC { | 38 namespace IPC { |
| 35 class Channel; | 39 class Channel; |
| 36 struct ChannelHandle; | 40 struct ChannelHandle; |
| 37 } | 41 } |
| 38 | 42 |
| 39 namespace ppapi { | 43 namespace ppapi { |
| 40 class HostResource; | 44 class HostResource; |
| 41 } | 45 } |
| 42 | 46 |
| 43 // Adapts a Chrome IPC channel to an IPC channel that we expose to Native | 47 // Adapts a Chrome IPC channel to an IPC channel that we expose to Native |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // connected. | 102 // connected. |
| 99 // | 103 // |
| 100 // |resolve_file_token_cb| is an optional callback to be invoked for | 104 // |resolve_file_token_cb| is an optional callback to be invoked for |
| 101 // resolving file tokens received from the renderer. When the file token | 105 // resolving file tokens received from the renderer. When the file token |
| 102 // is resolved, the ResolveFileTokenReplyCallback passed inside the | 106 // is resolved, the ResolveFileTokenReplyCallback passed inside the |
| 103 // ResolveFileTokenCallback will be invoked. |open_resource_cb| is also an | 107 // ResolveFileTokenCallback will be invoked. |open_resource_cb| is also an |
| 104 // optional callback to be invoked for intercepting open_resource IRT calls. | 108 // optional callback to be invoked for intercepting open_resource IRT calls. |
| 105 // |open_resource_cb| may immediately call a OpenResourceReplyCallback | 109 // |open_resource_cb| may immediately call a OpenResourceReplyCallback |
| 106 // function to send a pre-opened resource descriptor to the untrusted side. | 110 // function to send a pre-opened resource descriptor to the untrusted side. |
| 107 // OpenResourceCallback returns true when OpenResourceReplyCallback is called. | 111 // OpenResourceCallback returns true when OpenResourceReplyCallback is called. |
| 108 NaClIPCAdapter( | 112 NaClIPCAdapter(const IPC::ChannelHandle& handle, |
| 109 const IPC::ChannelHandle& handle, | 113 const scoped_refptr<base::SingleThreadTaskRunner>& runner, |
| 110 base::TaskRunner* runner, | 114 ResolveFileTokenCallback resolve_file_token_cb, |
| 111 ResolveFileTokenCallback resolve_file_token_cb, | 115 OpenResourceCallback open_resource_cb); |
| 112 OpenResourceCallback open_resource_cb); | |
| 113 | 116 |
| 114 // Initializes with a given channel that's already created for testing | 117 // Initializes with a given channel that's already created for testing |
| 115 // purposes. This function will take ownership of the given channel. | 118 // purposes. This function will take ownership of the given channel. |
| 116 NaClIPCAdapter(std::unique_ptr<IPC::Channel> channel, | 119 NaClIPCAdapter(std::unique_ptr<IPC::Channel> channel, |
| 117 base::TaskRunner* runner); | 120 base::TaskRunner* runner); |
| 118 | 121 |
| 119 // Connect the channel. This must be called after the constructor that accepts | 122 // Connect the channel. This must be called after the constructor that accepts |
| 120 // an IPC::ChannelHandle, and causes the Channel to be connected on the IO | 123 // an IPC::ChannelHandle, and causes the Channel to be connected on the IO |
| 121 // thread. | 124 // thread. |
| 122 void ConnectChannel(); | 125 void ConnectChannel(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // To be accessed on the I/O thread (via task runner) only. | 235 // To be accessed on the I/O thread (via task runner) only. |
| 233 IOThreadData io_thread_data_; | 236 IOThreadData io_thread_data_; |
| 234 | 237 |
| 235 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); | 238 DISALLOW_COPY_AND_ASSIGN(NaClIPCAdapter); |
| 236 }; | 239 }; |
| 237 | 240 |
| 238 // Export TranslatePepperFileReadWriteOpenFlags for testing. | 241 // Export TranslatePepperFileReadWriteOpenFlags for testing. |
| 239 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags); | 242 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags); |
| 240 | 243 |
| 241 #endif // COMPONENTS_NACL_LOADER_NACL_IPC_ADAPTER_H_ | 244 #endif // COMPONENTS_NACL_LOADER_NACL_IPC_ADAPTER_H_ |
| OLD | NEW |