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> | |
9 #include <windows.h> | 8 #include <windows.h> |
10 #endif | 9 #endif |
11 | 10 |
12 #include "base/bind.h" | 11 #include "base/bind.h" |
13 #include "base/command_line.h" | 12 #include "base/command_line.h" |
14 #include "base/hi_res_timer_manager.h" | 13 #include "base/hi_res_timer_manager.h" |
15 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
16 #include "base/string_util.h" | 15 #include "base/string_util.h" |
17 #include "base/system_monitor/system_monitor.h" | 16 #include "base/system_monitor/system_monitor.h" |
18 #include "base/threading/platform_thread.h" | 17 #include "base/threading/platform_thread.h" |
19 #include "content/common/child_process.h" | 18 #include "content/common/child_process.h" |
20 #include "content/plugin/plugin_thread.h" | 19 #include "content/plugin/plugin_thread.h" |
21 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
22 #include "content/public/common/main_function_params.h" | 21 #include "content/public/common/main_function_params.h" |
23 | 22 |
24 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 24 #include "base/win/scoped_com_initializer.h" |
25 #include "content/public/common/injection_test_win.h" | 25 #include "content/public/common/injection_test_win.h" |
26 #include "sandbox/win/src/sandbox.h" | 26 #include "sandbox/win/src/sandbox.h" |
27 #elif defined(OS_POSIX) && !defined(OS_MACOSX) | 27 #elif defined(OS_POSIX) && !defined(OS_MACOSX) |
28 #include "base/global_descriptors_posix.h" | 28 #include "base/global_descriptors_posix.h" |
29 #include "ipc/ipc_descriptors.h" | 29 #include "ipc/ipc_descriptors.h" |
30 #endif | 30 #endif |
31 | 31 |
32 #if defined(OS_MACOSX) | 32 #if defined(OS_MACOSX) |
33 // Removes our Carbon library interposing from the environment so that it | 33 // Removes our Carbon library interposing from the environment so that it |
34 // doesn't carry into any processes that plugins might start. | 34 // doesn't carry into any processes that plugins might start. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 #if defined(OS_LINUX) | 111 #if defined(OS_LINUX) |
112 | 112 |
113 #if defined(ARCH_CPU_64_BITS) | 113 #if defined(ARCH_CPU_64_BITS) |
114 WorkaroundFlashLAHF(); | 114 WorkaroundFlashLAHF(); |
115 #endif | 115 #endif |
116 | 116 |
117 #elif defined(OS_WIN) | 117 #elif defined(OS_WIN) |
118 sandbox::TargetServices* target_services = | 118 sandbox::TargetServices* target_services = |
119 parameters.sandbox_info->target_services; | 119 parameters.sandbox_info->target_services; |
120 | 120 |
121 CoInitialize(NULL); | 121 base::win::ScopedCOMInitializer com_initializer; |
| 122 |
122 DVLOG(1) << "Started plugin with " | 123 DVLOG(1) << "Started plugin with " |
123 << parsed_command_line.GetCommandLineString(); | 124 << parsed_command_line.GetCommandLineString(); |
124 | 125 |
125 HMODULE sandbox_test_module = NULL; | 126 HMODULE sandbox_test_module = NULL; |
126 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); | 127 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); |
127 | 128 |
128 if (target_services && !no_sandbox) { | 129 if (target_services && !no_sandbox) { |
129 // The command line might specify a test plugin to load. | 130 // The command line might specify a test plugin to load. |
130 if (parsed_command_line.HasSwitch(switches::kTestSandbox)) { | 131 if (parsed_command_line.HasSwitch(switches::kTestSandbox)) { |
131 std::wstring test_plugin_name = | 132 std::wstring test_plugin_name = |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 177 |
177 FreeLibrary(sandbox_test_module); | 178 FreeLibrary(sandbox_test_module); |
178 } | 179 } |
179 #endif | 180 #endif |
180 | 181 |
181 MessageLoop::current()->Run(); | 182 MessageLoop::current()->Run(); |
182 } | 183 } |
183 | 184 |
184 #if defined(OS_WIN) | 185 #if defined(OS_WIN) |
185 DestroyIMEForFlash(); | 186 DestroyIMEForFlash(); |
186 CoUninitialize(); | |
187 #endif | 187 #endif |
188 | 188 |
189 return 0; | 189 return 0; |
190 } | 190 } |
OLD | NEW |