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

Unified Diff: chrome/browser/browsing_data_remover.cc

Issue 7210034: Update BrowsingDataRemover with the asynchronous CookieMonster API. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browsing_data_remover.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data_remover.cc
===================================================================
--- chrome/browser/browsing_data_remover.cc (revision 91122)
+++ chrome/browser/browsing_data_remover.cc (working copy)
@@ -7,6 +7,7 @@
#include <map>
#include <set>
+#include "base/bind.h"
#include "base/callback.h"
#include "base/file_util.h"
#include "base/platform_file.h"
@@ -78,6 +79,7 @@
waiting_for_clear_databases_(false),
waiting_for_clear_history_(false),
waiting_for_clear_networking_history_(false),
+ waiting_for_clear_cookies_(false),
waiting_for_clear_cache_(false),
waiting_for_clear_appcache_(false),
waiting_for_clear_gears_data_(false),
@@ -108,6 +110,7 @@
waiting_for_clear_databases_(false),
waiting_for_clear_history_(false),
waiting_for_clear_networking_history_(false),
+ waiting_for_clear_cookies_(false),
waiting_for_clear_cache_(false),
waiting_for_clear_appcache_(false),
waiting_for_clear_lso_data_(false),
@@ -203,8 +206,13 @@
cookie_monster = rq_context->DONTUSEME_GetCookieStore()->
GetCookieMonster();
}
- if (cookie_monster)
- cookie_monster->DeleteAllCreatedBetween(delete_begin_, delete_end_, true);
+ if (cookie_monster) {
+ waiting_for_clear_cookies_ = true;
+ cookie_monster->DeleteAllCreatedBetween(
+ delete_begin_, delete_end_, true,
+ base::Bind(&BrowsingDataRemover::OnCookiesDeleted,
+ base::Unretained(this)));
+ }
// REMOVE_COOKIES is actually "cookies and other site data" so we make sure
// to remove other data such local databases, STS state, etc. These only can
@@ -644,3 +652,16 @@
waiting_for_clear_lso_data_ = false;
NotifyAndDeleteIfDone();
}
+
+void BrowsingDataRemover::OnCookiesDeleted(int num_deleted) {
+ if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
erikwright (departed) 2011/07/04 16:47:33 The CookieStore guarantees invocation of callbacks
+ bool result = BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ NewRunnableMethod(this, &BrowsingDataRemover::OnCookiesDeleted,
+ num_deleted));
+ DCHECK(result);
+ return;
+ }
+ waiting_for_clear_cookies_ = false;
+ NotifyAndDeleteIfDone();
+}
« no previous file with comments | « chrome/browser/browsing_data_remover.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698