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

Side by Side Diff: chrome/browser/browsing_data/cookie_counter.cc

Issue 2594723002: Count number of origins with data affected by clearing "cookies and site data". (Closed)
Patch Set: Add comments for issues with incomplete data deletion Created 3 years, 11 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
OLDNEW
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
msramek 2017/01/09 12:54:43 Ditto.
dullweber 2017/01/09 16:05:46 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/browsing_data/cookie_counter.h"
6
7 #include "chrome/browser/browsing_data/cookie_counting_helper.h"
8 #include "components/browsing_data/core/pref_names.h"
9 #include "content/public/browser/browser_thread.h"
10
11 using content::BrowserThread;
12
13 CookieCounter::CookieCounter(Profile* profile)
14 : profile_(profile), weak_ptr_factory_(this) {}
15
16 CookieCounter::~CookieCounter() {}
17
18 const char* CookieCounter::GetPrefName() const {
19 return browsing_data::prefs::kDeleteCookies;
20 }
21
22 void CookieCounter::Count() {
23 base::Time begin = GetPeriodStart();
24 auto done_callback =
25 base::Bind(&CookieCounter::Done, weak_ptr_factory_.GetWeakPtr());
26 // Use a helper class that owns itself to avoid issues when CookieCounter is
27 // deleted before counting finished.
28 auto helper = new CookieCountingHelper(profile_, begin, done_callback);
29 helper->CountAndDestroySelfWhenFinished();
30 }
31
32 void CookieCounter::Done(int origin_count) {
33 DCHECK_CURRENTLY_ON(BrowserThread::UI);
34 ReportResult(origin_count);
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698