OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_channel.h" | 5 #include "content/plugin/plugin_channel.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/common/child_process.h" | 14 #include "content/common/child_process.h" |
15 #include "content/common/plugin_messages.h" | 15 #include "content/common/plugin_process_messages.h" |
| 16 #include "content/common_child/plugin_messages.h" |
16 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
17 #include "content/plugin/plugin_thread.h" | 18 #include "content/plugin/plugin_thread.h" |
18 #include "content/plugin/webplugin_delegate_stub.h" | 19 #include "content/plugin/webplugin_delegate_stub.h" |
19 #include "content/plugin/webplugin_proxy.h" | 20 #include "content/plugin/webplugin_proxy.h" |
20 #include "webkit/plugins/npapi/plugin_instance.h" | 21 #include "webkit/plugins/npapi/plugin_instance.h" |
21 | 22 |
22 #if defined(OS_POSIX) | 23 #if defined(OS_POSIX) |
23 #include "base/posix/eintr_wrapper.h" | 24 #include "base/posix/eintr_wrapper.h" |
24 #include "ipc/ipc_channel_posix.h" | 25 #include "ipc/ipc_channel_posix.h" |
25 #endif | 26 #endif |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); | 244 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); |
244 } | 245 } |
245 | 246 |
246 bool PluginChannel::OnControlMessageReceived(const IPC::Message& msg) { | 247 bool PluginChannel::OnControlMessageReceived(const IPC::Message& msg) { |
247 bool handled = true; | 248 bool handled = true; |
248 IPC_BEGIN_MESSAGE_MAP(PluginChannel, msg) | 249 IPC_BEGIN_MESSAGE_MAP(PluginChannel, msg) |
249 IPC_MESSAGE_HANDLER(PluginMsg_CreateInstance, OnCreateInstance) | 250 IPC_MESSAGE_HANDLER(PluginMsg_CreateInstance, OnCreateInstance) |
250 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginMsg_DestroyInstance, | 251 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginMsg_DestroyInstance, |
251 OnDestroyInstance) | 252 OnDestroyInstance) |
252 IPC_MESSAGE_HANDLER(PluginMsg_GenerateRouteID, OnGenerateRouteID) | 253 IPC_MESSAGE_HANDLER(PluginMsg_GenerateRouteID, OnGenerateRouteID) |
253 IPC_MESSAGE_HANDLER(PluginMsg_ClearSiteData, OnClearSiteData) | 254 IPC_MESSAGE_HANDLER(PluginProcessMsg_ClearSiteData, OnClearSiteData) |
254 IPC_MESSAGE_UNHANDLED(handled = false) | 255 IPC_MESSAGE_UNHANDLED(handled = false) |
255 IPC_END_MESSAGE_MAP() | 256 IPC_END_MESSAGE_MAP() |
256 DCHECK(handled); | 257 DCHECK(handled); |
257 return handled; | 258 return handled; |
258 } | 259 } |
259 | 260 |
260 void PluginChannel::OnCreateInstance(const std::string& mime_type, | 261 void PluginChannel::OnCreateInstance(const std::string& mime_type, |
261 int* instance_id) { | 262 int* instance_id) { |
262 *instance_id = GenerateRouteID(); | 263 *instance_id = GenerateRouteID(); |
263 scoped_refptr<WebPluginDelegateStub> stub(new WebPluginDelegateStub( | 264 scoped_refptr<WebPluginDelegateStub> stub(new WebPluginDelegateStub( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 const char* site_str = site.empty() ? NULL : site.c_str(); | 311 const char* site_str = site.empty() ? NULL : site.c_str(); |
311 err = plugin_lib->NP_ClearSiteData(site_str, flags, max_age); | 312 err = plugin_lib->NP_ClearSiteData(site_str, flags, max_age); |
312 std::string site_name = | 313 std::string site_name = |
313 site.empty() ? "NULL" | 314 site.empty() ? "NULL" |
314 : base::StringPrintf("\"%s\"", site_str); | 315 : base::StringPrintf("\"%s\"", site_str); |
315 VLOG(1) << "NPP_ClearSiteData(" << site_name << ", " << flags << ", " | 316 VLOG(1) << "NPP_ClearSiteData(" << site_name << ", " << flags << ", " |
316 << max_age << ") returned " << err; | 317 << max_age << ") returned " << err; |
317 success = (err == NPERR_NO_ERROR); | 318 success = (err == NPERR_NO_ERROR); |
318 } | 319 } |
319 } | 320 } |
320 Send(new PluginHostMsg_ClearSiteDataResult(success)); | 321 Send(new PluginProcessHostMsg_ClearSiteDataResult(success)); |
321 } | 322 } |
322 | 323 |
323 } // namespace content | 324 } // namespace content |
OLD | NEW |