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