| 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/process_handle.h" | 9 #include "base/process/process_handle.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 246 } |
| 247 | 247 |
| 248 bool PluginChannel::OnControlMessageReceived(const IPC::Message& msg) { | 248 bool PluginChannel::OnControlMessageReceived(const IPC::Message& msg) { |
| 249 bool handled = true; | 249 bool handled = true; |
| 250 IPC_BEGIN_MESSAGE_MAP(PluginChannel, msg) | 250 IPC_BEGIN_MESSAGE_MAP(PluginChannel, msg) |
| 251 IPC_MESSAGE_HANDLER(PluginMsg_CreateInstance, OnCreateInstance) | 251 IPC_MESSAGE_HANDLER(PluginMsg_CreateInstance, OnCreateInstance) |
| 252 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginMsg_DestroyInstance, | 252 IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginMsg_DestroyInstance, |
| 253 OnDestroyInstance) | 253 OnDestroyInstance) |
| 254 IPC_MESSAGE_HANDLER(PluginMsg_GenerateRouteID, OnGenerateRouteID) | 254 IPC_MESSAGE_HANDLER(PluginMsg_GenerateRouteID, OnGenerateRouteID) |
| 255 IPC_MESSAGE_HANDLER(PluginProcessMsg_ClearSiteData, OnClearSiteData) | 255 IPC_MESSAGE_HANDLER(PluginProcessMsg_ClearSiteData, OnClearSiteData) |
| 256 IPC_MESSAGE_HANDLER(PluginHostMsg_DidAbortLoading, OnDidAbortLoading) | |
| 257 IPC_MESSAGE_UNHANDLED(handled = false) | 256 IPC_MESSAGE_UNHANDLED(handled = false) |
| 258 IPC_END_MESSAGE_MAP() | 257 IPC_END_MESSAGE_MAP() |
| 259 DCHECK(handled); | 258 DCHECK(handled); |
| 260 return handled; | 259 return handled; |
| 261 } | 260 } |
| 262 | 261 |
| 263 void PluginChannel::OnCreateInstance(const std::string& mime_type, | 262 void PluginChannel::OnCreateInstance(const std::string& mime_type, |
| 264 int* instance_id) { | 263 int* instance_id) { |
| 265 *instance_id = GenerateRouteID(); | 264 *instance_id = GenerateRouteID(); |
| 266 scoped_refptr<WebPluginDelegateStub> stub(new WebPluginDelegateStub( | 265 scoped_refptr<WebPluginDelegateStub> stub(new WebPluginDelegateStub( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 site.empty() ? "NULL" | 319 site.empty() ? "NULL" |
| 321 : base::StringPrintf("\"%s\"", site_str); | 320 : base::StringPrintf("\"%s\"", site_str); |
| 322 VLOG(1) << "NPP_ClearSiteData(" << site_name << ", " << flags << ", " | 321 VLOG(1) << "NPP_ClearSiteData(" << site_name << ", " << flags << ", " |
| 323 << max_age << ") returned " << err; | 322 << max_age << ") returned " << err; |
| 324 success = (err == NPERR_NO_ERROR); | 323 success = (err == NPERR_NO_ERROR); |
| 325 } | 324 } |
| 326 } | 325 } |
| 327 Send(new PluginProcessHostMsg_ClearSiteDataResult(success)); | 326 Send(new PluginProcessHostMsg_ClearSiteDataResult(success)); |
| 328 } | 327 } |
| 329 | 328 |
| 330 void PluginChannel::OnDidAbortLoading(int render_view_id) { | |
| 331 for (size_t i = 0; i < plugin_stubs_.size(); ++i) { | |
| 332 if (plugin_stubs_[i]->webplugin()->host_render_view_routing_id() == | |
| 333 render_view_id) { | |
| 334 plugin_stubs_[i]->delegate()->instance()->CloseStreams(); | |
| 335 } | |
| 336 } | |
| 337 } | |
| 338 | |
| 339 } // namespace content | 329 } // namespace content |
| OLD | NEW |