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 "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> |
11 #endif | 11 #endif |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "app/app_switches.h" | 15 #include "app/app_switches.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #if defined(OS_POSIX) | 17 #if defined(OS_POSIX) |
18 #include "base/global_descriptors_posix.h" | 18 #include "base/global_descriptors_posix.h" |
19 #endif | 19 #endif |
20 #include "base/file_path.h" | 20 #include "base/file_path.h" |
21 #include "base/file_util.h" | 21 #include "base/file_util.h" |
22 #include "base/file_version_info.h" | 22 #include "base/file_version_info.h" |
| 23 #include "base/gfx/native_widget_types.h" |
23 #include "base/logging.h" | 24 #include "base/logging.h" |
24 #include "base/path_service.h" | 25 #include "base/path_service.h" |
25 #include "base/process_util.h" | 26 #include "base/process_util.h" |
26 #include "base/scoped_ptr.h" | 27 #include "base/scoped_ptr.h" |
27 #include "base/thread.h" | 28 #include "base/thread.h" |
28 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
29 #include "chrome/browser/chrome_plugin_browsing_context.h" | 30 #include "chrome/browser/chrome_plugin_browsing_context.h" |
30 #include "chrome/browser/chrome_thread.h" | 31 #include "chrome/browser/chrome_thread.h" |
31 #include "chrome/browser/plugin_service.h" | 32 #include "chrome/browser/plugin_service.h" |
32 #include "chrome/browser/profile.h" | 33 #include "chrome/browser/profile.h" |
(...skipping 18 matching lines...) Expand all Loading... |
51 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
52 #include "app/win_util.h" | 53 #include "app/win_util.h" |
53 #include "chrome/browser/sandbox_policy.h" | 54 #include "chrome/browser/sandbox_policy.h" |
54 #include "sandbox/src/sandbox.h" | 55 #include "sandbox/src/sandbox.h" |
55 #endif | 56 #endif |
56 | 57 |
57 #if defined(OS_POSIX) | 58 #if defined(OS_POSIX) |
58 #include "chrome/common/ipc_channel_posix.h" | 59 #include "chrome/common/ipc_channel_posix.h" |
59 #endif | 60 #endif |
60 | 61 |
| 62 #if defined(OS_LINUX) |
| 63 #include "base/gfx/gtk_native_view_id_manager.h" |
| 64 #endif |
| 65 |
61 static const char kDefaultPluginFinderURL[] = | 66 static const char kDefaultPluginFinderURL[] = |
62 "http://dl.google.com/chrome/plugins/plugins2.xml"; | 67 "http://dl.google.com/chrome/plugins/plugins2.xml"; |
63 | 68 |
64 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
65 | 70 |
66 // The PluginDownloadUrlHelper is used to handle one download URL request | 71 // The PluginDownloadUrlHelper is used to handle one download URL request |
67 // from the plugin. Each download request is handled by a new instance | 72 // from the plugin. Each download request is handled by a new instance |
68 // of this class. | 73 // of this class. |
69 class PluginDownloadUrlHelper : public URLRequest::Delegate { | 74 class PluginDownloadUrlHelper : public URLRequest::Delegate { |
70 static const int kDownloadFileBufferSize = 32768; | 75 static const int kDownloadFileBufferSize = 32768; |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 OnGetPluginFinderUrl) | 436 OnGetPluginFinderUrl) |
432 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage) | 437 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage) |
433 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies) | 438 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetCookies, OnGetCookies) |
434 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy, | 439 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginProcessHostMsg_ResolveProxy, |
435 OnResolveProxy) | 440 OnResolveProxy) |
436 #if defined(OS_WIN) | 441 #if defined(OS_WIN) |
437 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, | 442 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, |
438 OnPluginWindowDestroyed) | 443 OnPluginWindowDestroyed) |
439 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl) | 444 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl) |
440 #endif | 445 #endif |
| 446 #if defined(OS_LINUX) |
| 447 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, |
| 448 OnMapNativeViewId) |
| 449 #endif |
441 IPC_MESSAGE_UNHANDLED_ERROR() | 450 IPC_MESSAGE_UNHANDLED_ERROR() |
442 IPC_END_MESSAGE_MAP() | 451 IPC_END_MESSAGE_MAP() |
443 } | 452 } |
444 | 453 |
445 void PluginProcessHost::OnChannelConnected(int32 peer_pid) { | 454 void PluginProcessHost::OnChannelConnected(int32 peer_pid) { |
446 for (size_t i = 0; i < pending_requests_.size(); ++i) { | 455 for (size_t i = 0; i < pending_requests_.size(); ++i) { |
447 RequestPluginChannel(pending_requests_[i].renderer_message_filter_.get(), | 456 RequestPluginChannel(pending_requests_[i].renderer_message_filter_.get(), |
448 pending_requests_[i].mime_type, | 457 pending_requests_[i].mime_type, |
449 pending_requests_[i].reply_msg); | 458 pending_requests_[i].reply_msg); |
450 } | 459 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 DCHECK(MessageLoop::current() == | 581 DCHECK(MessageLoop::current() == |
573 ChromeThread::GetMessageLoop(ChromeThread::IO)); | 582 ChromeThread::GetMessageLoop(ChromeThread::IO)); |
574 | 583 |
575 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); | 584 ChromePluginLib *chrome_plugin = ChromePluginLib::Find(info_.path); |
576 if (chrome_plugin) { | 585 if (chrome_plugin) { |
577 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); | 586 void *data_ptr = const_cast<void*>(reinterpret_cast<const void*>(&data[0])); |
578 uint32 data_len = static_cast<uint32>(data.size()); | 587 uint32 data_len = static_cast<uint32>(data.size()); |
579 chrome_plugin->functions().on_message(data_ptr, data_len); | 588 chrome_plugin->functions().on_message(data_ptr, data_len); |
580 } | 589 } |
581 } | 590 } |
| 591 |
| 592 #if defined(OS_LINUX) |
| 593 void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, |
| 594 gfx::PluginWindowHandle* output) { |
| 595 *output = 0; |
| 596 Singleton<GtkNativeViewManager>()->GetXIDForId(output, id); |
| 597 } |
| 598 #endif // defined(OS_LINUX) |
OLD | NEW |