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" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 IPC_END_MESSAGE_MAP() | 256 IPC_END_MESSAGE_MAP() |
257 DCHECK(handled); | 257 DCHECK(handled); |
258 return handled; | 258 return handled; |
259 } | 259 } |
260 | 260 |
261 void PluginChannel::OnCreateInstance(const std::string& mime_type, | 261 void PluginChannel::OnCreateInstance(const std::string& mime_type, |
262 int* instance_id) { | 262 int* instance_id) { |
263 *instance_id = GenerateRouteID(); | 263 *instance_id = GenerateRouteID(); |
264 scoped_refptr<WebPluginDelegateStub> stub(new WebPluginDelegateStub( | 264 scoped_refptr<WebPluginDelegateStub> stub(new WebPluginDelegateStub( |
265 mime_type, *instance_id, this)); | 265 mime_type, *instance_id, this)); |
266 AddRoute(*instance_id, stub, NULL); | 266 AddRoute(*instance_id, stub.get(), NULL); |
267 plugin_stubs_.push_back(stub); | 267 plugin_stubs_.push_back(stub); |
268 } | 268 } |
269 | 269 |
270 void PluginChannel::OnDestroyInstance(int instance_id, | 270 void PluginChannel::OnDestroyInstance(int instance_id, |
271 IPC::Message* reply_msg) { | 271 IPC::Message* reply_msg) { |
272 for (size_t i = 0; i < plugin_stubs_.size(); ++i) { | 272 for (size_t i = 0; i < plugin_stubs_.size(); ++i) { |
273 if (plugin_stubs_[i]->instance_id() == instance_id) { | 273 if (plugin_stubs_[i]->instance_id() == instance_id) { |
274 scoped_refptr<MessageFilter> filter(filter_); | 274 scoped_refptr<MessageFilter> filter(filter_); |
275 int render_view_id = | 275 int render_view_id = |
276 plugin_stubs_[i]->webplugin()->host_render_view_routing_id(); | 276 plugin_stubs_[i]->webplugin()->host_render_view_routing_id(); |
(...skipping 21 matching lines...) Expand all Loading... |
298 } | 298 } |
299 | 299 |
300 void PluginChannel::OnClearSiteData(const std::string& site, | 300 void PluginChannel::OnClearSiteData(const std::string& site, |
301 uint64 flags, | 301 uint64 flags, |
302 uint64 max_age) { | 302 uint64 max_age) { |
303 bool success = false; | 303 bool success = false; |
304 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 304 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
305 base::FilePath path = command_line->GetSwitchValuePath(switches::kPluginPath); | 305 base::FilePath path = command_line->GetSwitchValuePath(switches::kPluginPath); |
306 scoped_refptr<webkit::npapi::PluginLib> plugin_lib( | 306 scoped_refptr<webkit::npapi::PluginLib> plugin_lib( |
307 webkit::npapi::PluginLib::CreatePluginLib(path)); | 307 webkit::npapi::PluginLib::CreatePluginLib(path)); |
308 if (plugin_lib) { | 308 if (plugin_lib.get()) { |
309 NPError err = plugin_lib->NP_Initialize(); | 309 NPError err = plugin_lib->NP_Initialize(); |
310 if (err == NPERR_NO_ERROR) { | 310 if (err == NPERR_NO_ERROR) { |
311 const char* site_str = site.empty() ? NULL : site.c_str(); | 311 const char* site_str = site.empty() ? NULL : site.c_str(); |
312 err = plugin_lib->NP_ClearSiteData(site_str, flags, max_age); | 312 err = plugin_lib->NP_ClearSiteData(site_str, flags, max_age); |
313 std::string site_name = | 313 std::string site_name = |
314 site.empty() ? "NULL" | 314 site.empty() ? "NULL" |
315 : base::StringPrintf("\"%s\"", site_str); | 315 : base::StringPrintf("\"%s\"", site_str); |
316 VLOG(1) << "NPP_ClearSiteData(" << site_name << ", " << flags << ", " | 316 VLOG(1) << "NPP_ClearSiteData(" << site_name << ", " << flags << ", " |
317 << max_age << ") returned " << err; | 317 << max_age << ") returned " << err; |
318 success = (err == NPERR_NO_ERROR); | 318 success = (err == NPERR_NO_ERROR); |
319 } | 319 } |
320 } | 320 } |
321 Send(new PluginProcessHostMsg_ClearSiteDataResult(success)); | 321 Send(new PluginProcessHostMsg_ClearSiteDataResult(success)); |
322 } | 322 } |
323 | 323 |
324 } // namespace content | 324 } // namespace content |
OLD | NEW |