OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/plugin_process_host.h" | 5 #include "content/browser/plugin_process_host.h" |
6 | 6 |
7 #if defined(OS_WIN) && !defined(USE_AURA) | 7 #if defined(OS_WIN) && !defined(USE_AURA) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <utility> // for pair<> | 10 #include <utility> // for pair<> |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } else { | 157 } else { |
158 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 158 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
159 base::Bind(base::mac::SetCursorVisibility, true)); | 159 base::Bind(base::mac::SetCursorVisibility, true)); |
160 } | 160 } |
161 } | 161 } |
162 #endif | 162 #endif |
163 // Cancel all pending and sent requests. | 163 // Cancel all pending and sent requests. |
164 CancelRequests(); | 164 CancelRequests(); |
165 } | 165 } |
166 | 166 |
167 bool PluginProcessHost::Init(const webkit::WebPluginInfo& info, | 167 bool PluginProcessHost::Init(const webkit::WebPluginInfo& info) { |
168 const std::string& locale) { | |
169 info_ = info; | 168 info_ = info; |
170 set_name(info_.name); | 169 set_name(info_.name); |
171 | 170 |
172 std::string channel_id = child_process_host()->CreateChannel(); | 171 std::string channel_id = child_process_host()->CreateChannel(); |
173 if (channel_id.empty()) | 172 if (channel_id.empty()) |
174 return false; | 173 return false; |
175 | 174 |
176 // Build command line for plugin. When we have a plugin launcher, we can't | 175 // Build command line for plugin. When we have a plugin launcher, we can't |
177 // allow "self" on linux and we need the real file path. | 176 // allow "self" on linux and we need the real file path. |
178 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 177 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 switches::kV, | 223 switches::kV, |
225 }; | 224 }; |
226 | 225 |
227 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, | 226 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, |
228 arraysize(kSwitchNames)); | 227 arraysize(kSwitchNames)); |
229 | 228 |
230 // If specified, prepend a launcher program to the command line. | 229 // If specified, prepend a launcher program to the command line. |
231 if (!plugin_launcher.empty()) | 230 if (!plugin_launcher.empty()) |
232 cmd_line->PrependWrapper(plugin_launcher); | 231 cmd_line->PrependWrapper(plugin_launcher); |
233 | 232 |
| 233 std::string locale = |
| 234 content::GetContentClient()->browser()->GetApplicationLocale(); |
234 if (!locale.empty()) { | 235 if (!locale.empty()) { |
235 // Pass on the locale so the null plugin will use the right language in the | 236 // Pass on the locale so the null plugin will use the right language in the |
236 // prompt to install the desired plugin. | 237 // prompt to install the desired plugin. |
237 cmd_line->AppendSwitchASCII(switches::kLang, locale); | 238 cmd_line->AppendSwitchASCII(switches::kLang, locale); |
238 } | 239 } |
239 | 240 |
240 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 241 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
241 | 242 |
242 #if defined(OS_POSIX) | 243 #if defined(OS_POSIX) |
243 base::environment_vector env; | 244 base::environment_vector env; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 } | 424 } |
424 | 425 |
425 void PluginProcessHost::OnChannelCreated( | 426 void PluginProcessHost::OnChannelCreated( |
426 const IPC::ChannelHandle& channel_handle) { | 427 const IPC::ChannelHandle& channel_handle) { |
427 Client* client = sent_requests_.front(); | 428 Client* client = sent_requests_.front(); |
428 | 429 |
429 if (client) | 430 if (client) |
430 client->OnChannelOpened(channel_handle); | 431 client->OnChannelOpened(channel_handle); |
431 sent_requests_.pop_front(); | 432 sent_requests_.pop_front(); |
432 } | 433 } |
OLD | NEW |