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 "chrome/browser/chrome_plugin_host.h" | 5 #include "chrome/browser/chrome_plugin_host.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 return CPERR_FAILURE; | 695 return CPERR_FAILURE; |
696 } | 696 } |
697 | 697 |
698 CPBool STDCALL CPB_IsPluginProcessRunning(CPID id) { | 698 CPBool STDCALL CPB_IsPluginProcessRunning(CPID id) { |
699 CHECK(ChromePluginLib::IsPluginThread()); | 699 CHECK(ChromePluginLib::IsPluginThread()); |
700 ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); | 700 ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); |
701 CHECK(plugin); | 701 CHECK(plugin); |
702 PluginService* service = PluginService::GetInstance(); | 702 PluginService* service = PluginService::GetInstance(); |
703 if (!service) | 703 if (!service) |
704 return false; | 704 return false; |
705 PluginProcessHost *host = service->FindPluginProcess(plugin->filename()); | 705 PluginProcessHost *host = service->FindNpapiPluginProcess(plugin->filename()); |
706 return host ? true : false; | 706 return host ? true : false; |
707 } | 707 } |
708 | 708 |
709 CPProcessType STDCALL CPB_GetProcessType(CPID id) { | 709 CPProcessType STDCALL CPB_GetProcessType(CPID id) { |
710 CHECK(ChromePluginLib::IsPluginThread()); | 710 CHECK(ChromePluginLib::IsPluginThread()); |
711 return CP_PROCESS_BROWSER; | 711 return CP_PROCESS_BROWSER; |
712 } | 712 } |
713 | 713 |
714 CPError STDCALL CPB_SendMessage(CPID id, const void *data, uint32 data_len) { | 714 CPError STDCALL CPB_SendMessage(CPID id, const void *data, uint32 data_len) { |
715 CHECK(ChromePluginLib::IsPluginThread()); | 715 CHECK(ChromePluginLib::IsPluginThread()); |
716 ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); | 716 ChromePluginLib* plugin = ChromePluginLib::FromCPID(id); |
717 CHECK(plugin); | 717 CHECK(plugin); |
718 | 718 |
719 PluginService* service = PluginService::GetInstance(); | 719 PluginService* service = PluginService::GetInstance(); |
720 if (!service) | 720 if (!service) |
721 return CPERR_FAILURE; | 721 return CPERR_FAILURE; |
722 PluginProcessHost *host = | 722 PluginProcessHost *host = |
723 service->FindOrStartPluginProcess(plugin->filename()); | 723 service->FindOrStartNpapiPluginProcess(plugin->filename()); |
724 if (!host) | 724 if (!host) |
725 return CPERR_FAILURE; | 725 return CPERR_FAILURE; |
726 | 726 |
727 const unsigned char* data_ptr = static_cast<const unsigned char*>(data); | 727 const unsigned char* data_ptr = static_cast<const unsigned char*>(data); |
728 std::vector<uint8> v(data_ptr, data_ptr + data_len); | 728 std::vector<uint8> v(data_ptr, data_ptr + data_len); |
729 #if defined(OS_WIN) | 729 #if defined(OS_WIN) |
730 if (!host->Send(new PluginProcessMsg_PluginMessage(v))) | 730 if (!host->Send(new PluginProcessMsg_PluginMessage(v))) |
731 return CPERR_FAILURE; | 731 return CPERR_FAILURE; |
732 #else | 732 #else |
733 // TODO(port): Implement PluginProcessMsg. | 733 // TODO(port): Implement PluginProcessMsg. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 CPBrowsingContext context) { | 833 CPBrowsingContext context) { |
834 // Sadly if we try and pass context through, we seem to break cl's little | 834 // Sadly if we try and pass context through, we seem to break cl's little |
835 // brain trying to compile the Tuple3 ctor. This cast works. | 835 // brain trying to compile the Tuple3 ctor. This cast works. |
836 int32 context_as_int32 = static_cast<int32>(context); | 836 int32 context_as_int32 = static_cast<int32>(context); |
837 // Plugins can only be accessed on the IO thread. | 837 // Plugins can only be accessed on the IO thread. |
838 BrowserThread::PostTask( | 838 BrowserThread::PostTask( |
839 BrowserThread::IO, FROM_HERE, | 839 BrowserThread::IO, FROM_HERE, |
840 NewRunnableFunction(PluginCommandHandler::HandleCommand, | 840 NewRunnableFunction(PluginCommandHandler::HandleCommand, |
841 command, data, context_as_int32)); | 841 command, data, context_as_int32)); |
842 } | 842 } |
OLD | NEW |