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 "chrome/browser/plugin_process_host.h" | 5 #include "chrome/browser/plugin_process_host.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 FilePath::StringType gears_path_lc = StringToLowerASCII(gears_path.value()); | 291 FilePath::StringType gears_path_lc = StringToLowerASCII(gears_path.value()); |
292 FilePath::StringType plugin_path_lc = | 292 FilePath::StringType plugin_path_lc = |
293 StringToLowerASCII(info_.path.value()); | 293 StringToLowerASCII(info_.path.value()); |
294 if (plugin_path_lc == gears_path_lc) { | 294 if (plugin_path_lc == gears_path_lc) { |
295 // Give Gears plugins "background" priority. See http://b/1280317. | 295 // Give Gears plugins "background" priority. See http://b/1280317. |
296 SetProcessBackgrounded(); | 296 SetProcessBackgrounded(); |
297 } | 297 } |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
301 void PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { | 301 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| 302 bool handled = true; |
302 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) | 303 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) |
303 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) | 304 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) |
304 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl, | 305 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl, |
305 OnGetPluginFinderUrl) | 306 OnGetPluginFinderUrl) |
306 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage) | 307 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage) |
307 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies) | 308 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies) |
308 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_AccessFiles, OnAccessFiles) | 309 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_AccessFiles, OnAccessFiles) |
309 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy, | 310 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy, |
310 OnResolveProxy) | 311 OnResolveProxy) |
311 #if defined(OS_WIN) | 312 #if defined(OS_WIN) |
312 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, | 313 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, |
313 OnPluginWindowDestroyed) | 314 OnPluginWindowDestroyed) |
314 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl) | 315 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl) |
315 #endif | 316 #endif |
316 #if defined(TOOLKIT_USES_GTK) | 317 #if defined(TOOLKIT_USES_GTK) |
317 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, | 318 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, |
318 OnMapNativeViewId) | 319 OnMapNativeViewId) |
319 #endif | 320 #endif |
320 #if defined(OS_MACOSX) | 321 #if defined(OS_MACOSX) |
321 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSelectWindow, | 322 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSelectWindow, |
322 OnPluginSelectWindow) | 323 OnPluginSelectWindow) |
323 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginShowWindow, | 324 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginShowWindow, |
324 OnPluginShowWindow) | 325 OnPluginShowWindow) |
325 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginHideWindow, | 326 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginHideWindow, |
326 OnPluginHideWindow) | 327 OnPluginHideWindow) |
327 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSetCursorVisibility, | 328 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSetCursorVisibility, |
328 OnPluginSetCursorVisibility) | 329 OnPluginSetCursorVisibility) |
329 #endif | 330 #endif |
330 IPC_MESSAGE_UNHANDLED_ERROR() | 331 IPC_MESSAGE_UNHANDLED(handled = false) |
331 IPC_END_MESSAGE_MAP() | 332 IPC_END_MESSAGE_MAP() |
| 333 |
| 334 DCHECK(handled); |
| 335 return handled; |
332 } | 336 } |
333 | 337 |
334 void PluginProcessHost::OnChannelConnected(int32 peer_pid) { | 338 void PluginProcessHost::OnChannelConnected(int32 peer_pid) { |
335 for (size_t i = 0; i < pending_requests_.size(); ++i) { | 339 for (size_t i = 0; i < pending_requests_.size(); ++i) { |
336 RequestPluginChannel(pending_requests_[i]); | 340 RequestPluginChannel(pending_requests_[i]); |
337 } | 341 } |
338 | 342 |
339 pending_requests_.clear(); | 343 pending_requests_.clear(); |
340 } | 344 } |
341 | 345 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 const std::vector<uint8>& data) { | 467 const std::vector<uint8>& data) { |
464 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 468 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
465 | 469 |
466 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 470 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
467 if (chrome_plugin) { | 471 if (chrome_plugin) { |
468 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 472 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
469 uint32 data_len = static_cast<uint32>(data.size()); | 473 uint32 data_len = static_cast<uint32>(data.size()); |
470 chrome_plugin->functions().on_message(data_ptr, data_len); | 474 chrome_plugin->functions().on_message(data_ptr, data_len); |
471 } | 475 } |
472 } | 476 } |
OLD | NEW |