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 <stddef.h> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
9 #include "base/process/process_handle.h" | 11 #include "base/process/process_handle.h" |
10 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
11 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
12 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
13 #include "build/build_config.h" | 15 #include "build/build_config.h" |
14 #include "content/child/child_process.h" | 16 #include "content/child/child_process.h" |
15 #include "content/child/npapi/plugin_instance.h" | 17 #include "content/child/npapi/plugin_instance.h" |
16 #include "content/child/npapi/webplugin_delegate_impl.h" | 18 #include "content/child/npapi/webplugin_delegate_impl.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 299 } |
298 | 300 |
299 NOTREACHED() << "Couldn't find WebPluginDelegateStub to destroy"; | 301 NOTREACHED() << "Couldn't find WebPluginDelegateStub to destroy"; |
300 } | 302 } |
301 | 303 |
302 void PluginChannel::OnGenerateRouteID(int* route_id) { | 304 void PluginChannel::OnGenerateRouteID(int* route_id) { |
303 *route_id = GenerateRouteID(); | 305 *route_id = GenerateRouteID(); |
304 } | 306 } |
305 | 307 |
306 void PluginChannel::OnClearSiteData(const std::string& site, | 308 void PluginChannel::OnClearSiteData(const std::string& site, |
307 uint64 flags, | 309 uint64_t flags, |
308 uint64 max_age) { | 310 uint64_t max_age) { |
309 bool success = false; | 311 bool success = false; |
310 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 312 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
311 base::FilePath path = command_line->GetSwitchValuePath(switches::kPluginPath); | 313 base::FilePath path = command_line->GetSwitchValuePath(switches::kPluginPath); |
312 scoped_refptr<PluginLib> plugin_lib(PluginLib::CreatePluginLib(path)); | 314 scoped_refptr<PluginLib> plugin_lib(PluginLib::CreatePluginLib(path)); |
313 if (plugin_lib.get()) { | 315 if (plugin_lib.get()) { |
314 NPError err = plugin_lib->NP_Initialize(); | 316 NPError err = plugin_lib->NP_Initialize(); |
315 if (err == NPERR_NO_ERROR) { | 317 if (err == NPERR_NO_ERROR) { |
316 const char* site_str = site.empty() ? NULL : site.c_str(); | 318 const char* site_str = site.empty() ? NULL : site.c_str(); |
317 err = plugin_lib->NP_ClearSiteData(site_str, flags, max_age); | 319 err = plugin_lib->NP_ClearSiteData(site_str, flags, max_age); |
318 std::string site_name = | 320 std::string site_name = |
319 site.empty() ? "NULL" | 321 site.empty() ? "NULL" |
320 : base::StringPrintf("\"%s\"", site_str); | 322 : base::StringPrintf("\"%s\"", site_str); |
321 VLOG(1) << "NPP_ClearSiteData(" << site_name << ", " << flags << ", " | 323 VLOG(1) << "NPP_ClearSiteData(" << site_name << ", " << flags << ", " |
322 << max_age << ") returned " << err; | 324 << max_age << ") returned " << err; |
323 success = (err == NPERR_NO_ERROR); | 325 success = (err == NPERR_NO_ERROR); |
324 } | 326 } |
325 } | 327 } |
326 Send(new PluginProcessHostMsg_ClearSiteDataResult(success)); | 328 Send(new PluginProcessHostMsg_ClearSiteDataResult(success)); |
327 } | 329 } |
328 | 330 |
329 } // namespace content | 331 } // namespace content |
OLD | NEW |