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