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

Side by Side Diff: content/browser/plugin_data_remover_impl.cc

Issue 10202002: Fix ClearSiteData for Pepper Flash. (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 | « no previous file | no next file » | 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/browser/plugin_data_remover_impl.h" 5 #include "content/browser/plugin_data_remover_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
103 remove_start_time_ = base::Time::Now(); 103 remove_start_time_ = base::Time::Now();
104 is_removing_ = true; 104 is_removing_ = true;
105 // Balanced in On[Ppapi]ChannelOpened or OnError. Exactly one them will 105 // Balanced in On[Ppapi]ChannelOpened or OnError. Exactly one them will
106 // eventually be called, so we need to keep this object around until then. 106 // eventually be called, so we need to keep this object around until then.
107 AddRef(); 107 AddRef();
108 108
109 PepperPluginInfo* pepper_info = 109 PepperPluginInfo* pepper_info =
110 plugin_service->GetRegisteredPpapiPluginInfo(plugin_path); 110 plugin_service->GetRegisteredPpapiPluginInfo(plugin_path);
111 if (pepper_info) { 111 if (pepper_info) {
112 plugin_name_ = pepper_info->name;
112 // Use the broker since we run this function outside the sandbox. 113 // Use the broker since we run this function outside the sandbox.
113 plugin_service->OpenChannelToPpapiBroker(plugin_path, this); 114 plugin_service->OpenChannelToPpapiBroker(plugin_path, this);
114 } else { 115 } else {
115 plugin_service->OpenChannelToNpapiPlugin( 116 plugin_service->OpenChannelToNpapiPlugin(
116 0, 0, GURL(), GURL(), mime_type, this); 117 0, 0, GURL(), GURL(), mime_type, this);
117 } 118 }
118 } 119 }
119 120
120 // Called when a timeout happens in order not to block the client 121 // Called when a timeout happens in order not to block the client
121 // indefinitely. 122 // indefinitely.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 SignalDone(); 216 SignalDone();
216 return; 217 return;
217 } 218 }
218 219
219 uint64 max_age = begin_time_.is_null() ? 220 uint64 max_age = begin_time_.is_null() ?
220 std::numeric_limits<uint64>::max() : 221 std::numeric_limits<uint64>::max() :
221 (base::Time::Now() - begin_time_).InSeconds(); 222 (base::Time::Now() - begin_time_).InSeconds();
222 223
223 IPC::Message* msg; 224 IPC::Message* msg;
224 if (is_ppapi) { 225 if (is_ppapi) {
225 // Pass the path as 8-bit on all platforms.
226 FilePath profile_path = 226 FilePath profile_path =
227 PepperFileMessageFilter::GetDataDirName(browser_context_path_); 227 PepperFileMessageFilter::GetDataDirName(browser_context_path_);
228 // TODO(vtl): This "duplicates" logic in webkit/plugins/ppapi/file_path.cc
229 // (which prepends the plugin name to the relative part of the path
230 // instead, with the absolute, profile-dependent part being enforced by
231 // the browser).
228 #if defined(OS_WIN) 232 #if defined(OS_WIN)
229 std::string path_utf8 = UTF16ToUTF8(profile_path.value()); 233 FilePath plugin_data_path =
234 profile_path.Append(FilePath(UTF8ToUTF16(plugin_name_)));
230 #else 235 #else
231 const std::string& path_utf8 = profile_path.value(); 236 FilePath plugin_data_path = profile_path.Append(FilePath(plugin_name_));
232 #endif 237 #endif
233 msg = new PpapiMsg_ClearSiteData(profile_path, path_utf8, 238 msg = new PpapiMsg_ClearSiteData(plugin_data_path, std::string(),
234 kClearAllData, max_age); 239 kClearAllData, max_age);
235 } else { 240 } else {
236 msg = new PluginMsg_ClearSiteData(std::string(), kClearAllData, max_age); 241 msg = new PluginMsg_ClearSiteData(std::string(), kClearAllData, max_age);
237 } 242 }
238 if (!channel_->Send(msg)) { 243 if (!channel_->Send(msg)) {
239 NOTREACHED() << "Couldn't send ClearSiteData message"; 244 NOTREACHED() << "Couldn't send ClearSiteData message";
240 SignalDone(); 245 SignalDone();
241 return; 246 return;
242 } 247 }
243 } 248 }
(...skipping 23 matching lines...) Expand all
267 base::Time begin_time_; 272 base::Time begin_time_;
268 bool is_removing_; 273 bool is_removing_;
269 274
270 // Path for the current profile. Must be retrieved on the UI thread from the 275 // Path for the current profile. Must be retrieved on the UI thread from the
271 // browser context when we start so we can use it later on the I/O thread. 276 // browser context when we start so we can use it later on the I/O thread.
272 FilePath browser_context_path_; 277 FilePath browser_context_path_;
273 278
274 // The resource context for the profile. Use only on the I/O thread. 279 // The resource context for the profile. Use only on the I/O thread.
275 ResourceContext* resource_context_; 280 ResourceContext* resource_context_;
276 281
282 // The name of the plugin. Use only on the I/O thread.
283 std::string plugin_name_;
284
277 // The channel is NULL until we have opened a connection to the plug-in 285 // The channel is NULL until we have opened a connection to the plug-in
278 // process. 286 // process.
279 scoped_ptr<IPC::Channel> channel_; 287 scoped_ptr<IPC::Channel> channel_;
280 }; 288 };
281 289
282 290
283 PluginDataRemoverImpl::PluginDataRemoverImpl(BrowserContext* browser_context) 291 PluginDataRemoverImpl::PluginDataRemoverImpl(BrowserContext* browser_context)
284 : mime_type_(kFlashMimeType), 292 : mime_type_(kFlashMimeType),
285 browser_context_(browser_context) { 293 browser_context_(browser_context) {
286 } 294 }
287 295
288 PluginDataRemoverImpl::~PluginDataRemoverImpl() { 296 PluginDataRemoverImpl::~PluginDataRemoverImpl() {
289 } 297 }
290 298
291 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( 299 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving(
292 base::Time begin_time) { 300 base::Time begin_time) {
293 DCHECK(!context_.get()); 301 DCHECK(!context_.get());
294 context_ = new Context(begin_time, browser_context_); 302 context_ = new Context(begin_time, browser_context_);
295 context_->Init(mime_type_); 303 context_->Init(mime_type_);
296 return context_->event(); 304 return context_->event();
297 } 305 }
298 306
299 } // namespace content 307 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698