summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorblundell <blundell@chromium.org>2015-09-29 01:04:41 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-29 08:05:23 +0000
commit71f7da5a323ce64e8bc5b3ff2a62fc60e3c71bd0 (patch)
tree618ccb0bd5934ebdcfc4a7f2339ec04ca5883250 /chrome
parentfda68e855c2cc1b51c583f8982af08b474906bbe (diff)
downloadchromium_src-71f7da5a323ce64e8bc5b3ff2a62fc60e3c71bd0.zip
chromium_src-71f7da5a323ce64e8bc5b3ff2a62fc60e3c71bd0.tar.gz
chromium_src-71f7da5a323ce64e8bc5b3ff2a62fc60e3c71bd0.tar.bz2
Move pref and switch in preparation for metrics componentization
Code will shortly be componentized into the metrics component that uses prefs::kMetricsReportingEnabled and switches::kForceFieldTrials. To enable that componentization, this CL does the following: - Moves prefs::kMetricsReportingEnabled into the metrics component. - Moves switches:kForceFieldTrials from //content to //base to enable it to be used both by //content and by the metrics component. BUG=508014 Review URL: https://codereview.chromium.org/1373823002 Cr-Commit-Position: refs/heads/master@{#351268}
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/android/preferences/pref_service_bridge.cc6
-rw-r--r--chrome/browser/browser_process_impl.cc7
-rw-r--r--chrome/browser/first_run/first_run_internal_posix.cc2
-rw-r--r--chrome/browser/metrics/chrome_metrics_service_accessor_unittest.cc2
-rw-r--r--chrome/browser/metrics/chrome_metrics_service_client.cc2
-rw-r--r--chrome/browser/metrics/metrics_reporting_state.cc4
-rw-r--r--chrome/browser/policy/configuration_policy_handler_list_factory.cc2
-rw-r--r--chrome/browser/prefs/tracked/pref_hash_browsertest.cc2
-rw-r--r--chrome/browser/profiles/profile_io_data.cc2
-rw-r--r--chrome/browser/ui/cocoa/first_run_dialog.mm2
-rw-r--r--chrome/browser/ui/views/first_run_dialog.cc2
-rw-r--r--chrome/browser/ui/views/session_crashed_bubble_view.cc6
-rw-r--r--chrome/common/pref_names.cc5
-rw-r--r--chrome/common/pref_names.h5
-rw-r--r--chrome/installer/util/uninstall_metrics.cc2
15 files changed, 21 insertions, 30 deletions
diff --git a/chrome/browser/android/preferences/pref_service_bridge.cc b/chrome/browser/android/preferences/pref_service_bridge.cc
index b1a54f1..963a006 100644
--- a/chrome/browser/android/preferences/pref_service_bridge.cc
+++ b/chrome/browser/android/preferences/pref_service_bridge.cc
@@ -462,20 +462,20 @@ static jboolean GetFullscreenAllowed(JNIEnv* env,
static jboolean GetMetricsReportingEnabled(JNIEnv* env,
const JavaParamRef<jobject>& obj) {
PrefService* local_state = g_browser_process->local_state();
- return local_state->GetBoolean(prefs::kMetricsReportingEnabled);
+ return local_state->GetBoolean(metrics::prefs::kMetricsReportingEnabled);
}
static void SetMetricsReportingEnabled(JNIEnv* env,
const JavaParamRef<jobject>& obj,
jboolean enabled) {
PrefService* local_state = g_browser_process->local_state();
- local_state->SetBoolean(prefs::kMetricsReportingEnabled, enabled);
+ local_state->SetBoolean(metrics::prefs::kMetricsReportingEnabled, enabled);
}
static jboolean HasSetMetricsReporting(JNIEnv* env,
const JavaParamRef<jobject>& obj) {
PrefService* local_state = g_browser_process->local_state();
- return local_state->HasPrefPath(prefs::kMetricsReportingEnabled);
+ return local_state->HasPrefPath(metrics::prefs::kMetricsReportingEnabled);
}
namespace {
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 02896d6..5a6d7fd 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -822,9 +822,8 @@ void BrowserProcessImpl::RegisterPrefs(PrefRegistrySimple* registry) {
std::string());
#endif // defined(OS_CHROMEOS)
#if !defined(OS_CHROMEOS)
- registry->RegisterBooleanPref(
- prefs::kMetricsReportingEnabled,
- GoogleUpdateSettings::GetCollectStatsConsent());
+ registry->RegisterBooleanPref(metrics::prefs::kMetricsReportingEnabled,
+ GoogleUpdateSettings::GetCollectStatsConsent());
#endif // !defined(OS_CHROMEOS)
#if defined(OS_ANDROID)
@@ -1006,7 +1005,7 @@ void BrowserProcessImpl::CreateLocalState() {
// whenever the preference or its controlling policy changes.
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
pref_change_registrar_.Add(
- prefs::kMetricsReportingEnabled,
+ metrics::prefs::kMetricsReportingEnabled,
base::Bind(&BrowserProcessImpl::ApplyMetricsReportingPolicy,
base::Unretained(this)));
#endif
diff --git a/chrome/browser/first_run/first_run_internal_posix.cc b/chrome/browser/first_run/first_run_internal_posix.cc
index 683b937..6e97dd8 100644
--- a/chrome/browser/first_run/first_run_internal_posix.cc
+++ b/chrome/browser/first_run/first_run_internal_posix.cc
@@ -38,7 +38,7 @@ void DoPostImportPlatformSpecificTasks(Profile* profile) {
// this is POSIX-specific).
if (GoogleUpdateSettings::GetCollectStatsConsent()) {
g_browser_process->local_state()->SetBoolean(
- prefs::kMetricsReportingEnabled, true);
+ metrics::prefs::kMetricsReportingEnabled, true);
}
#endif
}
diff --git a/chrome/browser/metrics/chrome_metrics_service_accessor_unittest.cc b/chrome/browser/metrics/chrome_metrics_service_accessor_unittest.cc
index dc70144..237539b 100644
--- a/chrome/browser/metrics/chrome_metrics_service_accessor_unittest.cc
+++ b/chrome/browser/metrics/chrome_metrics_service_accessor_unittest.cc
@@ -31,7 +31,7 @@ TEST_F(ChromeMetricsServiceAccessorTest, MetricsReportingEnabled) {
#if defined(OS_ANDROID)
const char* pref = prefs::kCrashReportingEnabled;
#else
- const char* pref = prefs::kMetricsReportingEnabled;
+ const char* pref = metrics::prefs::kMetricsReportingEnabled;
#endif // defined(OS_ANDROID)
GetLocalState()->SetDefaultPrefValue(pref, new base::FundamentalValue(false));
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.cc b/chrome/browser/metrics/chrome_metrics_service_client.cc
index e9858a6..a8cf6ef 100644
--- a/chrome/browser/metrics/chrome_metrics_service_client.cc
+++ b/chrome/browser/metrics/chrome_metrics_service_client.cc
@@ -113,7 +113,7 @@ bool IsCellularLogicEnabled() {
bool ShouldClearSavedMetrics() {
#if defined(OS_ANDROID)
PrefService* local_state = g_browser_process->local_state();
- return !local_state->HasPrefPath(prefs::kMetricsReportingEnabled) &&
+ return !local_state->HasPrefPath(metrics::prefs::kMetricsReportingEnabled) &&
variations::GetVariationParamValue("UMA_EnableCellularLogUpload",
"Enabled") == "true";
#else
diff --git a/chrome/browser/metrics/metrics_reporting_state.cc b/chrome/browser/metrics/metrics_reporting_state.cc
index 318766b..e9d658e 100644
--- a/chrome/browser/metrics/metrics_reporting_state.cc
+++ b/chrome/browser/metrics/metrics_reporting_state.cc
@@ -60,7 +60,7 @@ void SetMetricsReporting(bool to_update_pref,
}
#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
g_browser_process->local_state()->SetBoolean(
- prefs::kMetricsReportingEnabled, updated_pref);
+ metrics::prefs::kMetricsReportingEnabled, updated_pref);
#endif
// When a user opts in to the metrics reporting service, the previously
// collected data should be cleared to ensure that nothing is reported before
@@ -103,6 +103,6 @@ void InitiateMetricsReportingChange(
bool IsMetricsReportingUserChangable() {
const PrefService* pref_service = g_browser_process->local_state();
const PrefService::Preference* pref =
- pref_service->FindPreference(prefs::kMetricsReportingEnabled);
+ pref_service->FindPreference(metrics::prefs::kMetricsReportingEnabled);
return pref && !pref->IsManaged();
}
diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
index 0a90e51..cbb84b6 100644
--- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc
+++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
@@ -119,7 +119,7 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = {
prefs::kPrintPreviewDisabled,
base::Value::TYPE_BOOLEAN },
{ key::kMetricsReportingEnabled,
- prefs::kMetricsReportingEnabled,
+ metrics::prefs::kMetricsReportingEnabled,
base::Value::TYPE_BOOLEAN },
{ key::kApplicationLocaleValue,
prefs::kApplicationLocale,
diff --git a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc
index d11ba30..6df10cf 100644
--- a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc
+++ b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc
@@ -4,6 +4,7 @@
#include <string>
+#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
@@ -31,7 +32,6 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "components/search_engines/default_search_manager.h"
-#include "content/public/common/content_switches.h"
#include "extensions/browser/pref_names.h"
#include "extensions/common/extension.h"
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index ffc1d5f..57ca56c 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -887,7 +887,7 @@ void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() {
#else
// Prep the PrefMember and send it to the IO thread, since this value will be
// read from there.
- enable_metrics_.Init(prefs::kMetricsReportingEnabled,
+ enable_metrics_.Init(metrics::prefs::kMetricsReportingEnabled,
g_browser_process->local_state());
enable_metrics_.MoveToThread(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
diff --git a/chrome/browser/ui/cocoa/first_run_dialog.mm b/chrome/browser/ui/cocoa/first_run_dialog.mm
index f3a9503..b92fce9 100644
--- a/chrome/browser/ui/cocoa/first_run_dialog.mm
+++ b/chrome/browser/ui/cocoa/first_run_dialog.mm
@@ -87,7 +87,7 @@ bool ShowFirstRun(Profile* profile) {
// (which is likely to be forced in enterprise deployments anyway).
const PrefService::Preference* metrics_reporting_pref =
g_browser_process->local_state()->FindPreference(
- prefs::kMetricsReportingEnabled);
+ metrics::prefs::kMetricsReportingEnabled);
if (!metrics_reporting_pref || !metrics_reporting_pref->IsManaged()) {
base::scoped_nsobject<FirstRunDialogController> dialog(
[[FirstRunDialogController alloc] init]);
diff --git a/chrome/browser/ui/views/first_run_dialog.cc b/chrome/browser/ui/views/first_run_dialog.cc
index 2dc7e25..4c723d5 100644
--- a/chrome/browser/ui/views/first_run_dialog.cc
+++ b/chrome/browser/ui/views/first_run_dialog.cc
@@ -51,7 +51,7 @@ bool FirstRunDialog::Show(Profile* profile) {
// If the metrics reporting is managed, we won't ask.
const PrefService::Preference* metrics_reporting_pref =
g_browser_process->local_state()->FindPreference(
- prefs::kMetricsReportingEnabled);
+ metrics::prefs::kMetricsReportingEnabled);
if (!metrics_reporting_pref ||
!metrics_reporting_pref->IsManaged()) {
diff --git a/chrome/browser/ui/views/session_crashed_bubble_view.cc b/chrome/browser/ui/views/session_crashed_bubble_view.cc
index 5d16692..c40a497 100644
--- a/chrome/browser/ui/views/session_crashed_bubble_view.cc
+++ b/chrome/browser/ui/views/session_crashed_bubble_view.cc
@@ -179,8 +179,10 @@ void SessionCrashedBubbleView::ShowForReal(
#if defined(GOOGLE_CHROME_BUILD)
if (!uma_opted_in_already) {
- offer_uma_optin = g_browser_process->local_state()->FindPreference(
- prefs::kMetricsReportingEnabled)->IsUserModifiable();
+ offer_uma_optin =
+ g_browser_process->local_state()
+ ->FindPreference(metrics::prefs::kMetricsReportingEnabled)
+ ->IsUserModifiable();
}
#endif // defined(GOOGLE_CHROME_BUILD)
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 544da59..80e38bd 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -1254,11 +1254,6 @@ const char kSSLVersionFallbackMin[] = "ssl.version_fallback_min";
const char kCipherSuiteBlacklist[] = "ssl.cipher_suites.blacklist";
const char kDisableSSLRecordSplitting[] = "ssl.ssl_record_splitting.disabled";
-// Boolean that specifies whether or not crash reporting and metrics reporting
-// are sent over the network for analysis.
-const char kMetricsReportingEnabled[] =
- "user_experience_metrics.reporting_enabled";
-
// Boolean that specifies whether or not crash reports are sent
// over the network for analysis.
#if defined(OS_ANDROID)
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 2eae559..81c7566 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -431,11 +431,6 @@ extern const char kGLVendorString[];
extern const char kGLRendererString[];
extern const char kGLVersionString[];
-// For finding out whether metrics and crash reporting is enabled or not use
-// |ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()| instead
-// of reading platform specific prefs.
-extern const char kMetricsReportingEnabled[];
-
// Android has it's own metric / crash reporting implemented in Android
// Java code so kMetricsReportingEnabled doesn't make sense. We use this
// to inform crashes_ui that we have enabled crash reporting.
diff --git a/chrome/installer/util/uninstall_metrics.cc b/chrome/installer/util/uninstall_metrics.cc
index fe2ee43..fbd1b90 100644
--- a/chrome/installer/util/uninstall_metrics.cc
+++ b/chrome/installer/util/uninstall_metrics.cc
@@ -51,7 +51,7 @@ bool ExtractUninstallMetrics(const base::DictionaryValue& root,
// Make sure that the user wants us reporting metrics. If not, don't
// add our uninstall metrics.
bool metrics_reporting_enabled = false;
- if (!root.GetBoolean(prefs::kMetricsReportingEnabled,
+ if (!root.GetBoolean(metrics::prefs::kMetricsReportingEnabled,
&metrics_reporting_enabled) ||
!metrics_reporting_enabled) {
return false;