| Index: chrome/browser/browsing_data/cache_counter.cc
|
| diff --git a/chrome/browser/browsing_data/cache_counter.cc b/chrome/browser/browsing_data/cache_counter.cc
|
| index 557be8a39e14d9b52d2036af2657d79b13c30017..792768e49a07a365813d71cb7bd97cb67712b4ee 100644
|
| --- a/chrome/browser/browsing_data/cache_counter.cc
|
| +++ b/chrome/browser/browsing_data/cache_counter.cc
|
| @@ -9,6 +9,10 @@
|
| #include "content/public/browser/browser_thread.h"
|
| #include "net/base/net_errors.h"
|
|
|
| +#if defined(OS_ANDROID)
|
| +#include "chrome/browser/android/offline_pages/offline_page_utils.h"
|
| +#endif // OS_ANDROID
|
| +
|
| CacheCounter::CacheResult::CacheResult(const CacheCounter* source,
|
| int64_t cache_size,
|
| bool is_upper_limit)
|
| @@ -41,12 +45,34 @@ void CacheCounter::Count() {
|
| weak_ptr_factory_.GetWeakPtr()));
|
| }
|
|
|
| -void CacheCounter::OnCacheSizeCalculated(int64_t result_bytes,
|
| +void CacheCounter::OnCacheSizeCalculated(int64_t cache_bytes,
|
| bool is_upper_limit) {
|
| // A value less than 0 means a net error code.
|
| - if (result_bytes < 0)
|
| + if (cache_bytes < 0)
|
| + return;
|
| +
|
| +#if defined(OS_ANDROID)
|
| + if (offline_pages::OfflinePageUtils::GetCachedOfflinePageSizeBetween(
|
| + profile_,
|
| + base::Bind(&CacheCounter::OnOfflinePageSizeCalculated,
|
| + weak_ptr_factory_.GetWeakPtr(), cache_bytes,
|
| + is_upper_limit),
|
| + GetPeriodStart(), base::Time::Max())) {
|
| return;
|
| + }
|
| +#endif // OS_ANDROID
|
| auto result =
|
| - base::MakeUnique<CacheResult>(this, result_bytes, is_upper_limit);
|
| + base::MakeUnique<CacheResult>(this, cache_bytes, is_upper_limit);
|
| + ReportResult(std::move(result));
|
| +}
|
| +
|
| +#if defined(OS_ANDROID)
|
| +void CacheCounter::OnOfflinePageSizeCalculated(
|
| + int64_t cache_bytes,
|
| + bool is_upper_limit,
|
| + int64_t cached_offline_page_bytes) {
|
| + auto result = base::MakeUnique<CacheResult>(
|
| + this, cached_offline_page_bytes + cache_bytes, is_upper_limit);
|
| ReportResult(std::move(result));
|
| }
|
| +#endif // OS_ANDROID
|
|
|