OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/plugin_process_host.h" | 7 #include "chrome/browser/plugin_process_host.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 window_index++) { | 331 window_index++) { |
332 PostMessage(*window_index, WM_CLOSE, 0, 0); | 332 PostMessage(*window_index, WM_CLOSE, 0, 0); |
333 } | 333 } |
334 #elif defined(OS_MACOSX) | 334 #elif defined(OS_MACOSX) |
335 // If the plugin process crashed but had fullscreen windows open at the time, | 335 // If the plugin process crashed but had fullscreen windows open at the time, |
336 // make sure that the menu bar is visible. | 336 // make sure that the menu bar is visible. |
337 std::set<uint32>::iterator window_index; | 337 std::set<uint32>::iterator window_index; |
338 for (window_index = plugin_fullscreen_windows_set_.begin(); | 338 for (window_index = plugin_fullscreen_windows_set_.begin(); |
339 window_index != plugin_fullscreen_windows_set_.end(); | 339 window_index != plugin_fullscreen_windows_set_.end(); |
340 window_index++) { | 340 window_index++) { |
341 if (MessageLoop::current() == | 341 if (ChromeThread::CurrentlyOn(ChromeThread::UI)) { |
342 ChromeThread::GetMessageLoop(ChromeThread::UI)) { | |
343 mac_util::ReleaseFullScreen(); | 342 mac_util::ReleaseFullScreen(); |
344 } else { | 343 } else { |
345 ChromeThread::GetMessageLoop(ChromeThread::UI)->PostTask(FROM_HERE, | 344 ChromeThread::PostTask( |
| 345 ChromeThread::UI, FROM_HERE, |
346 NewRunnableFunction(mac_util::ReleaseFullScreen)); | 346 NewRunnableFunction(mac_util::ReleaseFullScreen)); |
347 } | 347 } |
348 } | 348 } |
349 #endif | 349 #endif |
350 } | 350 } |
351 | 351 |
352 bool PluginProcessHost::Init(const WebPluginInfo& info, | 352 bool PluginProcessHost::Init(const WebPluginInfo& info, |
353 const std::wstring& locale) { | 353 const std::wstring& locale) { |
354 info_ = info; | 354 info_ = info; |
355 set_name(info_.name); | 355 set_name(info_.name); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 return; | 663 return; |
664 } | 664 } |
665 | 665 |
666 // TODO(iyengar) Add the plumbing to retrieve the default | 666 // TODO(iyengar) Add the plumbing to retrieve the default |
667 // plugin finder URL. | 667 // plugin finder URL. |
668 *plugin_finder_url = kDefaultPluginFinderURL; | 668 *plugin_finder_url = kDefaultPluginFinderURL; |
669 } | 669 } |
670 | 670 |
671 void PluginProcessHost::OnPluginMessage( | 671 void PluginProcessHost::OnPluginMessage( |
672 const std::vector<uint8>& data) { | 672 const std::vector<uint8>& data) { |
673 DCHECK(MessageLoop::current() == | 673 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
674 ChromeThread::GetMessageLoop(ChromeThread::IO)); | |
675 | 674 |
676 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 675 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
677 if (chrome_plugin) { | 676 if (chrome_plugin) { |
678 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 677 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
679 uint32 data_len = static_cast<uint32>(data.size()); | 678 uint32 data_len = static_cast<uint32>(data.size()); |
680 chrome_plugin->functions().on_message(data_ptr, data_len); | 679 chrome_plugin->functions().on_message(data_ptr, data_len); |
681 } | 680 } |
682 } | 681 } |
OLD | NEW |