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

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

Issue 2671743002: Separate state of basic and advanced tab in CBD dialog (Closed)
Patch Set: fix .classpath file Created 3 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browsing_data_counter_utils.h" 5 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/browsing_data/cache_counter.h" 9 #include "chrome/browser/browsing_data/cache_counter.h"
10 #include "chrome/browser/browsing_data/media_licenses_counter.h" 10 #include "chrome/browser/browsing_data/media_licenses_counter.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 base::string16 GetChromeCounterTextFromResult( 55 base::string16 GetChromeCounterTextFromResult(
56 const browsing_data::BrowsingDataCounter::Result* result) { 56 const browsing_data::BrowsingDataCounter::Result* result) {
57 std::string pref_name = result->source()->GetPrefName(); 57 std::string pref_name = result->source()->GetPrefName();
58 58
59 if (!result->Finished()) { 59 if (!result->Finished()) {
60 // The counter is still counting. 60 // The counter is still counting.
61 return l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_CALCULATING); 61 return l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_CALCULATING);
62 } 62 }
63 63
64 if (pref_name == browsing_data::prefs::kDeleteCache) { 64 if (pref_name == browsing_data::prefs::kDeleteCache ||
65 pref_name == browsing_data::prefs::kDeleteCacheBasic) {
65 // Cache counter. 66 // Cache counter.
66 const auto* cache_result = 67 const auto* cache_result =
67 static_cast<const CacheCounter::CacheResult*>(result); 68 static_cast<const CacheCounter::CacheResult*>(result);
68 int64_t cache_size_bytes = cache_result->cache_size(); 69 int64_t cache_size_bytes = cache_result->cache_size();
69 bool is_upper_limit = cache_result->is_upper_limit(); 70 bool is_upper_limit = cache_result->is_upper_limit();
70 71
71 // Three cases: Nonzero result for the entire cache, nonzero result for 72 // Three cases: Nonzero result for the entire cache, nonzero result for
72 // a subset of cache (i.e. a finite time interval), and almost zero (< 1MB). 73 // a subset of cache (i.e. a finite time interval), and almost zero (< 1MB).
73 static const int kBytesInAMegabyte = 1024 * 1024; 74 static const int kBytesInAMegabyte = 1024 * 1024;
74 if (cache_size_bytes >= kBytesInAMegabyte) { 75 if (cache_size_bytes >= kBytesInAMegabyte) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return base::ReplaceStringPlaceholders( 126 return base::ReplaceStringPlaceholders(
126 l10n_util::GetPluralStringFUTF16( 127 l10n_util::GetPluralStringFUTF16(
127 IDS_DEL_HOSTED_APPS_COUNTER, hosted_apps_count), 128 IDS_DEL_HOSTED_APPS_COUNTER, hosted_apps_count),
128 replacements, 129 replacements,
129 nullptr); 130 nullptr);
130 } 131 }
131 #endif 132 #endif
132 133
133 return browsing_data::GetCounterTextFromResult(result); 134 return browsing_data::GetCounterTextFromResult(result);
134 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698