Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: content/plugin/plugin_channel.cc

Issue 9981015: Add an interface for Flash to clear its data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/plugin/plugin_channel.h ('k') | content/ppapi_plugin/ppapi_thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 *route_id = GenerateRouteID(); 251 *route_id = GenerateRouteID();
252 } 252 }
253 253
254 int PluginChannel::GenerateRouteID() { 254 int PluginChannel::GenerateRouteID() {
255 static int last_id = 0; 255 static int last_id = 0;
256 return ++last_id; 256 return ++last_id;
257 } 257 }
258 258
259 void PluginChannel::OnClearSiteData(const std::string& site, 259 void PluginChannel::OnClearSiteData(const std::string& site,
260 uint64 flags, 260 uint64 flags,
261 base::Time begin_time) { 261 uint64 max_age) {
262 bool success = false; 262 bool success = false;
263 CommandLine* command_line = CommandLine::ForCurrentProcess(); 263 CommandLine* command_line = CommandLine::ForCurrentProcess();
264 FilePath path = command_line->GetSwitchValuePath(switches::kPluginPath); 264 FilePath path = command_line->GetSwitchValuePath(switches::kPluginPath);
265 scoped_refptr<webkit::npapi::PluginLib> plugin_lib( 265 scoped_refptr<webkit::npapi::PluginLib> plugin_lib(
266 webkit::npapi::PluginLib::CreatePluginLib(path)); 266 webkit::npapi::PluginLib::CreatePluginLib(path));
267 if (plugin_lib.get()) { 267 if (plugin_lib.get()) {
268 NPError err = plugin_lib->NP_Initialize(); 268 NPError err = plugin_lib->NP_Initialize();
269 if (err == NPERR_NO_ERROR) { 269 if (err == NPERR_NO_ERROR) {
270 const char* site_str = site.empty() ? NULL : site.c_str(); 270 const char* site_str = site.empty() ? NULL : site.c_str();
271 uint64 max_age;
272 if (begin_time > base::Time()) {
273 base::TimeDelta delta = base::Time::Now() - begin_time;
274 max_age = delta.InSeconds();
275 } else {
276 max_age = kuint64max;
277 }
278 err = plugin_lib->NP_ClearSiteData(site_str, flags, max_age); 271 err = plugin_lib->NP_ClearSiteData(site_str, flags, max_age);
279 std::string site_name = 272 std::string site_name =
280 site.empty() ? "NULL" 273 site.empty() ? "NULL"
281 : base::StringPrintf("\"%s\"", site_str); 274 : base::StringPrintf("\"%s\"", site_str);
282 VLOG(1) << "NPP_ClearSiteData(" << site_name << ", " << flags << ", " 275 VLOG(1) << "NPP_ClearSiteData(" << site_name << ", " << flags << ", "
283 << max_age << ") returned " << err; 276 << max_age << ") returned " << err;
284 success = (err == NPERR_NO_ERROR); 277 success = (err == NPERR_NO_ERROR);
285 } 278 }
286 } 279 }
287 Send(new PluginHostMsg_ClearSiteDataResult(success)); 280 Send(new PluginHostMsg_ClearSiteDataResult(success));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 bool PluginChannel::Init(base::MessageLoopProxy* ipc_message_loop, 320 bool PluginChannel::Init(base::MessageLoopProxy* ipc_message_loop,
328 bool create_pipe_now, 321 bool create_pipe_now,
329 base::WaitableEvent* shutdown_event) { 322 base::WaitableEvent* shutdown_event) {
330 if (!NPChannelBase::Init(ipc_message_loop, create_pipe_now, shutdown_event)) 323 if (!NPChannelBase::Init(ipc_message_loop, create_pipe_now, shutdown_event))
331 return false; 324 return false;
332 325
333 channel_->AddFilter(filter_.get()); 326 channel_->AddFilter(filter_.get());
334 return true; 327 return true;
335 } 328 }
336 329
OLDNEW
« no previous file with comments | « content/plugin/plugin_channel.h ('k') | content/ppapi_plugin/ppapi_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698