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 4a0a4b77aa09899df3e3cfd66cdef01ab5bf0aab..116c239e794878e0a992225281c5980a1765da9a 100644 |
--- a/components/nacl/loader/nacl_ipc_adapter.h |
+++ b/components/nacl/loader/nacl_ipc_adapter.h |
@@ -131,6 +131,22 @@ class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>, |
resolve_file_token_cb_ = cb; |
} |
+ 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; |
+ |
+ // Sets a callback to be invoked for intercepting open_resource IRT calls. |
+ // The callback may immediately call a OpenResourceReplyCallback function to |
+ // send a pre-opened resrouce descriptor to the untrusted side. |
+ // OpenResourceCallback returns true when OpenResourceReplyCallback is called. |
+ void set_open_resource_callback(OpenResourceCallback cb) { |
+ open_resource_cb_ = cb; |
+ } |
+ |
private: |
friend class base::RefCountedThreadSafe<NaClIPCAdapter>; |
@@ -180,6 +196,9 @@ class NaClIPCAdapter : public base::RefCountedThreadSafe<NaClIPCAdapter>, |
void OnFileTokenResolved(const IPC::Message& orig_msg, |
IPC::PlatformFileForTransit ipc_fd, |
base::FilePath file_path); |
+ void OnFileTokenResolvedLocked(const IPC::Message& orig_msg, |
+ IPC::PlatformFileForTransit ipc_fd, |
+ base::FilePath file_path); |
bool RewriteMessage(const IPC::Message& msg, uint32_t type); |
@@ -209,6 +228,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_; |