Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / browsing_data / browsing_data_quota_helper.cc
blob18939fbf6e18146fe2601259e1d4da302a67d750
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"
9 BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo()
10 : temporary_usage(0),
11 persistent_usage(0),
12 syncable_usage(0) {}
14 BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo(const std::string& host)
15 : host(host),
16 temporary_usage(0),
17 persistent_usage(0),
18 syncable_usage(0) {}
20 BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo(const std::string& host,
21 int64 temporary_usage,
22 int64 persistent_usage,
23 int64 syncable_usage)
24 : host(host),
25 temporary_usage(temporary_usage),
26 persistent_usage(persistent_usage),
27 syncable_usage(syncable_usage) {}
29 BrowsingDataQuotaHelper::QuotaInfo::~QuotaInfo() {}
31 // static
32 void BrowsingDataQuotaHelperDeleter::Destruct(
33 const BrowsingDataQuotaHelper* helper) {
34 helper->io_thread_->DeleteSoon(FROM_HERE, helper);
37 BrowsingDataQuotaHelper::BrowsingDataQuotaHelper(
38 base::MessageLoopProxy* io_thread)
39 : io_thread_(io_thread) {
42 BrowsingDataQuotaHelper::~BrowsingDataQuotaHelper() {
45 bool BrowsingDataQuotaHelper::QuotaInfo::operator <(
46 const BrowsingDataQuotaHelper::QuotaInfo& rhs) const {
47 if (this->host != rhs.host)
48 return this->host < rhs.host;
49 if (this->temporary_usage != rhs.temporary_usage)
50 return this->temporary_usage < rhs.temporary_usage;
51 if (this->syncable_usage != rhs.syncable_usage)
52 return this->syncable_usage < rhs.syncable_usage;
53 return this->persistent_usage < rhs.persistent_usage;
56 bool BrowsingDataQuotaHelper::QuotaInfo::operator ==(
57 const BrowsingDataQuotaHelper::QuotaInfo& rhs) const {
58 return this->host == rhs.host &&
59 this->temporary_usage == rhs.temporary_usage &&
60 this->persistent_usage == rhs.persistent_usage &&
61 this->syncable_usage == rhs.syncable_usage;