Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: content/browser/plugin_process_host.cc

Issue 7036025: Get rid of chrome dependencies from PluginProcessHost by moving dispatching of chrome specific me... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "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<>
11 #endif 11 #endif
12 12
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/file_path.h" 16 #include "base/file_path.h"
17 #include "base/file_util.h" 17 #include "base/file_util.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/path_service.h" 19 #include "base/path_service.h"
20 #include "base/string_util.h" 20 #include "base/string_util.h"
21 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
22 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/net/resolve_proxy_msg_helper.h"
24 #include "chrome/browser/net/url_request_tracking.h"
25 #include "chrome/browser/plugin_download_helper.h"
26 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/common/chrome_paths.h" 22 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/logging_chrome.h" 24 #include "chrome/common/logging_chrome.h"
30 #include "chrome/common/render_messages.h"
31 #include "content/browser/browser_thread.h" 25 #include "content/browser/browser_thread.h"
26 #include "content/browser/content_browser_client.h"
27 #include "content/browser/resolve_proxy_msg_helper.h"
32 #include "content/browser/plugin_service.h" 28 #include "content/browser/plugin_service.h"
33 #include "content/browser/renderer_host/resource_dispatcher_host.h" 29 #include "content/browser/renderer_host/resource_dispatcher_host.h"
34 #include "content/browser/renderer_host/resource_message_filter.h" 30 #include "content/browser/renderer_host/resource_message_filter.h"
35 #include "content/common/plugin_messages.h" 31 #include "content/common/plugin_messages.h"
36 #include "content/common/resource_messages.h" 32 #include "content/common/resource_messages.h"
37 #include "ipc/ipc_switches.h" 33 #include "ipc/ipc_switches.h"
38 #include "net/base/io_buffer.h"
39 #include "net/url_request/url_request.h"
40 #include "net/url_request/url_request_context.h"
41 #include "net/url_request/url_request_context_getter.h"
42 #include "ui/base/ui_base_switches.h" 34 #include "ui/base/ui_base_switches.h"
43 #include "ui/gfx/native_widget_types.h" 35 #include "ui/gfx/native_widget_types.h"
44 #include "ui/gfx/gl/gl_switches.h" 36 #include "ui/gfx/gl/gl_switches.h"
45 37
46 #if defined(USE_X11) 38 #if defined(USE_X11)
47 #include "ui/gfx/gtk_native_view_id_manager.h" 39 #include "ui/gfx/gtk_native_view_id_manager.h"
48 #endif 40 #endif
49 41
50 #if defined(OS_MACOSX) 42 #if defined(OS_MACOSX)
51 #include "base/mac/mac_util.h" 43 #include "base/mac/mac_util.h"
52 #include "content/common/plugin_carbon_interpose_constants_mac.h" 44 #include "content/common/plugin_carbon_interpose_constants_mac.h"
53 #include "ui/gfx/rect.h" 45 #include "ui/gfx/rect.h"
54 #endif 46 #endif
55 47
56 static const char kDefaultPluginFinderURL[] =
57 "https://dl-ssl.google.com/edgedl/chrome/plugins/plugins2.xml";
58
59 #if defined(OS_WIN) 48 #if defined(OS_WIN)
60 void PluginProcessHost::OnPluginWindowDestroyed(HWND window, HWND parent) { 49 void PluginProcessHost::OnPluginWindowDestroyed(HWND window, HWND parent) {
61 // The window is destroyed at this point, we just care about its parent, which 50 // The window is destroyed at this point, we just care about its parent, which
62 // is the intermediate window we created. 51 // is the intermediate window we created.
63 std::set<HWND>::iterator window_index = 52 std::set<HWND>::iterator window_index =
64 plugin_parent_windows_set_.find(parent); 53 plugin_parent_windows_set_.find(parent);
65 if (window_index == plugin_parent_windows_set_.end()) 54 if (window_index == plugin_parent_windows_set_.end())
66 return; 55 return;
67 56
68 plugin_parent_windows_set_.erase(window_index); 57 plugin_parent_windows_set_.erase(window_index);
69 PostMessage(parent, WM_CLOSE, 0, 0); 58 PostMessage(parent, WM_CLOSE, 0, 0);
70 } 59 }
71 60
72 void PluginProcessHost::OnDownloadUrl(const std::string& url,
73 int source_pid,
74 gfx::NativeWindow caller_window) {
75 PluginDownloadUrlHelper* download_url_helper =
76 new PluginDownloadUrlHelper(url, source_pid, caller_window, NULL);
77 download_url_helper->InitiateDownload(
78 Profile::GetDefaultRequestContext()->GetURLRequestContext());
79 }
80
81 void PluginProcessHost::AddWindow(HWND window) { 61 void PluginProcessHost::AddWindow(HWND window) {
82 plugin_parent_windows_set_.insert(window); 62 plugin_parent_windows_set_.insert(window);
83 } 63 }
84 64
85 #endif // defined(OS_WIN) 65 #endif // defined(OS_WIN)
86 66
87 #if defined(TOOLKIT_USES_GTK) 67 #if defined(TOOLKIT_USES_GTK)
88 void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, 68 void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id,
89 gfx::PluginWindowHandle* output) { 69 gfx::PluginWindowHandle* output) {
90 *output = 0; 70 *output = 0;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 214
235 Launch( 215 Launch(
236 #if defined(OS_WIN) 216 #if defined(OS_WIN)
237 FilePath(), 217 FilePath(),
238 #elif defined(OS_POSIX) 218 #elif defined(OS_POSIX)
239 false, 219 false,
240 env, 220 env,
241 #endif 221 #endif
242 cmd_line); 222 cmd_line);
243 223
224 content::GetContentClient()->browser()->PluginProcessHostCreated(this);
244 AddFilter(new ResolveProxyMsgHelper(NULL)); 225 AddFilter(new ResolveProxyMsgHelper(NULL));
245 226
246 return true; 227 return true;
247 } 228 }
248 229
249 void PluginProcessHost::ForceShutdown() { 230 void PluginProcessHost::ForceShutdown() {
250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 231 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
251 Send(new PluginProcessMsg_NotifyRenderersOfPendingShutdown()); 232 Send(new PluginProcessMsg_NotifyRenderersOfPendingShutdown());
252 BrowserChildProcessHost::ForceShutdown(); 233 BrowserChildProcessHost::ForceShutdown();
253 } 234 }
254 235
255 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { 236 bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) {
256 bool handled = true; 237 bool handled = true;
257 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) 238 IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg)
258 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) 239 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated)
259 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl,
260 OnGetPluginFinderUrl)
261 #if defined(OS_WIN) 240 #if defined(OS_WIN)
262 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed, 241 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginWindowDestroyed,
263 OnPluginWindowDestroyed) 242 OnPluginWindowDestroyed)
264 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl)
265 #endif 243 #endif
266 #if defined(TOOLKIT_USES_GTK) 244 #if defined(TOOLKIT_USES_GTK)
267 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId, 245 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_MapNativeViewId,
268 OnMapNativeViewId) 246 OnMapNativeViewId)
269 #endif 247 #endif
270 #if defined(OS_MACOSX) 248 #if defined(OS_MACOSX)
271 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSelectWindow, 249 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSelectWindow,
272 OnPluginSelectWindow) 250 OnPluginSelectWindow)
273 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginShowWindow, 251 IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginShowWindow,
274 OnPluginShowWindow) 252 OnPluginShowWindow)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 321 }
344 } 322 }
345 323
346 void PluginProcessHost::OnChannelCreated( 324 void PluginProcessHost::OnChannelCreated(
347 const IPC::ChannelHandle& channel_handle) { 325 const IPC::ChannelHandle& channel_handle) {
348 Client* client = sent_requests_.front(); 326 Client* client = sent_requests_.front();
349 327
350 client->OnChannelOpened(channel_handle); 328 client->OnChannelOpened(channel_handle);
351 sent_requests_.pop(); 329 sent_requests_.pop();
352 } 330 }
353
354 void PluginProcessHost::OnGetPluginFinderUrl(std::string* plugin_finder_url) {
355 // TODO(bauerb): Move this method to MessageFilter.
356 if (!plugin_finder_url) {
357 NOTREACHED();
358 return;
359 }
360
361 if (!g_browser_process->plugin_finder_disabled()) {
362 // TODO(iyengar): Add the plumbing to retrieve the default
363 // plugin finder URL.
364 *plugin_finder_url = kDefaultPluginFinderURL;
365 } else {
366 plugin_finder_url->clear();
367 }
368 }
OLDNEW
« no previous file with comments | « content/browser/plugin_process_host.h ('k') | content/browser/renderer_host/browser_render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698