OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include <windows.h> | 7 #include <windows.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 new_cmd_line.AppendArguments(cmd_line, true); | 504 new_cmd_line.AppendArguments(cmd_line, true); |
505 cmd_line = new_cmd_line; | 505 cmd_line = new_cmd_line; |
506 } | 506 } |
507 | 507 |
508 if (!locale.empty()) { | 508 if (!locale.empty()) { |
509 // Pass on the locale so the null plugin will use the right language in the | 509 // Pass on the locale so the null plugin will use the right language in the |
510 // prompt to install the desired plugin. | 510 // prompt to install the desired plugin. |
511 cmd_line.AppendSwitchWithValue(switches::kLang, locale); | 511 cmd_line.AppendSwitchWithValue(switches::kLang, locale); |
512 } | 512 } |
513 | 513 |
| 514 // Gears requires the data dir to be available on startup. |
| 515 std::wstring data_dir = plugin_service_->GetChromePluginDataDir();; |
| 516 DCHECK(!data_dir.empty()); |
| 517 cmd_line.AppendSwitchWithValue(switches::kPluginDataDir, data_dir); |
| 518 |
514 cmd_line.AppendSwitchWithValue(switches::kProcessType, | 519 cmd_line.AppendSwitchWithValue(switches::kProcessType, |
515 switches::kPluginProcess); | 520 switches::kPluginProcess); |
516 | 521 |
517 cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, | 522 cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, |
518 channel_id_); | 523 channel_id_); |
519 | 524 |
520 cmd_line.AppendSwitchWithValue(switches::kPluginPath, | 525 cmd_line.AppendSwitchWithValue(switches::kPluginPath, |
521 plugin_path.ToWStringHack()); | 526 plugin_path.ToWStringHack()); |
522 | 527 |
523 bool in_sandbox = !browser_command_line.HasSwitch(switches::kNoSandbox) && | 528 bool in_sandbox = !browser_command_line.HasSwitch(switches::kNoSandbox) && |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 #endif | 648 #endif |
644 | 649 |
645 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) | 650 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) |
646 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) | 651 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) |
647 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl) | 652 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl) |
648 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl, | 653 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl, |
649 OnGetPluginFinderUrl) | 654 OnGetPluginFinderUrl) |
650 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ShutdownRequest, | 655 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ShutdownRequest, |
651 OnPluginShutdownRequest) | 656 OnPluginShutdownRequest) |
652 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage) | 657 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage) |
653 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginDataDir, | |
654 OnGetPluginDataDir) | |
655 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestResource, OnRequestResource) | 658 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestResource, OnRequestResource) |
656 IPC_MESSAGE_HANDLER(ViewHostMsg_CancelRequest, OnCancelRequest) | 659 IPC_MESSAGE_HANDLER(ViewHostMsg_CancelRequest, OnCancelRequest) |
657 IPC_MESSAGE_HANDLER(ViewHostMsg_DataReceived_ACK, OnDataReceivedACK) | 660 IPC_MESSAGE_HANDLER(ViewHostMsg_DataReceived_ACK, OnDataReceivedACK) |
658 IPC_MESSAGE_HANDLER(ViewHostMsg_UploadProgress_ACK, OnUploadProgressACK) | 661 IPC_MESSAGE_HANDLER(ViewHostMsg_UploadProgress_ACK, OnUploadProgressACK) |
659 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SyncLoad, OnSyncLoad) | 662 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_SyncLoad, OnSyncLoad) |
660 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies) | 663 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies) |
661 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy, | 664 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy, |
662 OnResolveProxy) | 665 OnResolveProxy) |
663 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_CreateWindow, | 666 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_CreateWindow, |
664 OnCreateWindow) | 667 OnCreateWindow) |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 914 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
912 | 915 |
913 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(plugin_path_); | 916 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(plugin_path_); |
914 if (chrome_plugin) { | 917 if (chrome_plugin) { |
915 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 918 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
916 uint32 data_len = static_cast<uint32>(data.size()); | 919 uint32 data_len = static_cast<uint32>(data.size()); |
917 chrome_plugin->functions().on_message(data_ptr, data_len); | 920 chrome_plugin->functions().on_message(data_ptr, data_len); |
918 } | 921 } |
919 } | 922 } |
920 | 923 |
921 void PluginProcessHost::OnGetPluginDataDir(std::wstring* retval) { | |
922 *retval = plugin_service_->GetChromePluginDataDir(); | |
923 } | |
924 | |
925 void PluginProcessHost::OnCreateWindow(HWND parent, IPC::Message* reply_msg) { | 924 void PluginProcessHost::OnCreateWindow(HWND parent, IPC::Message* reply_msg) { |
926 // Need to create this window on the UI thread. | 925 // Need to create this window on the UI thread. |
927 plugin_service_->main_message_loop()->PostTask(FROM_HERE, | 926 plugin_service_->main_message_loop()->PostTask(FROM_HERE, |
928 new CreateWindowTask(plugin_path_, parent, reply_msg)); | 927 new CreateWindowTask(plugin_path_, parent, reply_msg)); |
929 } | 928 } |
930 | 929 |
931 void PluginProcessHost::OnDestroyWindow(HWND window) { | 930 void PluginProcessHost::OnDestroyWindow(HWND window) { |
932 plugin_service_->main_message_loop()->PostTask(FROM_HERE, | 931 plugin_service_->main_message_loop()->PostTask(FROM_HERE, |
933 new DestroyWindowTask(window)); | 932 new DestroyWindowTask(window)); |
934 } | 933 } |
935 | 934 |
936 void PluginProcessHost::Shutdown() { | 935 void PluginProcessHost::Shutdown() { |
937 | 936 |
938 Send(new PluginProcessMsg_BrowserShutdown); | 937 Send(new PluginProcessMsg_BrowserShutdown); |
939 } | 938 } |
940 | 939 |
OLD | NEW |