OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/nacl_host/nacl_process_host.h" | 5 #include "chrome/browser/nacl_host/nacl_process_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "chrome/common/chrome_version_info.h" | 30 #include "chrome/common/chrome_version_info.h" |
31 #include "chrome/common/logging_chrome.h" | 31 #include "chrome/common/logging_chrome.h" |
32 #include "chrome/common/nacl_cmd_line.h" | 32 #include "chrome/common/nacl_cmd_line.h" |
33 #include "chrome/common/nacl_messages.h" | 33 #include "chrome/common/nacl_messages.h" |
34 #include "chrome/common/render_messages.h" | 34 #include "chrome/common/render_messages.h" |
35 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
36 #include "content/public/browser/browser_child_process_host.h" | 36 #include "content/public/browser/browser_child_process_host.h" |
37 #include "content/public/browser/child_process_data.h" | 37 #include "content/public/browser/child_process_data.h" |
38 #include "content/public/browser/pepper_helper.h" | 38 #include "content/public/browser/pepper_helper.h" |
39 #include "content/public/common/child_process_host.h" | 39 #include "content/public/common/child_process_host.h" |
| 40 #include "content/public/common/pepper_permissions_config.h" |
40 #include "ipc/ipc_channel.h" | 41 #include "ipc/ipc_channel.h" |
41 #include "ipc/ipc_switches.h" | 42 #include "ipc/ipc_switches.h" |
42 #include "native_client/src/shared/imc/nacl_imc.h" | 43 #include "native_client/src/shared/imc/nacl_imc.h" |
43 #include "net/base/net_util.h" | 44 #include "net/base/net_util.h" |
44 #include "net/base/tcp_listen_socket.h" | 45 #include "net/base/tcp_listen_socket.h" |
45 #include "ppapi/proxy/ppapi_messages.h" | 46 #include "ppapi/proxy/ppapi_messages.h" |
46 | 47 |
47 #if defined(OS_POSIX) | 48 #if defined(OS_POSIX) |
48 #include <fcntl.h> | 49 #include <fcntl.h> |
49 | 50 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 125 |
125 NaClProcessHost::PluginListener::PluginListener(NaClProcessHost* host) | 126 NaClProcessHost::PluginListener::PluginListener(NaClProcessHost* host) |
126 : host_(host) { | 127 : host_(host) { |
127 } | 128 } |
128 | 129 |
129 bool NaClProcessHost::PluginListener::OnMessageReceived( | 130 bool NaClProcessHost::PluginListener::OnMessageReceived( |
130 const IPC::Message& msg) { | 131 const IPC::Message& msg) { |
131 return host_->OnUntrustedMessageForwarded(msg); | 132 return host_->OnUntrustedMessageForwarded(msg); |
132 } | 133 } |
133 | 134 |
| 135 // TODO(brettw) bug 153036 set the pepper permissions up for dev interfaces. |
134 NaClProcessHost::NaClProcessHost(const GURL& manifest_url, bool off_the_record) | 136 NaClProcessHost::NaClProcessHost(const GURL& manifest_url, bool off_the_record) |
135 : manifest_url_(manifest_url), | 137 : manifest_url_(manifest_url), |
| 138 permissions_(content::AddPepperPermissionsFromCommandLine( |
| 139 ppapi::PpapiPermissions())), |
136 #if defined(OS_WIN) | 140 #if defined(OS_WIN) |
137 process_launched_by_broker_(false), | 141 process_launched_by_broker_(false), |
138 #elif defined(OS_LINUX) | 142 #elif defined(OS_LINUX) |
139 wait_for_nacl_gdb_(false), | 143 wait_for_nacl_gdb_(false), |
140 #endif | 144 #endif |
141 reply_msg_(NULL), | 145 reply_msg_(NULL), |
142 #if defined(OS_WIN) | 146 #if defined(OS_WIN) |
143 debug_exception_handler_requested_(false), | 147 debug_exception_handler_requested_(false), |
144 #endif | 148 #endif |
145 internal_(new NaClInternal()), | 149 internal_(new NaClInternal()), |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 base::MessageLoopProxy::current())); | 755 base::MessageLoopProxy::current())); |
752 // Enable PPAPI message dispatching to the browser process. | 756 // Enable PPAPI message dispatching to the browser process. |
753 content::EnablePepperSupportForChannel( | 757 content::EnablePepperSupportForChannel( |
754 ipc_proxy_channel_.get(), | 758 ipc_proxy_channel_.get(), |
755 chrome_render_message_filter_->GetHostResolver()); | 759 chrome_render_message_filter_->GetHostResolver()); |
756 // Send a message to create the NaCl-Renderer channel. The handle is just | 760 // Send a message to create the NaCl-Renderer channel. The handle is just |
757 // a place holder. | 761 // a place holder. |
758 ipc_proxy_channel_->Send( | 762 ipc_proxy_channel_->Send( |
759 new PpapiMsg_CreateNaClChannel( | 763 new PpapiMsg_CreateNaClChannel( |
760 chrome_render_message_filter_->render_process_id(), | 764 chrome_render_message_filter_->render_process_id(), |
| 765 permissions_, |
761 chrome_render_message_filter_->off_the_record(), | 766 chrome_render_message_filter_->off_the_record(), |
762 SerializedHandle(SerializedHandle::CHANNEL_HANDLE, | 767 SerializedHandle(SerializedHandle::CHANNEL_HANDLE, |
763 IPC::InvalidPlatformFileForTransit()))); | 768 IPC::InvalidPlatformFileForTransit()))); |
764 } else if (reply_msg_) { | 769 } else if (reply_msg_) { |
765 // Otherwise, this must be a renderer channel. | 770 // Otherwise, this must be a renderer channel. |
766 ReplyToRenderer(channel_handle); | 771 ReplyToRenderer(channel_handle); |
767 } else { | 772 } else { |
768 // Attempt to open more than 1 renderer channel is not supported. | 773 // Attempt to open more than 1 renderer channel is not supported. |
769 // Shut down the NaCl process. | 774 // Shut down the NaCl process. |
770 process_->GetHost()->ForceShutdown(); | 775 process_->GetHost()->ForceShutdown(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 } else { | 885 } else { |
881 NaClStartDebugExceptionHandlerThread( | 886 NaClStartDebugExceptionHandlerThread( |
882 process_handle.Take(), info, | 887 process_handle.Take(), info, |
883 base::MessageLoopProxy::current(), | 888 base::MessageLoopProxy::current(), |
884 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 889 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
885 weak_factory_.GetWeakPtr())); | 890 weak_factory_.GetWeakPtr())); |
886 return true; | 891 return true; |
887 } | 892 } |
888 } | 893 } |
889 #endif | 894 #endif |
OLD | NEW |