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

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

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month 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"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
14 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
15 #include "components/browsing_data/core/pref_names.h" 15 #include "components/browsing_data/core/pref_names.h"
16 #include "components/prefs/pref_service.h" 16 #include "components/prefs/pref_service.h"
17 #include "components/strings/grit/components_strings.h" 17 #include "components/strings/grit/components_strings.h"
18 #include "extensions/features/features.h"
18 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/text/bytes_formatting.h" 20 #include "ui/base/text/bytes_formatting.h"
20 21
21 #if defined(ENABLE_EXTENSIONS) 22 #if BUILDFLAG(ENABLE_EXTENSIONS)
22 #include "base/numerics/safe_conversions.h" 23 #include "base/numerics/safe_conversions.h"
23 #include "base/strings/string_util.h" 24 #include "base/strings/string_util.h"
24 #include "chrome/browser/browsing_data/hosted_apps_counter.h" 25 #include "chrome/browser/browsing_data/hosted_apps_counter.h"
25 #endif 26 #endif
26 27
27 bool AreCountersEnabled() { 28 bool AreCountersEnabled() {
28 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 29 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
29 switches::kEnableClearBrowsingDataCounters)) { 30 switches::kEnableClearBrowsingDataCounters)) {
30 return true; 31 return true;
31 } 32 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 static_cast<const MediaLicensesCounter::MediaLicenseResult*>(result); 91 static_cast<const MediaLicensesCounter::MediaLicenseResult*>(result);
91 if (media_license_result->Value() > 0) { 92 if (media_license_result->Value() > 0) {
92 return l10n_util::GetStringFUTF16( 93 return l10n_util::GetStringFUTF16(
93 IDS_DEL_MEDIA_LICENSES_COUNTER_SITE_COMMENT, 94 IDS_DEL_MEDIA_LICENSES_COUNTER_SITE_COMMENT,
94 base::UTF8ToUTF16(media_license_result->GetOneOrigin())); 95 base::UTF8ToUTF16(media_license_result->GetOneOrigin()));
95 } 96 }
96 return l10n_util::GetStringUTF16( 97 return l10n_util::GetStringUTF16(
97 IDS_DEL_MEDIA_LICENSES_COUNTER_GENERAL_COMMENT); 98 IDS_DEL_MEDIA_LICENSES_COUNTER_GENERAL_COMMENT);
98 } 99 }
99 100
100 #if defined(ENABLE_EXTENSIONS) 101 #if BUILDFLAG(ENABLE_EXTENSIONS)
101 if (pref_name == browsing_data::prefs::kDeleteHostedAppsData) { 102 if (pref_name == browsing_data::prefs::kDeleteHostedAppsData) {
102 // Hosted apps counter. 103 // Hosted apps counter.
103 const HostedAppsCounter::HostedAppsResult* hosted_apps_result = 104 const HostedAppsCounter::HostedAppsResult* hosted_apps_result =
104 static_cast<const HostedAppsCounter::HostedAppsResult*>(result); 105 static_cast<const HostedAppsCounter::HostedAppsResult*>(result);
105 int hosted_apps_count = hosted_apps_result->Value(); 106 int hosted_apps_count = hosted_apps_result->Value();
106 107
107 DCHECK_GE(hosted_apps_result->Value(), 108 DCHECK_GE(hosted_apps_result->Value(),
108 base::checked_cast<browsing_data::BrowsingDataCounter::ResultInt>( 109 base::checked_cast<browsing_data::BrowsingDataCounter::ResultInt>(
109 hosted_apps_result->examples().size())); 110 hosted_apps_result->examples().size()));
110 111
(...skipping 18 matching lines...) Expand all
129 return base::ReplaceStringPlaceholders( 130 return base::ReplaceStringPlaceholders(
130 l10n_util::GetPluralStringFUTF16( 131 l10n_util::GetPluralStringFUTF16(
131 IDS_DEL_HOSTED_APPS_COUNTER, hosted_apps_count), 132 IDS_DEL_HOSTED_APPS_COUNTER, hosted_apps_count),
132 replacements, 133 replacements,
133 nullptr); 134 nullptr);
134 } 135 }
135 #endif 136 #endif
136 137
137 return browsing_data::GetCounterTextFromResult(result); 138 return browsing_data::GetCounterTextFromResult(result);
138 } 139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698