Index: components/nacl/loader/nacl_ipc_adapter.h |
diff --git a/components/nacl/loader/nacl_ipc_adapter.h b/components/nacl/loader/nacl_ipc_adapter.h |
index ece964ea2802bd4e101908003fbfc82da6e2e5a0..f8d93ff9804ecf5f730fa348748f962ddab42b27 100644 |
--- a/components/nacl/loader/nacl_ipc_adapter.h |
+++ b/components/nacl/loader/nacl_ipc_adapter.h |
@@ -80,6 +80,14 @@ class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>, |
ResolveFileTokenReplyCallback)> |
ResolveFileTokenCallback; |
+ typedef base::Callback<void(const IPC::Message&, |
+ IPC::PlatformFileForTransit, |
+ base::FilePath)> OpenResourceReplyCallback; |
+ |
+ typedef base::Callback<bool(const IPC::Message&, |
+ const std::string&, // key |
+ OpenResourceReplyCallback)> OpenResourceCallback; |
+ |
// Creates an adapter, using the thread associated with the given task |
// runner for posting messages. In normal use, the task runner will post to |
// the I/O thread of the process. |
@@ -91,11 +99,16 @@ class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>, |
// |resolve_file_token_cb| is an optional callback to be invoked for |
// resolving file tokens received from the renderer. When the file token |
// is resolved, the ResolveFileTokenReplyCallback passed inside the |
- // ResolveFileTokenCallback will be invoked. |
+ // ResolveFileTokenCallback will be invoked. |open_resource_cb| is also an |
+ // optional callback to be invoked for intercepting open_resource IRT calls. |
+ // |open_resource_cb| may immediately call a OpenResourceReplyCallback |
+ // function to send a pre-opened resource descriptor to the untrusted side. |
+ // OpenResourceCallback returns true when OpenResourceReplyCallback is called. |
NaClIPCAdapter( |
const IPC::ChannelHandle& handle, |
base::TaskRunner* runner, |
- ResolveFileTokenCallback resolve_file_token_cb); |
+ ResolveFileTokenCallback resolve_file_token_cb, |
+ OpenResourceCallback open_resource_cb); |
// Initializes with a given channel that's already created for testing |
// purposes. This function will take ownership of the given channel. |
@@ -177,9 +190,9 @@ class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>, |
~NaClIPCAdapter() override; |
- void OnFileTokenResolved(const IPC::Message& orig_msg, |
- IPC::PlatformFileForTransit ipc_fd, |
- base::FilePath file_path); |
+ void SaveOpenResourceMessage(const IPC::Message& orig_msg, |
+ IPC::PlatformFileForTransit ipc_fd, |
+ base::FilePath file_path); |
bool RewriteMessage(const IPC::Message& msg, uint32_t type); |
@@ -209,6 +222,7 @@ class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>, |
scoped_refptr<base::TaskRunner> task_runner_; |
ResolveFileTokenCallback resolve_file_token_cb_; |
+ OpenResourceCallback open_resource_cb_; |
// To be accessed inside of lock_ only. |
LockedData locked_data_; |