OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/plugin/plugin_thread.h" | 5 #include "chrome/plugin/plugin_thread.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(USE_X11) | 9 #if defined(USE_X11) |
10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 x11_util::SetDefaultX11ErrorHandlers(); | 90 x11_util::SetDefaultX11ErrorHandlers(); |
91 #endif | 91 #endif |
92 | 92 |
93 PatchNPNFunctions(); | 93 PatchNPNFunctions(); |
94 | 94 |
95 // Preload the library to avoid loading, unloading then reloading | 95 // Preload the library to avoid loading, unloading then reloading |
96 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path_); | 96 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path_); |
97 | 97 |
98 ChromePluginLib::Create(plugin_path_, GetCPBrowserFuncsForPlugin()); | 98 ChromePluginLib::Create(plugin_path_, GetCPBrowserFuncsForPlugin()); |
99 | 99 |
100 scoped_refptr<NPAPI::PluginLib> plugin = | 100 scoped_refptr<NPAPI::PluginLib> plugin( |
101 NPAPI::PluginLib::CreatePluginLib(plugin_path_); | 101 NPAPI::PluginLib::CreatePluginLib(plugin_path_)); |
102 if (plugin.get()) { | 102 if (plugin.get()) { |
103 plugin->NP_Initialize(); | 103 plugin->NP_Initialize(); |
104 | 104 |
105 #if defined(OS_MACOSX) | 105 #if defined(OS_MACOSX) |
106 base::mac::ScopedCFTypeRef<CFStringRef> plugin_name( | 106 base::mac::ScopedCFTypeRef<CFStringRef> plugin_name( |
107 base::SysUTF16ToCFStringRef(plugin->plugin_info().name)); | 107 base::SysUTF16ToCFStringRef(plugin->plugin_info().name)); |
108 base::mac::ScopedCFTypeRef<CFStringRef> app_name( | 108 base::mac::ScopedCFTypeRef<CFStringRef> app_name( |
109 base::SysUTF16ToCFStringRef( | 109 base::SysUTF16ToCFStringRef( |
110 l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME))); | 110 l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME))); |
111 base::mac::ScopedCFTypeRef<CFStringRef> process_name( | 111 base::mac::ScopedCFTypeRef<CFStringRef> process_name( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 IPC_BEGIN_MESSAGE_MAP(PluginThread, msg) | 143 IPC_BEGIN_MESSAGE_MAP(PluginThread, msg) |
144 IPC_MESSAGE_HANDLER(PluginProcessMsg_CreateChannel, OnCreateChannel) | 144 IPC_MESSAGE_HANDLER(PluginProcessMsg_CreateChannel, OnCreateChannel) |
145 IPC_MESSAGE_HANDLER(PluginProcessMsg_PluginMessage, OnPluginMessage) | 145 IPC_MESSAGE_HANDLER(PluginProcessMsg_PluginMessage, OnPluginMessage) |
146 IPC_MESSAGE_HANDLER(PluginProcessMsg_NotifyRenderersOfPendingShutdown, | 146 IPC_MESSAGE_HANDLER(PluginProcessMsg_NotifyRenderersOfPendingShutdown, |
147 OnNotifyRenderersOfPendingShutdown) | 147 OnNotifyRenderersOfPendingShutdown) |
148 IPC_END_MESSAGE_MAP() | 148 IPC_END_MESSAGE_MAP() |
149 } | 149 } |
150 | 150 |
151 void PluginThread::OnCreateChannel(int renderer_id, | 151 void PluginThread::OnCreateChannel(int renderer_id, |
152 bool off_the_record) { | 152 bool off_the_record) { |
153 scoped_refptr<PluginChannel> channel = PluginChannel::GetPluginChannel( | 153 scoped_refptr<PluginChannel> channel(PluginChannel::GetPluginChannel( |
154 renderer_id, ChildProcess::current()->io_message_loop()); | 154 renderer_id, ChildProcess::current()->io_message_loop())); |
155 IPC::ChannelHandle channel_handle; | 155 IPC::ChannelHandle channel_handle; |
156 if (channel.get()) { | 156 if (channel.get()) { |
157 channel_handle.name = channel->channel_name(); | 157 channel_handle.name = channel->channel_name(); |
158 #if defined(OS_POSIX) | 158 #if defined(OS_POSIX) |
159 // On POSIX, pass the renderer-side FD. | 159 // On POSIX, pass the renderer-side FD. |
160 channel_handle.socket = base::FileDescriptor(channel->renderer_fd(), false); | 160 channel_handle.socket = base::FileDescriptor(channel->renderer_fd(), false); |
161 #endif | 161 #endif |
162 channel->set_off_the_record(off_the_record); | 162 channel->set_off_the_record(off_the_record); |
163 } | 163 } |
164 | 164 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } | 236 } |
237 | 237 |
238 if (!result || net_error != net::OK) | 238 if (!result || net_error != net::OK) |
239 return false; | 239 return false; |
240 | 240 |
241 *proxy_list = proxy_result; | 241 *proxy_list = proxy_result; |
242 return true; | 242 return true; |
243 } | 243 } |
244 | 244 |
245 } // namespace webkit_glue | 245 } // namespace webkit_glue |
OLD | NEW |