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 #include "components/nacl/browser/nacl_host_message_filter.h" | 5 #include "components/nacl/browser/nacl_host_message_filter.h" |
6 | 6 |
7 #include "components/nacl/browser/nacl_browser.h" | 7 #include "components/nacl/browser/nacl_browser.h" |
8 #include "components/nacl/browser/nacl_file_host.h" | 8 #include "components/nacl/browser/nacl_file_host.h" |
9 #include "components/nacl/browser/nacl_process_host.h" | 9 #include "components/nacl/browser/nacl_process_host.h" |
10 #include "components/nacl/browser/pnacl_host.h" | 10 #include "components/nacl/browser/pnacl_host.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 // This is the first message we receive from the renderer once it knows we | 96 // This is the first message we receive from the renderer once it knows we |
97 // want to use PNaCl, so start the translation cache initialization here. | 97 // want to use PNaCl, so start the translation cache initialization here. |
98 pnacl::PnaclHost::GetInstance()->Init(); | 98 pnacl::PnaclHost::GetInstance()->Init(); |
99 } | 99 } |
100 | 100 |
101 // Return the temporary file via a reply to the | 101 // Return the temporary file via a reply to the |
102 // NaClHostMsg_NaClCreateTemporaryFile sync message. | 102 // NaClHostMsg_NaClCreateTemporaryFile sync message. |
103 void NaClHostMessageFilter::SyncReturnTemporaryFile( | 103 void NaClHostMessageFilter::SyncReturnTemporaryFile( |
104 IPC::Message* reply_msg, | 104 IPC::Message* reply_msg, |
105 base::PlatformFile fd) { | 105 base::File file) { |
106 if (fd == base::kInvalidPlatformFileValue) { | 106 if (file.IsValid()) { |
107 reply_msg->set_reply_error(); | |
108 } else { | |
109 NaClHostMsg_NaClCreateTemporaryFile::WriteReplyParams( | 107 NaClHostMsg_NaClCreateTemporaryFile::WriteReplyParams( |
110 reply_msg, | 108 reply_msg, |
111 IPC::GetFileHandleForProcess(fd, PeerHandle(), true)); | 109 IPC::TakeFileHandleForProcess(file.Pass(), PeerHandle())); |
| 110 } else { |
| 111 reply_msg->set_reply_error(); |
112 } | 112 } |
113 Send(reply_msg); | 113 Send(reply_msg); |
114 } | 114 } |
115 | 115 |
116 void NaClHostMessageFilter::OnNaClCreateTemporaryFile( | 116 void NaClHostMessageFilter::OnNaClCreateTemporaryFile( |
117 IPC::Message* reply_msg) { | 117 IPC::Message* reply_msg) { |
118 pnacl::PnaclHost::GetInstance()->CreateTemporaryFile( | 118 pnacl::PnaclHost::GetInstance()->CreateTemporaryFile( |
119 base::Bind(&NaClHostMessageFilter::SyncReturnTemporaryFile, | 119 base::Bind(&NaClHostMessageFilter::SyncReturnTemporaryFile, |
120 this, | 120 this, |
121 reply_msg)); | 121 reply_msg)); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 void NaClHostMessageFilter::OnOpenNaClExecutable(int render_view_id, | 169 void NaClHostMessageFilter::OnOpenNaClExecutable(int render_view_id, |
170 const GURL& file_url, | 170 const GURL& file_url, |
171 IPC::Message* reply_msg) { | 171 IPC::Message* reply_msg) { |
172 nacl_file_host::OpenNaClExecutable(this, render_view_id, file_url, | 172 nacl_file_host::OpenNaClExecutable(this, render_view_id, file_url, |
173 reply_msg); | 173 reply_msg); |
174 } | 174 } |
175 #endif | 175 #endif |
176 | 176 |
177 } // namespace nacl | 177 } // namespace nacl |
OLD | NEW |