OLD | NEW |
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) && !defined(USE_AURA) | 7 #if defined(OS_WIN) && !defined(USE_AURA) |
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 10 matching lines...) Expand all Loading... |
21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
22 #include "base/string_util.h" | 22 #include "base/string_util.h" |
23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
24 #include "content/browser/plugin_service.h" | 24 #include "content/browser/plugin_service.h" |
25 #include "content/common/plugin_messages.h" | 25 #include "content/common/plugin_messages.h" |
26 #include "content/common/resource_messages.h" | 26 #include "content/common/resource_messages.h" |
27 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/content_browser_client.h" | 28 #include "content/public/browser/content_browser_client.h" |
29 #include "content/public/browser/notification_types.h" | 29 #include "content/public/browser/notification_types.h" |
30 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 31 #include "content/public/common/process_type.h" |
31 #include "ipc/ipc_switches.h" | 32 #include "ipc/ipc_switches.h" |
32 #include "ui/base/ui_base_switches.h" | 33 #include "ui/base/ui_base_switches.h" |
33 #include "ui/gfx/gl/gl_switches.h" | 34 #include "ui/gfx/gl/gl_switches.h" |
34 #include "ui/gfx/native_widget_types.h" | 35 #include "ui/gfx/native_widget_types.h" |
35 | 36 |
36 using content::BrowserThread; | 37 using content::BrowserThread; |
37 | 38 |
38 #if defined(USE_X11) | 39 #if defined(USE_X11) |
39 #include "ui/gfx/gtk_native_view_id_manager.h" | 40 #include "ui/gfx/gtk_native_view_id_manager.h" |
40 #endif | 41 #endif |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, | 105 void PluginProcessHost::OnMapNativeViewId(gfx::NativeViewId id, |
105 gfx::PluginWindowHandle* output) { | 106 gfx::PluginWindowHandle* output) { |
106 *output = 0; | 107 *output = 0; |
107 #if !defined(USE_AURA) | 108 #if !defined(USE_AURA) |
108 GtkNativeViewManager::GetInstance()->GetXIDForId(output, id); | 109 GtkNativeViewManager::GetInstance()->GetXIDForId(output, id); |
109 #endif | 110 #endif |
110 } | 111 } |
111 #endif // defined(TOOLKIT_USES_GTK) | 112 #endif // defined(TOOLKIT_USES_GTK) |
112 | 113 |
113 PluginProcessHost::PluginProcessHost() | 114 PluginProcessHost::PluginProcessHost() |
114 : BrowserChildProcessHost(PLUGIN_PROCESS) | 115 : BrowserChildProcessHost(content::PROCESS_TYPE_PLUGIN) |
115 #if defined(OS_MACOSX) | 116 #if defined(OS_MACOSX) |
116 , plugin_cursor_visible_(true) | 117 , plugin_cursor_visible_(true) |
117 #endif | 118 #endif |
118 { | 119 { |
119 } | 120 } |
120 | 121 |
121 PluginProcessHost::~PluginProcessHost() { | 122 PluginProcessHost::~PluginProcessHost() { |
122 #if defined(OS_WIN) && !defined(USE_AURA) | 123 #if defined(OS_WIN) && !defined(USE_AURA) |
123 // We erase HWNDs from the plugin_parent_windows_set_ when we receive a | 124 // We erase HWNDs from the plugin_parent_windows_set_ when we receive a |
124 // notification that the window is being destroyed. If we don't receive this | 125 // notification that the window is being destroyed. If we don't receive this |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 Client* client = sent_requests_.front(); | 337 Client* client = sent_requests_.front(); |
337 if (client) | 338 if (client) |
338 client->OnError(); | 339 client->OnError(); |
339 sent_requests_.pop_front(); | 340 sent_requests_.pop_front(); |
340 } | 341 } |
341 } | 342 } |
342 | 343 |
343 // static | 344 // static |
344 void PluginProcessHost::CancelPendingRequestsForResourceContext( | 345 void PluginProcessHost::CancelPendingRequestsForResourceContext( |
345 const content::ResourceContext* context) { | 346 const content::ResourceContext* context) { |
346 for (BrowserChildProcessHost::Iterator host_it( | 347 for (BrowserChildProcessHost::Iterator host_it(content::PROCESS_TYPE_PLUGIN); |
347 ChildProcessInfo::PLUGIN_PROCESS); | |
348 !host_it.Done(); ++host_it) { | 348 !host_it.Done(); ++host_it) { |
349 PluginProcessHost* host = static_cast<PluginProcessHost*>(*host_it); | 349 PluginProcessHost* host = static_cast<PluginProcessHost*>(*host_it); |
350 for (size_t i = 0; i < host->pending_requests_.size(); ++i) { | 350 for (size_t i = 0; i < host->pending_requests_.size(); ++i) { |
351 if (&host->pending_requests_[i]->GetResourceContext() == context) { | 351 if (&host->pending_requests_[i]->GetResourceContext() == context) { |
352 host->pending_requests_[i]->OnError(); | 352 host->pending_requests_[i]->OnError(); |
353 host->pending_requests_.erase(host->pending_requests_.begin() + i); | 353 host->pending_requests_.erase(host->pending_requests_.begin() + i); |
354 --i; | 354 --i; |
355 } | 355 } |
356 } | 356 } |
357 } | 357 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 } | 416 } |
417 | 417 |
418 void PluginProcessHost::OnChannelCreated( | 418 void PluginProcessHost::OnChannelCreated( |
419 const IPC::ChannelHandle& channel_handle) { | 419 const IPC::ChannelHandle& channel_handle) { |
420 Client* client = sent_requests_.front(); | 420 Client* client = sent_requests_.front(); |
421 | 421 |
422 if (client) | 422 if (client) |
423 client->OnChannelOpened(channel_handle); | 423 client->OnChannelOpened(channel_handle); |
424 sent_requests_.pop_front(); | 424 sent_requests_.pop_front(); |
425 } | 425 } |
OLD | NEW |