OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer/manifest_service_channel.h" | 5 #include "components/nacl/renderer/manifest_service_channel.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
11 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_channel.h" |
12 #include "ipc/ipc_sync_channel.h" | 12 #include "ipc/ipc_sync_channel.h" |
13 #include "ppapi/c/pp_errors.h" | 13 #include "ppapi/c/pp_errors.h" |
| 14 #include "ppapi/c/ppb_file_io.h" |
14 #include "ppapi/proxy/ppapi_messages.h" | 15 #include "ppapi/proxy/ppapi_messages.h" |
15 | 16 |
16 namespace nacl { | 17 namespace nacl { |
17 | 18 |
18 ManifestServiceChannel::ManifestServiceChannel( | 19 ManifestServiceChannel::ManifestServiceChannel( |
19 const IPC::ChannelHandle& handle, | 20 const IPC::ChannelHandle& handle, |
20 const base::Callback<void(int32_t)>& connected_callback, | 21 const base::Callback<void(int32_t)>& connected_callback, |
21 scoped_ptr<Delegate> delegate, | 22 scoped_ptr<Delegate> delegate, |
22 base::WaitableEvent* waitable_event) | 23 base::WaitableEvent* waitable_event) |
23 : connected_callback_(connected_callback), | 24 : connected_callback_(connected_callback), |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 #else | 80 #else |
80 PpapiHostMsg_OpenResource::WriteReplyParams( | 81 PpapiHostMsg_OpenResource::WriteReplyParams( |
81 reply, ppapi::proxy::SerializedHandle()); | 82 reply, ppapi::proxy::SerializedHandle()); |
82 Send(reply); | 83 Send(reply); |
83 #endif | 84 #endif |
84 } | 85 } |
85 | 86 |
86 #if !defined(OS_WIN) | 87 #if !defined(OS_WIN) |
87 void ManifestServiceChannel::DidOpenResource( | 88 void ManifestServiceChannel::DidOpenResource( |
88 IPC::Message* reply, base::File file) { | 89 IPC::Message* reply, base::File file) { |
| 90 ppapi::proxy::SerializedHandle h; |
| 91 if (file.IsValid()) { |
| 92 h.set_file_handle(base::FileDescriptor(file.Pass()), |
| 93 PP_FILEOPENFLAG_READ, |
| 94 0); |
| 95 } |
89 // Here, PlatformFileForTransit is alias of base::FileDescriptor. | 96 // Here, PlatformFileForTransit is alias of base::FileDescriptor. |
90 PpapiHostMsg_OpenResource::WriteReplyParams( | 97 PpapiHostMsg_OpenResource::WriteReplyParams(reply, h); |
91 reply, | |
92 ppapi::proxy::SerializedHandle( | |
93 ppapi::proxy::SerializedHandle::FILE, | |
94 base::FileDescriptor(file.Pass()))); | |
95 Send(reply); | 98 Send(reply); |
96 } | 99 } |
97 #endif | 100 #endif |
98 | 101 |
99 } // namespace nacl | 102 } // namespace nacl |
OLD | NEW |