summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblundell <blundell@chromium.org>2015-09-29 05:33:35 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-29 12:34:30 +0000
commit6e85b7c0e44676ea410f7a21391e2f8e29a30afe (patch)
treead6be3593d19b6490dfbd9ba91309df1e17b932e
parentf81cb5b5fff8072bbf97b6e4d222cc46522604fc (diff)
downloadchromium_src-6e85b7c0e44676ea410f7a21391e2f8e29a30afe.zip
chromium_src-6e85b7c0e44676ea410f7a21391e2f8e29a30afe.tar.gz
chromium_src-6e85b7c0e44676ea410f7a21391e2f8e29a30afe.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 Committed: https://crrev.com/71f7da5a323ce64e8bc5b3ff2a62fc60e3c71bd0 Cr-Commit-Position: refs/heads/master@{#351268} Review URL: https://codereview.chromium.org/1373823002 Cr-Commit-Position: refs/heads/master@{#351294}
-rw-r--r--base/base_switches.cc10
-rw-r--r--base/base_switches.h1
-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.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
-rw-r--r--components/metrics/metrics_pref_names.cc5
-rw-r--r--components/metrics/metrics_pref_names.h5
-rw-r--r--content/public/common/content_switches.cc10
-rw-r--r--content/public/common/content_switches.h1
22 files changed, 43 insertions, 42 deletions
diff --git a/base/base_switches.cc b/base/base_switches.cc
index 7f3be7f..76827b8 100644
--- a/base/base_switches.cc
+++ b/base/base_switches.cc
@@ -23,6 +23,16 @@ const char kEnableLowEndDeviceMode[] = "enable-low-end-device-mode";
// Force disabling of low-end device mode when set.
const char kDisableLowEndDeviceMode[] = "disable-low-end-device-mode";
+// This option can be used to force field trials when testing changes locally.
+// The argument is a list of name and value pairs, separated by slashes. If a
+// trial name is prefixed with an asterisk, that trial will start activated.
+// For example, the following argument defines two trials, with the second one
+// activated: "GoogleNow/Enable/*MaterialDesignNTP/Default/" This option can
+// also be used by the browser process to send the list of trials to a
+// non-browser process, using the same format. See
+// FieldTrialList::CreateTrialsFromString() in field_trial.h for details.
+const char kForceFieldTrials[] = "force-fieldtrials";
+
// Suppresses all error dialogs when present.
const char kNoErrorDialogs[] = "noerrdialogs";
diff --git a/base/base_switches.h b/base/base_switches.h
index bbd590b..95f6bff 100644
--- a/base/base_switches.h
+++ b/base/base_switches.h
@@ -13,6 +13,7 @@ namespace switches {
extern const char kDisableBreakpad[];
extern const char kEnableCrashReporter[];
+extern const char kForceFieldTrials[];
extern const char kFullMemoryCrashReport[];
extern const char kEnableLowEndDeviceMode[];
extern const char kDisableLowEndDeviceMode[];
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.cc b/chrome/browser/metrics/chrome_metrics_service_accessor.cc
index 50ee2fa..89741bd 100644
--- a/chrome/browser/metrics/chrome_metrics_service_accessor.cc
+++ b/chrome/browser/metrics/chrome_metrics_service_accessor.cc
@@ -42,7 +42,7 @@ bool ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled() {
prefs::kCrashReportingEnabled);
#else
enabled = g_browser_process->local_state()->
- GetBoolean(prefs::kMetricsReportingEnabled);
+ GetBoolean(metrics::prefs::kMetricsReportingEnabled);
#endif // #if defined(OS_CHROMEOS)
#endif // defined(GOOGLE_CHROME_BUILD)
return enabled;
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;
diff --git a/components/metrics/metrics_pref_names.cc b/components/metrics/metrics_pref_names.cc
index 3cdebab..a5ad6a5 100644
--- a/components/metrics/metrics_pref_names.cc
+++ b/components/metrics/metrics_pref_names.cc
@@ -43,6 +43,11 @@ const char kMetricsOngoingLogs[] =
// client id and low entropy source should be reset.
const char kMetricsResetIds[] = "user_experience_metrics.reset_metrics_ids";
+// 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";
+
// Date/time when the user opted in to UMA and generated the client id for the
// very first time (local machine time, stored as a 64-bit time_t value).
const char kMetricsReportingEnabledTimestamp[] =
diff --git a/components/metrics/metrics_pref_names.h b/components/metrics/metrics_pref_names.h
index f4456a5..8118a59 100644
--- a/components/metrics/metrics_pref_names.h
+++ b/components/metrics/metrics_pref_names.h
@@ -17,6 +17,11 @@ extern const char kMetricsLowEntropySource[];
extern const char kMetricsMachineId[];
extern const char kMetricsOngoingLogs[];
extern const char kMetricsResetIds[];
+
+// For finding out whether metrics and crash reporting is enabled use
+// ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled() instead of
+// reading this pref directly.
+extern const char kMetricsReportingEnabled[];
extern const char kMetricsReportingEnabledTimestamp[];
extern const char kMetricsSessionID[];
extern const char kStabilityBreakpadRegistrationSuccess[];
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index b8dd4b2..d186a0b 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -494,16 +494,6 @@ const char kExplicitlyAllowedPorts[] = "explicitly-allowed-ports";
// Load NPAPI plugins from the specified directory.
const char kExtraPluginDir[] = "extra-plugin-dir";
-// This option can be used to force field trials when testing changes locally.
-// The argument is a list of name and value pairs, separated by slashes. If a
-// trial name is prefixed with an asterisk, that trial will start activated.
-// For example, the following argument defines two trials, with the second one
-// activated: "GoogleNow/Enable/*MaterialDesignNTP/Default/"
-// This option is also used by the browser to send the list of trials to
-// renderers, using the same format. See
-// FieldTrialList::CreateTrialsFromString() in field_trial.h for details.
-const char kForceFieldTrials[] = "force-fieldtrials";
-
// Always use the Skia GPU backend for drawing layer tiles. Only valid with GPU
// accelerated compositing + impl-side painting. Overrides the
// kEnableGpuRasterization flag.
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index 5886b7c..e5b00f0 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -148,7 +148,6 @@ CONTENT_EXPORT extern const char kEnableZeroCopy[];
CONTENT_EXPORT extern const char kExplicitlyAllowedPorts[];
CONTENT_EXPORT extern const char kExtraPluginDir[];
CONTENT_EXPORT extern const char kForceDisplayList2dCanvas[];
-CONTENT_EXPORT extern const char kForceFieldTrials[];
CONTENT_EXPORT extern const char kForceGpuRasterization[];
CONTENT_EXPORT extern const char kForceOverlayFullscreenVideo[];
CONTENT_EXPORT extern const char kForceRendererAccessibility[];