| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/plugin_process_host.h" | 5 #include "content/browser/plugin_process_host.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
| 10 #include <utility> // for pair<> | 10 #include <utility> // for pair<> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "content/public/browser/resource_context.h" | 36 #include "content/public/browser/resource_context.h" |
| 37 #include "content/public/common/content_switches.h" | 37 #include "content/public/common/content_switches.h" |
| 38 #include "content/public/common/process_type.h" | 38 #include "content/public/common/process_type.h" |
| 39 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 39 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| 40 #include "ipc/ipc_switches.h" | 40 #include "ipc/ipc_switches.h" |
| 41 #include "net/url_request/url_request_context_getter.h" | 41 #include "net/url_request/url_request_context_getter.h" |
| 42 #include "ui/base/ui_base_switches.h" | 42 #include "ui/base/ui_base_switches.h" |
| 43 #include "ui/gfx/native_widget_types.h" | 43 #include "ui/gfx/native_widget_types.h" |
| 44 #include "ui/gl/gl_switches.h" | 44 #include "ui/gl/gl_switches.h" |
| 45 | 45 |
| 46 #if defined(USE_X11) | |
| 47 #include "ui/gfx/gtk_native_view_id_manager.h" | |
| 48 #endif | |
| 49 | |
| 50 #if defined(OS_MACOSX) | 46 #if defined(OS_MACOSX) |
| 51 #include "base/mac/mac_util.h" | 47 #include "base/mac/mac_util.h" |
| 52 #include "content/common/plugin_carbon_interpose_constants_mac.h" | 48 #include "content/common/plugin_carbon_interpose_constants_mac.h" |
| 53 #include "ui/gfx/rect.h" | 49 #include "ui/gfx/rect.h" |
| 54 #endif | 50 #endif |
| 55 | 51 |
| 56 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
| 57 #include "base/win/windows_version.h" | 53 #include "base/win/windows_version.h" |
| 58 #include "content/common/plugin_constants_win.h" | 54 #include "content/common/plugin_constants_win.h" |
| 59 #include "ui/gfx/switches.h" | 55 #include "ui/gfx/switches.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 #endif // OS_WIN | 99 #endif // OS_WIN |
| 104 | 100 |
| 105 private: | 101 private: |
| 106 #if defined(OS_POSIX) | 102 #if defined(OS_POSIX) |
| 107 int ipc_fd_; | 103 int ipc_fd_; |
| 108 #endif // OS_POSIX | 104 #endif // OS_POSIX |
| 109 | 105 |
| 110 DISALLOW_COPY_AND_ASSIGN(PluginSandboxedProcessLauncherDelegate); | 106 DISALLOW_COPY_AND_ASSIGN(PluginSandboxedProcessLauncherDelegate); |
| 111 }; | 107 }; |
| 112 | 108 |
| 113 #if defined(TOOLKIT_GTK) | |
| 114 void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, | |
| 115 gfx::PluginWindowHandle* output) { | |
| 116 *output = 0; | |
| 117 #if !defined(USE_AURA) | |
| 118 GtkNativeViewManager::GetInstance()->GetXIDForId(output, id); | |
| 119 #endif | |
| 120 } | |
| 121 #endif // defined(TOOLKIT_GTK) | |
| 122 | |
| 123 PluginProcessHost::PluginProcessHost() | 109 PluginProcessHost::PluginProcessHost() |
| 124 #if defined(OS_MACOSX) | 110 #if defined(OS_MACOSX) |
| 125 : plugin_cursor_visible_(true) | 111 : plugin_cursor_visible_(true) |
| 126 #endif | 112 #endif |
| 127 { | 113 { |
| 128 process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_PLUGIN, this)); | 114 process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_PLUGIN, this)); |
| 129 } | 115 } |
| 130 | 116 |
| 131 PluginProcessHost::~PluginProcessHost() { | 117 PluginProcessHost::~PluginProcessHost() { |
| 132 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { | 279 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| 294 bool handled = true; | 280 bool handled = true; |
| 295 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) | 281 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) |
| 296 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) | 282 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) |
| 297 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelDestroyed, | 283 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelDestroyed, |
| 298 OnChannelDestroyed) | 284 OnChannelDestroyed) |
| 299 #if defined(OS_WIN) | 285 #if defined(OS_WIN) |
| 300 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, | 286 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, |
| 301 OnPluginWindowDestroyed) | 287 OnPluginWindowDestroyed) |
| 302 #endif | 288 #endif |
| 303 #if defined(TOOLKIT_GTK) | |
| 304 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, | |
| 305 OnMapNativeViewId) | |
| 306 #endif | |
| 307 #if defined(OS_MACOSX) | 289 #if defined(OS_MACOSX) |
| 308 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSelectWindow, | 290 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSelectWindow, |
| 309 OnPluginSelectWindow) | 291 OnPluginSelectWindow) |
| 310 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginShowWindow, | 292 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginShowWindow, |
| 311 OnPluginShowWindow) | 293 OnPluginShowWindow) |
| 312 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginHideWindow, | 294 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginHideWindow, |
| 313 OnPluginHideWindow) | 295 OnPluginHideWindow) |
| 314 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSetCursorVisibility, | 296 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSetCursorVisibility, |
| 315 OnPluginSetCursorVisibility) | 297 OnPluginSetCursorVisibility) |
| 316 #endif | 298 #endif |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 421 |
| 440 void PluginProcessHost::GetContexts(const ResourceHostMsg_Request& request, | 422 void PluginProcessHost::GetContexts(const ResourceHostMsg_Request& request, |
| 441 ResourceContext** resource_context, | 423 ResourceContext** resource_context, |
| 442 net::URLRequestContext** request_context) { | 424 net::URLRequestContext** request_context) { |
| 443 *resource_context = | 425 *resource_context = |
| 444 resource_context_map_[request.origin_pid].resource_context; | 426 resource_context_map_[request.origin_pid].resource_context; |
| 445 *request_context = (*resource_context)->GetRequestContext(); | 427 *request_context = (*resource_context)->GetRequestContext(); |
| 446 } | 428 } |
| 447 | 429 |
| 448 } // namespace content | 430 } // namespace content |
| OLD | NEW |