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 "chrome/browser/chrome_plugin_host.h" | 5 #include "chrome/browser/chrome_plugin_host.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 | 704 |
705 CPError STDCALL CPB_SendMessage(CPID id, const void *data, uint32 data_len) { | 705 CPError STDCALL CPB_SendMessage(CPID id, const void *data, uint32 data_len) { |
706 CHECK(ChromePluginLib::IsPluginThread()); | 706 CHECK(ChromePluginLib::IsPluginThread()); |
707 ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); | 707 ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); |
708 CHECK(plugin); | 708 CHECK(plugin); |
709 | 709 |
710 PluginService* service = PluginService::GetInstance(); | 710 PluginService* service = PluginService::GetInstance(); |
711 if (!service) | 711 if (!service) |
712 return CPERR_FAILURE; | 712 return CPERR_FAILURE; |
713 PluginProcessHost *host = | 713 PluginProcessHost *host = |
714 service->FindOrStartPluginProcess(plugin->filename(), std::string()); | 714 service->FindOrStartPluginProcess(plugin->filename()); |
715 if (!host) | 715 if (!host) |
716 return CPERR_FAILURE; | 716 return CPERR_FAILURE; |
717 | 717 |
718 const unsigned char* data_ptr = static_cast<const unsigned char*>(data); | 718 const unsigned char* data_ptr = static_cast<const unsigned char*>(data); |
719 std::vector<uint8> v(data_ptr, data_ptr + data_len); | 719 std::vector<uint8> v(data_ptr, data_ptr + data_len); |
720 #if defined(OS_WIN) | 720 #if defined(OS_WIN) |
721 if (!host->Send(new PluginProcessMsg_PluginMessage(v))) | 721 if (!host->Send(new PluginProcessMsg_PluginMessage(v))) |
722 return CPERR_FAILURE; | 722 return CPERR_FAILURE; |
723 #else | 723 #else |
724 // TODO(port): Implement PluginProcessMsg. | 724 // TODO(port): Implement PluginProcessMsg. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 void CPHandleCommand(int command, CPCommandInterface* data, | 820 void CPHandleCommand(int command, CPCommandInterface* data, |
821 CPBrowsingContext context) { | 821 CPBrowsingContext context) { |
822 // Sadly if we try and pass context through, we seem to break cl's little | 822 // Sadly if we try and pass context through, we seem to break cl's little |
823 // brain trying to compile the Tuple3 ctor. This cast works. | 823 // brain trying to compile the Tuple3 ctor. This cast works. |
824 int32 context_as_int32 = static_cast<int32>(context); | 824 int32 context_as_int32 = static_cast<int32>(context); |
825 // Plugins can only be accessed on the IO thread. | 825 // Plugins can only be accessed on the IO thread. |
826 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, | 826 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, |
827 NewRunnableFunction(PluginCommandHandler::HandleCommand, | 827 NewRunnableFunction(PluginCommandHandler::HandleCommand, |
828 command, data, context_as_int32)); | 828 command, data, context_as_int32)); |
829 } | 829 } |
OLD | NEW |