| 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> |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 IPC_BEGIN_MESSAGE_MAP(PluginThread, msg) | 144 IPC_BEGIN_MESSAGE_MAP(PluginThread, msg) |
| 145 IPC_MESSAGE_HANDLER(PluginProcessMsg_CreateChannel, OnCreateChannel) | 145 IPC_MESSAGE_HANDLER(PluginProcessMsg_CreateChannel, OnCreateChannel) |
| 146 IPC_MESSAGE_HANDLER(PluginProcessMsg_NotifyRenderersOfPendingShutdown, | 146 IPC_MESSAGE_HANDLER(PluginProcessMsg_NotifyRenderersOfPendingShutdown, |
| 147 OnNotifyRenderersOfPendingShutdown) | 147 OnNotifyRenderersOfPendingShutdown) |
| 148 IPC_MESSAGE_UNHANDLED(handled = false) | 148 IPC_MESSAGE_UNHANDLED(handled = false) |
| 149 IPC_END_MESSAGE_MAP() | 149 IPC_END_MESSAGE_MAP() |
| 150 return handled; | 150 return handled; |
| 151 } | 151 } |
| 152 | 152 |
| 153 void PluginThread::OnCreateChannel(int renderer_id, | 153 void PluginThread::OnCreateChannel(int renderer_id, |
| 154 bool save_local_state, |
| 154 bool incognito) { | 155 bool incognito) { |
| 155 scoped_refptr<PluginChannel> channel(PluginChannel::GetPluginChannel( | 156 scoped_refptr<PluginChannel> channel(PluginChannel::GetPluginChannel( |
| 156 renderer_id, ChildProcess::current()->io_message_loop_proxy())); | 157 renderer_id, ChildProcess::current()->io_message_loop_proxy())); |
| 157 IPC::ChannelHandle channel_handle; | 158 IPC::ChannelHandle channel_handle; |
| 158 if (channel.get()) { | 159 if (channel.get()) { |
| 159 channel_handle.name = channel->channel_handle().name; | 160 channel_handle.name = channel->channel_handle().name; |
| 160 #if defined(OS_POSIX) | 161 #if defined(OS_POSIX) |
| 161 // On POSIX, pass the renderer-side FD. | 162 // On POSIX, pass the renderer-side FD. |
| 162 channel_handle.socket = base::FileDescriptor(channel->renderer_fd(), false); | 163 channel_handle.socket = base::FileDescriptor(channel->renderer_fd(), false); |
| 163 #endif | 164 #endif |
| 165 channel->set_save_local_state(save_local_state); |
| 164 channel->set_incognito(incognito); | 166 channel->set_incognito(incognito); |
| 165 } | 167 } |
| 166 | 168 |
| 167 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); | 169 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); |
| 168 } | 170 } |
| 169 | 171 |
| 170 void PluginThread::OnNotifyRenderersOfPendingShutdown() { | 172 void PluginThread::OnNotifyRenderersOfPendingShutdown() { |
| 171 PluginChannel::NotifyRenderersOfPendingShutdown(); | 173 PluginChannel::NotifyRenderersOfPendingShutdown(); |
| 172 } | 174 } |
| 173 | 175 |
| 174 namespace webkit_glue { | 176 namespace webkit_glue { |
| 175 bool FindProxyForUrl(const GURL& url, std::string* proxy_list) { | 177 bool FindProxyForUrl(const GURL& url, std::string* proxy_list) { |
| 176 int net_error; | 178 int net_error; |
| 177 std::string proxy_result; | 179 std::string proxy_result; |
| 178 | 180 |
| 179 bool result = ChildThread::current()->Send( | 181 bool result = ChildThread::current()->Send( |
| 180 new ChildProcessHostMsg_ResolveProxy(url, &net_error, &proxy_result)); | 182 new ChildProcessHostMsg_ResolveProxy(url, &net_error, &proxy_result)); |
| 181 if (!result || net_error != net::OK) | 183 if (!result || net_error != net::OK) |
| 182 return false; | 184 return false; |
| 183 | 185 |
| 184 *proxy_list = proxy_result; | 186 *proxy_list = proxy_result; |
| 185 return true; | 187 return true; |
| 186 } | 188 } |
| 187 | 189 |
| 188 } // namespace webkit_glue | 190 } // namespace webkit_glue |
| OLD | NEW |