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

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

Issue 10825018: Add GetSitesWithData and FreeSiteList methods to PPP_Flash_BrowserOperations interface and hook the… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 4 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
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/sequenced_task_runner_helpers.h" 9 #include "base/sequenced_task_runner_helpers.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Balancing the AddRef call. 170 // Balancing the AddRef call.
171 Release(); 171 Release();
172 } 172 }
173 173
174 // IPC::Listener methods. 174 // IPC::Listener methods.
175 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { 175 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
176 IPC_BEGIN_MESSAGE_MAP(Context, message) 176 IPC_BEGIN_MESSAGE_MAP(Context, message)
177 IPC_MESSAGE_HANDLER(PluginHostMsg_ClearSiteDataResult, 177 IPC_MESSAGE_HANDLER(PluginHostMsg_ClearSiteDataResult,
178 OnClearSiteDataResult) 178 OnClearSiteDataResult)
179 IPC_MESSAGE_HANDLER(PpapiHostMsg_ClearSiteDataResult, 179 IPC_MESSAGE_HANDLER(PpapiHostMsg_ClearSiteDataResult,
180 OnClearSiteDataResult) 180 OnPpapiClearSiteDataResult)
181 IPC_MESSAGE_UNHANDLED_ERROR() 181 IPC_MESSAGE_UNHANDLED_ERROR()
182 IPC_END_MESSAGE_MAP() 182 IPC_END_MESSAGE_MAP()
183 183
184 return true; 184 return true;
185 } 185 }
186 186
187 virtual void OnChannelError() OVERRIDE { 187 virtual void OnChannelError() OVERRIDE {
188 if (is_removing_) { 188 if (is_removing_) {
189 NOTREACHED() << "Channel error"; 189 NOTREACHED() << "Channel error";
190 SignalDone(); 190 SignalDone();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // TODO(vtl): This "duplicates" logic in webkit/plugins/ppapi/file_path.cc 225 // TODO(vtl): This "duplicates" logic in webkit/plugins/ppapi/file_path.cc
226 // (which prepends the plugin name to the relative part of the path 226 // (which prepends the plugin name to the relative part of the path
227 // instead, with the absolute, profile-dependent part being enforced by 227 // instead, with the absolute, profile-dependent part being enforced by
228 // the browser). 228 // the browser).
229 #if defined(OS_WIN) 229 #if defined(OS_WIN)
230 FilePath plugin_data_path = 230 FilePath plugin_data_path =
231 profile_path.Append(FilePath(UTF8ToUTF16(plugin_name_))); 231 profile_path.Append(FilePath(UTF8ToUTF16(plugin_name_)));
232 #else 232 #else
233 FilePath plugin_data_path = profile_path.Append(FilePath(plugin_name_)); 233 FilePath plugin_data_path = profile_path.Append(FilePath(plugin_name_));
234 #endif 234 #endif
235 msg = new PpapiMsg_ClearSiteData(plugin_data_path, std::string(), 235 msg = new PpapiMsg_ClearSiteData(0u, plugin_data_path, std::string(),
236 kClearAllData, max_age); 236 kClearAllData, max_age);
237 } else { 237 } else {
238 msg = new PluginMsg_ClearSiteData(std::string(), kClearAllData, max_age); 238 msg = new PluginMsg_ClearSiteData(std::string(), kClearAllData, max_age);
239 } 239 }
240 if (!channel_->Send(msg)) { 240 if (!channel_->Send(msg)) {
241 NOTREACHED() << "Couldn't send ClearSiteData message"; 241 NOTREACHED() << "Couldn't send ClearSiteData message";
242 SignalDone(); 242 SignalDone();
243 return; 243 return;
244 } 244 }
245 } 245 }
246 246
247 // Handles the *HostMsg_ClearSiteDataResult message. 247 // Handles the PpapiHostMsg_ClearSiteDataResult message by delegating to the
248 // PluginHostMsg_ClearSiteDataResult handler.
249 void OnPpapiClearSiteDataResult(uint32 request_id, bool success) {
250 OnClearSiteDataResult(success);
251 }
252
253 // Handles the PluginHostMsg_ClearSiteDataResult message.
248 void OnClearSiteDataResult(bool success) { 254 void OnClearSiteDataResult(bool success) {
249 LOG_IF(ERROR, !success) << "ClearSiteData returned error"; 255 LOG_IF(ERROR, !success) << "ClearSiteData returned error";
250 UMA_HISTOGRAM_TIMES("ClearPluginData.time", 256 UMA_HISTOGRAM_TIMES("ClearPluginData.time",
251 base::Time::Now() - remove_start_time_); 257 base::Time::Now() - remove_start_time_);
252 SignalDone(); 258 SignalDone();
253 } 259 }
254 260
255 // Signals that we are finished with removing data (successful or not). This 261 // Signals that we are finished with removing data (successful or not). This
256 // method is safe to call multiple times. 262 // method is safe to call multiple times.
257 void SignalDone() { 263 void SignalDone() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 301
296 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving( 302 base::WaitableEvent* PluginDataRemoverImpl::StartRemoving(
297 base::Time begin_time) { 303 base::Time begin_time) {
298 DCHECK(!context_.get()); 304 DCHECK(!context_.get());
299 context_ = new Context(begin_time, browser_context_); 305 context_ = new Context(begin_time, browser_context_);
300 context_->Init(mime_type_); 306 context_->Init(mime_type_);
301 return context_->event(); 307 return context_->event();
302 } 308 }
303 309
304 } // namespace content 310 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698