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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 CPError STDCALL CPB_SendSyncMessage(CPID id, const void *data, uint32 data_len, | 728 CPError STDCALL CPB_SendSyncMessage(CPID id, const void *data, uint32 data_len, |
729 void **retval, uint32 *retval_len) { | 729 void **retval, uint32 *retval_len) { |
730 NOTREACHED() << "Sync messages should not be sent from the browser process."; | 730 NOTREACHED() << "Sync messages should not be sent from the browser process."; |
731 | 731 |
732 return CPERR_FAILURE; | 732 return CPERR_FAILURE; |
733 } | 733 } |
734 | 734 |
735 CPError STDCALL CPB_PluginThreadAsyncCall(CPID id, | 735 CPError STDCALL CPB_PluginThreadAsyncCall(CPID id, |
736 void (*func)(void *), | 736 void (*func)(void *), |
737 void *user_data) { | 737 void *user_data) { |
738 MessageLoop *message_loop = ChromeThread::GetMessageLoop(ChromeThread::IO); | 738 bool posted = ChromeThread::PostTask( |
739 if (!message_loop) { | 739 ChromeThread::IO, FROM_HERE, |
740 return CPERR_FAILURE; | 740 NewRunnableFunction(func, user_data)); |
741 } | 741 return posted ? CPERR_SUCCESS : CPERR_FAILURE; |
742 message_loop->PostTask(FROM_HERE, NewRunnableFunction(func, user_data)); | |
743 | |
744 return CPERR_SUCCESS; | |
745 } | 742 } |
746 | 743 |
747 CPError STDCALL CPB_OpenFileDialog(CPID id, | 744 CPError STDCALL CPB_OpenFileDialog(CPID id, |
748 CPBrowsingContext context, | 745 CPBrowsingContext context, |
749 bool multiple_files, | 746 bool multiple_files, |
750 const char *title, | 747 const char *title, |
751 const char *filter, | 748 const char *filter, |
752 void *user_data) { | 749 void *user_data) { |
753 NOTREACHED() << | 750 NOTREACHED() << |
754 "Open file dialog should only be called from the renderer process."; | 751 "Open file dialog should only be called from the renderer process."; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 void CPHandleCommand(int command, CPCommandInterface* data, | 814 void CPHandleCommand(int command, CPCommandInterface* data, |
818 CPBrowsingContext context) { | 815 CPBrowsingContext context) { |
819 // Sadly if we try and pass context through, we seem to break cl's little | 816 // Sadly if we try and pass context through, we seem to break cl's little |
820 // brain trying to compile the Tuple3 ctor. This cast works. | 817 // brain trying to compile the Tuple3 ctor. This cast works. |
821 int32 context_as_int32 = static_cast<int32>(context); | 818 int32 context_as_int32 = static_cast<int32>(context); |
822 // Plugins can only be accessed on the IO thread. | 819 // Plugins can only be accessed on the IO thread. |
823 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, | 820 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, |
824 NewRunnableFunction(PluginCommandHandler::HandleCommand, | 821 NewRunnableFunction(PluginCommandHandler::HandleCommand, |
825 command, data, context_as_int32)); | 822 command, data, context_as_int32)); |
826 } | 823 } |
OLD | NEW |