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

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

Issue 2153863002: Move counters for passwords, history and autofill to components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@separate_build_targets_in_components_bd
Patch Set: Addressed comments Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/browsing_data/media_licenses_counter.h" 5 #include "chrome/browser/browsing_data/media_licenses_counter.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 MediaLicensesCounter::MediaLicenseResult::~MediaLicenseResult() {} 47 MediaLicensesCounter::MediaLicenseResult::~MediaLicenseResult() {}
48 48
49 const std::string& MediaLicensesCounter::MediaLicenseResult::GetOneOrigin() 49 const std::string& MediaLicensesCounter::MediaLicenseResult::GetOneOrigin()
50 const { 50 const {
51 return one_origin_; 51 return one_origin_;
52 } 52 }
53 53
54 MediaLicensesCounter::MediaLicensesCounter(Profile* profile) 54 MediaLicensesCounter::MediaLicensesCounter(Profile* profile)
55 : BrowsingDataCounter(browsing_data::prefs::kDeleteMediaLicenses), 55 : profile_(profile),
56 profile_(profile),
57 weak_ptr_factory_(this) {} 56 weak_ptr_factory_(this) {}
58 57
59 MediaLicensesCounter::~MediaLicensesCounter() {} 58 MediaLicensesCounter::~MediaLicensesCounter() {}
60 59
60 const char* MediaLicensesCounter::GetPrefName() const {
61 return browsing_data::prefs::kDeleteMediaLicenses;
62 }
63
61 void MediaLicensesCounter::Count() { 64 void MediaLicensesCounter::Count() {
62 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 65 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
63 scoped_refptr<storage::FileSystemContext> filesystem_context = 66 scoped_refptr<storage::FileSystemContext> filesystem_context =
64 make_scoped_refptr( 67 make_scoped_refptr(
65 content::BrowserContext::GetDefaultStoragePartition(profile_) 68 content::BrowserContext::GetDefaultStoragePartition(profile_)
66 ->GetFileSystemContext()); 69 ->GetFileSystemContext());
67 base::PostTaskAndReplyWithResult( 70 base::PostTaskAndReplyWithResult(
68 filesystem_context->default_file_task_runner(), FROM_HERE, 71 filesystem_context->default_file_task_runner(), FROM_HERE,
69 base::Bind(&CountOriginsOnFileTaskRunner, 72 base::Bind(&CountOriginsOnFileTaskRunner,
70 base::RetainedRef(filesystem_context)), 73 base::RetainedRef(filesystem_context)),
71 base::Bind(&MediaLicensesCounter::OnContentLicensesObtained, 74 base::Bind(&MediaLicensesCounter::OnContentLicensesObtained,
72 weak_ptr_factory_.GetWeakPtr())); 75 weak_ptr_factory_.GetWeakPtr()));
73 } 76 }
74 77
75 void MediaLicensesCounter::OnContentLicensesObtained( 78 void MediaLicensesCounter::OnContentLicensesObtained(
76 const std::set<GURL>& origins) { 79 const std::set<GURL>& origins) {
77 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 80 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
78 ReportResult(base::WrapUnique(new MediaLicenseResult(this, origins))); 81 ReportResult(base::WrapUnique(new MediaLicenseResult(this, origins)));
79 } 82 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/media_licenses_counter.h ('k') | chrome/browser/browsing_data/passwords_counter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698