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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 295 } |
296 | 296 |
297 void PluginChannel::OnClearSiteData(const std::string& site, | 297 void PluginChannel::OnClearSiteData(const std::string& site, |
298 uint64 flags, | 298 uint64 flags, |
299 uint64 max_age) { | 299 uint64 max_age) { |
300 bool success = false; | 300 bool success = false; |
301 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 301 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
302 base::FilePath path = command_line->GetSwitchValuePath(switches::kPluginPath); | 302 base::FilePath path = command_line->GetSwitchValuePath(switches::kPluginPath); |
303 scoped_refptr<webkit::npapi::PluginLib> plugin_lib( | 303 scoped_refptr<webkit::npapi::PluginLib> plugin_lib( |
304 webkit::npapi::PluginLib::CreatePluginLib(path)); | 304 webkit::npapi::PluginLib::CreatePluginLib(path)); |
305 if (plugin_lib.get()) { | 305 if (plugin_lib) { |
306 NPError err = plugin_lib->NP_Initialize(); | 306 NPError err = plugin_lib->NP_Initialize(); |
307 if (err == NPERR_NO_ERROR) { | 307 if (err == NPERR_NO_ERROR) { |
308 const char* site_str = site.empty() ? NULL : site.c_str(); | 308 const char* site_str = site.empty() ? NULL : site.c_str(); |
309 err = plugin_lib->NP_ClearSiteData(site_str, flags, max_age); | 309 err = plugin_lib->NP_ClearSiteData(site_str, flags, max_age); |
310 std::string site_name = | 310 std::string site_name = |
311 site.empty() ? "NULL" | 311 site.empty() ? "NULL" |
312 : base::StringPrintf("\"%s\"", site_str); | 312 : base::StringPrintf("\"%s\"", site_str); |
313 VLOG(1) << "NPP_ClearSiteData(" << site_name << ", " << flags << ", " | 313 VLOG(1) << "NPP_ClearSiteData(" << site_name << ", " << flags << ", " |
314 << max_age << ") returned " << err; | 314 << max_age << ") returned " << err; |
315 success = (err == NPERR_NO_ERROR); | 315 success = (err == NPERR_NO_ERROR); |
316 } | 316 } |
317 } | 317 } |
318 Send(new PluginHostMsg_ClearSiteDataResult(success)); | 318 Send(new PluginHostMsg_ClearSiteDataResult(success)); |
319 } | 319 } |
320 | 320 |
321 } // namespace content | 321 } // namespace content |
OLD | NEW |