Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: chrome/plugin/plugin_main.cc

Issue 6551002: Preload IME for the flash sandbox plugin... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Before we lock down the flash sandbox, we need to activate
72 // the IME machinery. After lock down it seems it is unable
73 // to start. Note that we leak the IME context on purpose.
74 int PreloadIMEForFlash() {
75 HIMC imc = ::ImmCreateContext();
76 if (!imc)
77 return 0;
78 if (::ImmGetOpenStatus(imc))
79 return 1;
80 return 2;
81 }
82
71 #endif 83 #endif
72 84
73 // main() routine for running as the plugin process. 85 // main() routine for running as the plugin process.
74 int PluginMain(const MainFunctionParams& parameters) { 86 int PluginMain(const MainFunctionParams& parameters) {
75 #if defined(USE_LINUX_BREAKPAD) 87 #if defined(USE_LINUX_BREAKPAD)
76 // Needs to be called after we have chrome::DIR_USER_DATA. 88 // Needs to be called after we have chrome::DIR_USER_DATA.
77 InitCrashReporter(); 89 InitCrashReporter();
78 #endif 90 #endif
79 91
80 // The main thread of the plugin services UI. 92 // The main thread of the plugin services UI.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 { 138 {
127 ChildProcess plugin_process; 139 ChildProcess plugin_process;
128 plugin_process.set_main_thread(new PluginThread()); 140 plugin_process.set_main_thread(new PluginThread());
129 #if defined(OS_WIN) 141 #if defined(OS_WIN)
130 if (!no_sandbox && target_services) { 142 if (!no_sandbox && target_services) {
131 // We are sandboxing the plugin. If it is a generic plug-in, we lock down 143 // We are sandboxing the plugin. If it is a generic plug-in, we lock down
132 // the sandbox right away, but if it is the built-in flash we let flash 144 // the sandbox right away, but if it is the built-in flash we let flash
133 // start elevated and it will call DelayedLowerToken(0) when it's ready. 145 // start elevated and it will call DelayedLowerToken(0) when it's ready.
134 if (IsPluginBuiltInFlash(parsed_command_line)) { 146 if (IsPluginBuiltInFlash(parsed_command_line)) {
135 DVLOG(1) << "Sandboxing flash"; 147 DVLOG(1) << "Sandboxing flash";
148 if (!PreloadIMEForFlash())
149 DVLOG(1) << "IME preload failed";
136 DelayedLowerToken(target_services); 150 DelayedLowerToken(target_services);
137 } else { 151 } else {
138 target_services->LowerToken(); 152 target_services->LowerToken();
139 } 153 }
140 } 154 }
141 if (sandbox_test_module) { 155 if (sandbox_test_module) {
142 RunRendererTests run_security_tests = 156 RunRendererTests run_security_tests =
143 reinterpret_cast<RunPluginTests>(GetProcAddress(sandbox_test_module, 157 reinterpret_cast<RunPluginTests>(GetProcAddress(sandbox_test_module,
144 kPluginTestCall)); 158 kPluginTestCall));
145 DCHECK(run_security_tests); 159 DCHECK(run_security_tests);
(...skipping 18 matching lines...) Expand all
164 178
165 MessageLoop::current()->Run(); 179 MessageLoop::current()->Run();
166 } 180 }
167 181
168 #if defined(OS_WIN) 182 #if defined(OS_WIN)
169 CoUninitialize(); 183 CoUninitialize();
170 #endif 184 #endif
171 185
172 return 0; 186 return 0;
173 } 187 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698