| 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/plugin/plugin_thread.h" | 5 #include "content/plugin/plugin_thread.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(TOOLKIT_USES_GTK) | 9 #if defined(TOOLKIT_USES_GTK) |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| 11 #elif defined(OS_MACOSX) | 11 #elif defined(OS_MACOSX) |
| 12 #include <CoreFoundation/CoreFoundation.h> | 12 #include <CoreFoundation/CoreFoundation.h> |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "base/lazy_instance.h" | 19 #include "base/lazy_instance.h" |
| 20 #include "base/process_util.h" | 20 #include "base/process_util.h" |
| 21 #include "base/threading/thread_local.h" | 21 #include "base/threading/thread_local.h" |
| 22 #include "content/common/child_process.h" | 22 #include "content/common/child_process.h" |
| 23 #include "content/common/npobject_util.h" | 23 #include "content/common/npobject_util.h" |
| 24 #include "content/common/plugin_messages.h" | 24 #include "content/common/plugin_messages.h" |
| 25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 26 #include "content/public/plugin/content_plugin_client.h" | 26 #include "content/public/plugin/content_plugin_client.h" |
| 27 #include "ipc/ipc_channel_handle.h" | 27 #include "ipc/ipc_channel_handle.h" |
| 28 #include "webkit/glue/webkit_glue.h" | 28 #include "webkit/glue/webkit_glue.h" |
| 29 #include "webkit/plugins/npapi/plugin_lib.h" | 29 #include "webkit/plugins/npapi/plugin_lib.h" |
| 30 #include "webkit/plugins/npapi/plugin_list.h" |
| 30 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 31 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
| 31 | 32 |
| 32 #if defined(TOOLKIT_USES_GTK) | 33 #if defined(TOOLKIT_USES_GTK) |
| 33 #include "ui/gfx/gtk_util.h" | 34 #include "ui/gfx/gtk_util.h" |
| 34 #endif | 35 #endif |
| 35 | 36 |
| 36 #if defined(USE_X11) | 37 #if defined(USE_X11) |
| 37 #include "ui/base/x/x11_util.h" | 38 #include "ui/base/x/x11_util.h" |
| 38 #endif | 39 #endif |
| 39 | 40 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if (plugin.get()) { | 108 if (plugin.get()) { |
| 108 plugin->NP_Initialize(); | 109 plugin->NP_Initialize(); |
| 109 // For OOP plugins the plugin dll will be unloaded during process shutdown | 110 // For OOP plugins the plugin dll will be unloaded during process shutdown |
| 110 // time. | 111 // time. |
| 111 plugin->set_defer_unload(true); | 112 plugin->set_defer_unload(true); |
| 112 } | 113 } |
| 113 | 114 |
| 114 content::GetContentClient()->plugin()->PluginProcessStarted( | 115 content::GetContentClient()->plugin()->PluginProcessStarted( |
| 115 plugin.get() ? plugin->plugin_info().name : string16()); | 116 plugin.get() ? plugin->plugin_info().name : string16()); |
| 116 | 117 |
| 118 content::GetContentClient()->AddNPAPIPlugins( |
| 119 webkit::npapi::PluginList::Singleton()); |
| 120 |
| 117 // Certain plugins, such as flash, steal the unhandled exception filter | 121 // Certain plugins, such as flash, steal the unhandled exception filter |
| 118 // thus we never get crash reports when they fault. This call fixes it. | 122 // thus we never get crash reports when they fault. This call fixes it. |
| 119 message_loop()->set_exception_restoration(true); | 123 message_loop()->set_exception_restoration(true); |
| 120 channel()->AddFilter(new EnsureTerminateMessageFilter()); | 124 channel()->AddFilter(new EnsureTerminateMessageFilter()); |
| 121 } | 125 } |
| 122 | 126 |
| 123 PluginThread::~PluginThread() { | 127 PluginThread::~PluginThread() { |
| 124 if (preloaded_plugin_module_) { | 128 if (preloaded_plugin_module_) { |
| 125 base::UnloadNativeLibrary(preloaded_plugin_module_); | 129 base::UnloadNativeLibrary(preloaded_plugin_module_); |
| 126 preloaded_plugin_module_ = NULL; | 130 preloaded_plugin_module_ = NULL; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 #endif | 167 #endif |
| 164 channel->set_incognito(incognito); | 168 channel->set_incognito(incognito); |
| 165 } | 169 } |
| 166 | 170 |
| 167 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); | 171 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); |
| 168 } | 172 } |
| 169 | 173 |
| 170 void PluginThread::OnNotifyRenderersOfPendingShutdown() { | 174 void PluginThread::OnNotifyRenderersOfPendingShutdown() { |
| 171 PluginChannel::NotifyRenderersOfPendingShutdown(); | 175 PluginChannel::NotifyRenderersOfPendingShutdown(); |
| 172 } | 176 } |
| OLD | NEW |