OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 s_ts->LowerToken(); | 61 s_ts->LowerToken(); |
62 return 1; | 62 return 1; |
63 }; | 63 }; |
64 | 64 |
65 // Returns true if the plugin to be loaded is the internal flash. | 65 // Returns true if the plugin to be loaded is the internal flash. |
66 bool IsPluginBuiltInFlash(const CommandLine& cmd_line) { | 66 bool IsPluginBuiltInFlash(const CommandLine& cmd_line) { |
67 FilePath path = cmd_line.GetSwitchValuePath(switches::kPluginPath); | 67 FilePath path = cmd_line.GetSwitchValuePath(switches::kPluginPath); |
68 return (path.BaseName() == FilePath(L"gcswf32.dll")); | 68 return (path.BaseName() == FilePath(L"gcswf32.dll")); |
69 } | 69 } |
70 | 70 |
71 // Disables Input method editor services for the whole process. | |
72 void DisableIME() { | |
73 if (0 == ::GetSystemMetrics(SM_IMMENABLED)) | |
74 return; | |
75 ::ImmDisableIME(-1); | |
76 } | |
77 | |
78 #endif | 71 #endif |
79 | 72 |
80 // main() routine for running as the plugin process. | 73 // main() routine for running as the plugin process. |
81 int PluginMain(const MainFunctionParams& parameters) { | 74 int PluginMain(const MainFunctionParams& parameters) { |
82 #if defined(USE_LINUX_BREAKPAD) | 75 #if defined(USE_LINUX_BREAKPAD) |
83 // Needs to be called after we have chrome::DIR_USER_DATA. | 76 // Needs to be called after we have chrome::DIR_USER_DATA. |
84 InitCrashReporter(); | 77 InitCrashReporter(); |
85 #endif | 78 #endif |
86 | 79 |
87 // The main thread of the plugin services UI. | 80 // The main thread of the plugin services UI. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 { | 126 { |
134 ChildProcess plugin_process; | 127 ChildProcess plugin_process; |
135 plugin_process.set_main_thread(new PluginThread()); | 128 plugin_process.set_main_thread(new PluginThread()); |
136 #if defined(OS_WIN) | 129 #if defined(OS_WIN) |
137 if (!no_sandbox && target_services) { | 130 if (!no_sandbox && target_services) { |
138 // We are sandboxing the plugin. If it is a generic plug-in, we lock down | 131 // We are sandboxing the plugin. If it is a generic plug-in, we lock down |
139 // the sandbox right away, but if it is the built-in flash we let flash | 132 // the sandbox right away, but if it is the built-in flash we let flash |
140 // start elevated and it will call DelayedLowerToken(0) when it's ready. | 133 // start elevated and it will call DelayedLowerToken(0) when it's ready. |
141 if (IsPluginBuiltInFlash(parsed_command_line)) { | 134 if (IsPluginBuiltInFlash(parsed_command_line)) { |
142 DVLOG(1) << "Sandboxing flash"; | 135 DVLOG(1) << "Sandboxing flash"; |
143 DisableIME(); | |
144 DelayedLowerToken(target_services); | 136 DelayedLowerToken(target_services); |
145 } else { | 137 } else { |
146 target_services->LowerToken(); | 138 target_services->LowerToken(); |
147 } | 139 } |
148 } | 140 } |
149 if (sandbox_test_module) { | 141 if (sandbox_test_module) { |
150 RunRendererTests run_security_tests = | 142 RunRendererTests run_security_tests = |
151 reinterpret_cast<RunPluginTests>(GetProcAddress(sandbox_test_module, | 143 reinterpret_cast<RunPluginTests>(GetProcAddress(sandbox_test_module, |
152 kPluginTestCall)); | 144 kPluginTestCall)); |
153 DCHECK(run_security_tests); | 145 DCHECK(run_security_tests); |
(...skipping 16 matching lines...) Expand all Loading... |
170 | 162 |
171 MessageLoop::current()->Run(); | 163 MessageLoop::current()->Run(); |
172 } | 164 } |
173 | 165 |
174 #if defined(OS_WIN) | 166 #if defined(OS_WIN) |
175 CoUninitialize(); | 167 CoUninitialize(); |
176 #endif | 168 #endif |
177 | 169 |
178 return 0; | 170 return 0; |
179 } | 171 } |
OLD | NEW |