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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <objbase.h> | 8 #include <objbase.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif | 10 #endif |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/hi_res_timer_manager.h" | 14 #include "base/hi_res_timer_manager.h" |
15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "base/system_monitor/system_monitor.h" | 17 #include "base/system_monitor/system_monitor.h" |
18 #include "base/threading/platform_thread.h" | 18 #include "base/threading/platform_thread.h" |
19 #include "content/common/child_process.h" | 19 #include "content/common/child_process.h" |
20 #include "content/plugin/plugin_thread.h" | 20 #include "content/plugin/plugin_thread.h" |
21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
22 #include "content/public/common/main_function_params.h" | 22 #include "content/public/common/main_function_params.h" |
| 23 #include "content/public/common/sandbox_init.h" |
23 | 24 |
24 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
25 #include "content/public/common/injection_test_win.h" | 26 #include "content/public/common/injection_test_win.h" |
26 #include "sandbox/win/src/sandbox.h" | 27 #include "sandbox/win/src/sandbox.h" |
27 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 28 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
28 #include "base/global_descriptors_posix.h" | 29 #include "base/global_descriptors_posix.h" |
29 #include "ipc/ipc_descriptors.h" | 30 #include "ipc/ipc_descriptors.h" |
30 #endif | 31 #endif |
31 | 32 |
32 #if defined(OS_MACOSX) | 33 #if defined(OS_MACOSX) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 sandbox_test_module = LoadLibrary(test_plugin_name.c_str()); | 169 sandbox_test_module = LoadLibrary(test_plugin_name.c_str()); |
169 DCHECK(sandbox_test_module); | 170 DCHECK(sandbox_test_module); |
170 } | 171 } |
171 } | 172 } |
172 #endif | 173 #endif |
173 if (parsed_command_line.HasSwitch(switches::kPluginStartupDialog)) { | 174 if (parsed_command_line.HasSwitch(switches::kPluginStartupDialog)) { |
174 ChildProcess::WaitForDebugger("Plugin"); | 175 ChildProcess::WaitForDebugger("Plugin"); |
175 } | 176 } |
176 | 177 |
177 { | 178 { |
| 179 #if defined(OS_LINUX) |
| 180 // Go through Linux sandbox initialization before starting any thread. |
| 181 content::InitializeSandbox(); |
| 182 #endif |
178 ChildProcess plugin_process; | 183 ChildProcess plugin_process; |
179 plugin_process.set_main_thread(new PluginThread()); | 184 plugin_process.set_main_thread(new PluginThread()); |
180 #if defined(OS_WIN) | 185 #if defined(OS_WIN) |
181 if (!no_sandbox && target_services) { | 186 if (!no_sandbox && target_services) { |
182 // We are sandboxing the plugin. If it is a generic plug-in, we lock down | 187 // We are sandboxing the plugin. If it is a generic plug-in, we lock down |
183 // the sandbox right away, but if it is the built-in flash we let flash | 188 // the sandbox right away, but if it is the built-in flash we let flash |
184 // start elevated and it will call DelayedLowerToken(0) when it's ready. | 189 // start elevated and it will call DelayedLowerToken(0) when it's ready. |
185 if (IsPluginBuiltInFlash(parsed_command_line)) { | 190 if (IsPluginBuiltInFlash(parsed_command_line)) { |
186 DVLOG(1) << "Sandboxing flash"; | 191 DVLOG(1) << "Sandboxing flash"; |
187 | 192 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 MessageLoop::current()->Run(); | 226 MessageLoop::current()->Run(); |
222 } | 227 } |
223 | 228 |
224 #if defined(OS_WIN) | 229 #if defined(OS_WIN) |
225 DestroyIMEForFlash(); | 230 DestroyIMEForFlash(); |
226 CoUninitialize(); | 231 CoUninitialize(); |
227 #endif | 232 #endif |
228 | 233 |
229 return 0; | 234 return 0; |
230 } | 235 } |
OLD | NEW |