Home | History | Annotate | Download | only in browsing_data
      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.
      4 
      5 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h"
      6 
      7 #include "base/location.h"
      8 
      9 BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo()
     10     : temporary_usage(0),
     11       persistent_usage(0),
     12       syncable_usage(0) {}
     13 
     14 BrowsingDataQuotaHelper::QuotaInfo::QuotaInfo(const std::string& host)
     15     : host(host),
     16       temporary_usage(0),
     17       persistent_usage(0),
     18       syncable_usage(0) {}
     19 
     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) {}
     28 
     29 BrowsingDataQuotaHelper::QuotaInfo::~QuotaInfo() {}
     30 
     31 // static
     32 void BrowsingDataQuotaHelperDeleter::Destruct(
     33     const BrowsingDataQuotaHelper* helper) {
     34   helper->io_thread_->DeleteSoon(FROM_HERE, helper);
     35 }
     36 
     37 BrowsingDataQuotaHelper::BrowsingDataQuotaHelper(
     38     base::MessageLoopProxy* io_thread)
     39     : io_thread_(io_thread) {
     40 }
     41 
     42 BrowsingDataQuotaHelper::~BrowsingDataQuotaHelper() {
     43 }
     44 
     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;
     54 }
     55 
     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;
     62 }
     63