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
3 // found in the LICENSE file.
5 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h"
7 #include "base/location.h"
8 #include "base/single_thread_task_runner.h"
10 BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo() {}
12 BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo(const std::string
& host
)
15 BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo(const std::string
& host
,
16 int64 temporary_usage
,
17 int64 persistent_usage
,
20 temporary_usage(temporary_usage
),
21 persistent_usage(persistent_usage
),
22 syncable_usage(syncable_usage
) {}
24 BrowsingDataQuotaHelper::QuotaInfo::~QuotaInfo() {}
27 void BrowsingDataQuotaHelperDeleter::Destruct(
28 const BrowsingDataQuotaHelper
* helper
) {
29 helper
->io_thread_
->DeleteSoon(FROM_HERE
, helper
);
32 BrowsingDataQuotaHelper::BrowsingDataQuotaHelper(
33 base::SingleThreadTaskRunner
* io_thread
)
34 : io_thread_(io_thread
) {
37 BrowsingDataQuotaHelper::~BrowsingDataQuotaHelper() {
40 bool BrowsingDataQuotaHelper::QuotaInfo::operator <(
41 const BrowsingDataQuotaHelper::QuotaInfo
& rhs
) const {
42 if (this->host
!= rhs
.host
)
43 return this->host
< rhs
.host
;
44 if (this->temporary_usage
!= rhs
.temporary_usage
)
45 return this->temporary_usage
< rhs
.temporary_usage
;
46 if (this->syncable_usage
!= rhs
.syncable_usage
)
47 return this->syncable_usage
< rhs
.syncable_usage
;
48 return this->persistent_usage
< rhs
.persistent_usage
;
51 bool BrowsingDataQuotaHelper::QuotaInfo::operator ==(
52 const BrowsingDataQuotaHelper::QuotaInfo
& rhs
) const {
53 return this->host
== rhs
.host
&&
54 this->temporary_usage
== rhs
.temporary_usage
&&
55 this->persistent_usage
== rhs
.persistent_usage
&&
56 this->syncable_usage
== rhs
.syncable_usage
;