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 "components/nacl/browser/nacl_process_host.h" | 5 #include "components/nacl/browser/nacl_process_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 handles_for_sel_ldr->push_back(channel); | 189 handles_for_sel_ldr->push_back(channel); |
190 #endif | 190 #endif |
191 return true; | 191 return true; |
192 } | 192 } |
193 | 193 |
194 ppapi::PpapiPermissions GetNaClPermissions(uint32 permission_bits) { | 194 ppapi::PpapiPermissions GetNaClPermissions(uint32 permission_bits) { |
195 // Only allow NaCl plugins to request certain permissions. We don't want | 195 // Only allow NaCl plugins to request certain permissions. We don't want |
196 // a compromised renderer to be able to start a nacl plugin with e.g. Flash | 196 // a compromised renderer to be able to start a nacl plugin with e.g. Flash |
197 // permissions which may expand the surface area of the sandbox. | 197 // permissions which may expand the surface area of the sandbox. |
198 uint32 masked_bits = permission_bits & ppapi::PERMISSION_DEV; | 198 uint32 masked_bits = permission_bits & ppapi::PERMISSION_DEV; |
| 199 if (content::PluginService::GetInstance()->PpapiDevChannelSupported()) |
| 200 masked_bits |= ppapi::PERMISSION_DEV_CHANNEL; |
199 return ppapi::PpapiPermissions::GetForCommandLine(masked_bits); | 201 return ppapi::PpapiPermissions::GetForCommandLine(masked_bits); |
200 } | 202 } |
201 | 203 |
202 } // namespace | 204 } // namespace |
203 | 205 |
204 namespace nacl { | 206 namespace nacl { |
205 | 207 |
206 struct NaClProcessHost::NaClInternal { | 208 struct NaClProcessHost::NaClInternal { |
207 NaClHandle socket_for_renderer; | 209 NaClHandle socket_for_renderer; |
208 NaClHandle socket_for_sel_ldr; | 210 NaClHandle socket_for_sel_ldr; |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 permissions_, | 798 permissions_, |
797 process_->GetData().handle, | 799 process_->GetData().handle, |
798 ipc_proxy_channel_.get(), | 800 ipc_proxy_channel_.get(), |
799 nacl_host_message_filter_->render_process_id(), | 801 nacl_host_message_filter_->render_process_id(), |
800 render_view_id_, | 802 render_view_id_, |
801 profile_directory_)); | 803 profile_directory_)); |
802 | 804 |
803 ppapi::PpapiNaClChannelArgs args; | 805 ppapi::PpapiNaClChannelArgs args; |
804 args.off_the_record = nacl_host_message_filter_->off_the_record(); | 806 args.off_the_record = nacl_host_message_filter_->off_the_record(); |
805 args.permissions = permissions_; | 807 args.permissions = permissions_; |
806 args.supports_dev_channel = | |
807 content::PluginService::GetInstance()->PpapiDevChannelSupported(); | |
808 CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 808 CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
809 DCHECK(cmdline); | 809 DCHECK(cmdline); |
810 std::string flag_whitelist[] = {switches::kV, switches::kVModule}; | 810 std::string flag_whitelist[] = {switches::kV, switches::kVModule}; |
811 for (size_t i = 0; i < arraysize(flag_whitelist); ++i) { | 811 for (size_t i = 0; i < arraysize(flag_whitelist); ++i) { |
812 std::string value = cmdline->GetSwitchValueASCII(flag_whitelist[i]); | 812 std::string value = cmdline->GetSwitchValueASCII(flag_whitelist[i]); |
813 if (!value.empty()) { | 813 if (!value.empty()) { |
814 args.switch_names.push_back(flag_whitelist[i]); | 814 args.switch_names.push_back(flag_whitelist[i]); |
815 args.switch_values.push_back(value); | 815 args.switch_values.push_back(value); |
816 } | 816 } |
817 } | 817 } |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 process_handle.Take(), info, | 1018 process_handle.Take(), info, |
1019 base::MessageLoopProxy::current(), | 1019 base::MessageLoopProxy::current(), |
1020 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1020 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
1021 weak_factory_.GetWeakPtr())); | 1021 weak_factory_.GetWeakPtr())); |
1022 return true; | 1022 return true; |
1023 } | 1023 } |
1024 } | 1024 } |
1025 #endif | 1025 #endif |
1026 | 1026 |
1027 } // namespace nacl | 1027 } // namespace nacl |
OLD | NEW |