summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-27 18:20:49 +0000
committerpastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-27 18:20:49 +0000
commit9f63d0d5410bfac775371c29715093ec63f4b1d6 (patch)
treeb121d7959c4ec28a3e4a088cb45edb02207d855e
parentf6fc8f2042c5b00b142a9a77acb3b4b8dd75a576 (diff)
downloadchromium_src-9f63d0d5410bfac775371c29715093ec63f4b1d6.zip
chromium_src-9f63d0d5410bfac775371c29715093ec63f4b1d6.tar.gz
chromium_src-9f63d0d5410bfac775371c29715093ec63f4b1d6.tar.bz2
Rewire the metrics pref to the signed settings store on chromeos.
It used to check the consent file "Consent To Send Stats" which is insecure and does not respect cloud policies. The file is still used but only to store the install GUID. BUG=chromium-os:15188 TEST=Manually - set the policy on the server and verify that the UI reacts correctly. Also the owner should be able to change it. Review URL: http://codereview.chromium.org/7480040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94322 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser_main.cc7
-rw-r--r--chrome/browser/chromeos/login/signed_settings.cc26
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc28
-rw-r--r--chrome/browser/chromeos/metrics_cros_settings_provider.cc83
-rw-r--r--chrome/browser/chromeos/metrics_cros_settings_provider.h39
-rw-r--r--chrome/browser/chromeos/user_cros_settings_provider.cc34
-rw-r--r--chrome/browser/chromeos/user_cros_settings_provider.h2
-rw-r--r--chrome/browser/ui/webui/crashes_ui.cc4
-rw-r--r--chrome/browser/ui/webui/options/chromeos/stats_options_handler.cc26
-rw-r--r--chrome/browser/ui/webui/options/chromeos/stats_options_handler.h4
-rw-r--r--chrome/chrome_browser.gypi2
11 files changed, 89 insertions, 166 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 09dd75c..f798e6d 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -138,6 +138,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/boot_times_loader.h"
#include "chrome/browser/chromeos/brightness_observer.h"
+#include "chrome/browser/chromeos/cros_settings_names.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/screen_lock_library.h"
#include "chrome/browser/chromeos/customization_document.h"
@@ -147,9 +148,9 @@
#include "chrome/browser/chromeos/login/ownership_service.h"
#include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/login/user_manager.h"
-#include "chrome/browser/chromeos/metrics_cros_settings_provider.h"
#include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h"
#include "chrome/browser/chromeos/system_key_event_listener.h"
+#include "chrome/browser/chromeos/user_cros_settings_provider.h"
#include "chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h"
#include "chrome/browser/oom_priority_manager.h"
#include "chrome/browser/ui/views/browser_dialogs.h"
@@ -618,7 +619,7 @@ MetricsService* BrowserMainParts::InitializeMetrics(
// non-official builds.
#if defined(GOOGLE_CHROME_BUILD)
#if defined(OS_CHROMEOS)
- bool enabled = chromeos::MetricsCrosSettingsProvider::GetMetricsStatus();
+ bool enabled = chromeos::UserCrosSettingsProvider::cached_reporting_enabled();
#else
bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled);
#endif // #if defined(OS_CHROMEOS)
@@ -1247,7 +1248,7 @@ bool IsCrashReportingEnabled(const PrefService* local_state) {
chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE;
bool breakpad_enabled =
!(is_guest_session && is_stable_channel) &&
- chromeos::MetricsCrosSettingsProvider::GetMetricsStatus();
+ chromeos::UserCrosSettingsProvider::cached_reporting_enabled();
if (!breakpad_enabled)
breakpad_enabled = getenv(env_vars::kHeadless) != NULL;
#else
diff --git a/chrome/browser/chromeos/login/signed_settings.cc b/chrome/browser/chromeos/login/signed_settings.cc
index 3330906..9bc98b8 100644
--- a/chrome/browser/chromeos/login/signed_settings.cc
+++ b/chrome/browser/chromeos/login/signed_settings.cc
@@ -634,6 +634,10 @@ void StorePropertyOp::SetInPolicy(const std::string& prop,
em::ReleaseChannelProto* release_channel = pol.mutable_release_channel();
release_channel->set_release_channel(value);
+ } else if (prop == kStatsReportingPref) {
+ em::MetricsEnabledProto* metrics = pol.mutable_metrics_enabled();
+ metrics->set_metrics_enabled(value == "true");
+
} else {
NOTREACHED();
}
@@ -732,36 +736,48 @@ std::string RetrievePropertyOp::LookUpInPolicy(const std::string& prop) {
} else if (prop == kAccountsPrefAllowGuest) {
if (!pol.has_guest_mode_enabled() ||
- !pol.guest_mode_enabled().has_guest_mode_enabled())
+ !pol.guest_mode_enabled().has_guest_mode_enabled()) {
return kVeritas[1]; // Default to allowing guests;
+ }
return kVeritas[pol.guest_mode_enabled().guest_mode_enabled()];
} else if (prop == kAccountsPrefShowUserNamesOnSignIn) {
if (!pol.has_show_user_names() ||
- !pol.show_user_names().has_show_user_names())
+ !pol.show_user_names().has_show_user_names()) {
return kVeritas[1]; // Default to showing pods on the login screen;
+ }
return kVeritas[pol.show_user_names().show_user_names()];
} else if (prop == kSignedDataRoamingEnabled) {
if (!pol.has_data_roaming_enabled() ||
- !pol.data_roaming_enabled().has_data_roaming_enabled())
+ !pol.data_roaming_enabled().has_data_roaming_enabled()) {
return kVeritas[0]; // Default to disabling cellular data roaming;
+ }
return kVeritas[pol.data_roaming_enabled().data_roaming_enabled()];
} else if (prop == kSettingProxyEverywhere) {
// TODO(cmasone): NOTIMPLEMENTED() once http://crosbug.com/13052 is fixed.
std::string serialized;
if (!pol.has_device_proxy_settings() ||
- !pol.device_proxy_settings().SerializeToString(&serialized))
+ !pol.device_proxy_settings().SerializeToString(&serialized)) {
return ""; // Default to invalid proxy config (will be ignored).
+ }
return serialized;
} else if (prop == kReleaseChannel) {
if (!pol.has_release_channel() ||
- !pol.release_channel().has_release_channel())
+ !pol.release_channel().has_release_channel()) {
return ""; // Default to an invalid channel (will be ignored).
+ }
return pol.release_channel().release_channel();
+ } else if (prop == kStatsReportingPref) {
+ if (!pol.has_metrics_enabled() ||
+ !pol.metrics_enabled().metrics_enabled()) {
+ return kVeritas[0]; // Default to not collecting metrics.
+ }
+ return kVeritas[pol.metrics_enabled().metrics_enabled()];
+
}
return std::string();
}
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index c47349b..3cdebb7 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -16,6 +16,7 @@
#include "base/logging.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/cros_settings_names.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/cryptohome_library.h"
#include "chrome/browser/chromeos/customization_document.h"
@@ -30,19 +31,24 @@
#include "chrome/browser/chromeos/login/network_screen.h"
#include "chrome/browser/chromeos/login/oobe_display.h"
#include "chrome/browser/chromeos/login/registration_screen.h"
+#include "chrome/browser/chromeos/login/signed_settings_temp_storage.h"
#include "chrome/browser/chromeos/login/update_screen.h"
#include "chrome/browser/chromeos/login/user_image_screen.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/login/wizard_accessibility_helper.h"
-#include "chrome/browser/chromeos/metrics_cros_settings_provider.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/options/options_util.h"
#include "chrome/common/pref_names.h"
#include "content/common/content_notification_types.h"
#include "content/common/notification_service.h"
#include "ui/base/l10n/l10n_util.h"
#include "views/accelerator.h"
+#if defined(USE_LINUX_BREAKPAD)
+#include "chrome/app/breakpad_linux.h"
+#endif
+
namespace {
// A boolean pref of the EULA accepted flag.
@@ -378,8 +384,24 @@ void WizardController::OnUpdateCompleted() {
void WizardController::OnEulaAccepted() {
MarkEulaAccepted();
- chromeos::MetricsCrosSettingsProvider::SetMetricsStatus(
- usage_statistics_reporting_);
+ // TODO(pastarmovj): Make this code cache the value for the pref in a better
+ // way until we can store it in the policy blob. See explanation below:
+ // At this point we can not write this in the signed settings pref blob.
+ // But we can at least create the consent file and Chrome would port that
+ // if the device is owned by a local user. In case of enterprise enrolled
+ // device the setting will be respected only until the policy is not set.
+ SignedSettingsTempStorage::Store(
+ kStatsReportingPref,
+ (usage_statistics_reporting_ ? "true" : "false"),
+ g_browser_process->local_state());
+ bool enabled =
+ OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_);
+ if (enabled) {
+#if defined(USE_LINUX_BREAKPAD)
+ InitCrashReporter();
+#endif
+ }
+
InitiateOOBEUpdate();
}
diff --git a/chrome/browser/chromeos/metrics_cros_settings_provider.cc b/chrome/browser/chromeos/metrics_cros_settings_provider.cc
deleted file mode 100644
index f9edb24..0000000
--- a/chrome/browser/chromeos/metrics_cros_settings_provider.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/chromeos/metrics_cros_settings_provider.h"
-
-#include "base/string_util.h"
-#include "base/threading/thread_restrictions.h"
-#include "base/values.h"
-#include "chrome/browser/chromeos/cros_settings.h"
-#include "chrome/browser/chromeos/cros_settings_names.h"
-#include "chrome/browser/chromeos/login/user_manager.h"
-#include "chrome/browser/ui/options/options_util.h"
-#include "chrome/installer/util/google_update_settings.h"
-
-#if defined(USE_LINUX_BREAKPAD)
-#include "chrome/app/breakpad_linux.h"
-#endif
-
-namespace chromeos {
-
-void MetricsCrosSettingsProvider::DoSet(const std::string& path,
- Value* value) {
- DCHECK(path == kStatsReportingPref);
- bool enabled = false;
- CHECK(value->GetAsBoolean(&enabled));
- if (SetMetricsStatus(enabled)) {
- CrosSettings::Get()->FireObservers(path.c_str());
- }
-}
-
-bool MetricsCrosSettingsProvider::Get(const std::string& path,
- Value** value) const {
- DCHECK(path == kStatsReportingPref);
- *value = Value::CreateBooleanValue(GetMetricsStatus());
- return true;
-}
-
-// static
-bool MetricsCrosSettingsProvider::SetMetricsStatus(bool enabled) {
- // We must be not logged in (on EULA page) or logged is as an owner to be able
- // to modify the setting.
- UserManager *user = UserManager::Get();
- if (user->user_is_logged_in() && !user->current_user_is_owner())
- return false;
- VLOG(1) << "Setting cros stats/crash metric reporting to " << enabled;
- bool collect_stats_consent = false;
- {
- // Loading consent file state causes us to do blocking IO on UI thread.
- // Temporarily allow it until we fix http://crbug.com/62626
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- collect_stats_consent = GoogleUpdateSettings::GetCollectStatsConsent();
- }
- if (enabled != collect_stats_consent) {
- bool new_enabled = OptionsUtil::ResolveMetricsReportingEnabled(enabled);
-#if defined(USE_LINUX_BREAKPAD)
- if (new_enabled)
- InitCrashReporter();
- // Else, if (!new_enabled), we should have turned crash reporting off
- // here, but there is no API for that currently (while we use
- // BreakPad). But this is not a big deal: crash reporting will be off
- // after reboot for the current process while other Chrome processes
- // will start when the setting is already set up. Other ChromeOS
- // processes does not use BreakPad.
-#endif
- return new_enabled == enabled;
- }
- return false;
-}
-
-// static
-bool MetricsCrosSettingsProvider::GetMetricsStatus() {
- // Loading consent file state causes us to do blocking IO on UI thread.
- // Temporarily allow it until we fix http://crbug.com/62626
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- return GoogleUpdateSettings::GetCollectStatsConsent();
-}
-
-bool MetricsCrosSettingsProvider::HandlesSetting(const std::string& path) {
- return ::StartsWithASCII(path, kStatsReportingPref, true);
-}
-
-}; // namespace chromeos
diff --git a/chrome/browser/chromeos/metrics_cros_settings_provider.h b/chrome/browser/chromeos/metrics_cros_settings_provider.h
deleted file mode 100644
index cdb918e..0000000
--- a/chrome/browser/chromeos/metrics_cros_settings_provider.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_CHROMEOS_METRICS_CROS_SETTINGS_PROVIDER_H_
-#define CHROME_BROWSER_CHROMEOS_METRICS_CROS_SETTINGS_PROVIDER_H_
-#pragma once
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "chrome/browser/chromeos/cros_settings_provider.h"
-
-namespace chromeos {
-
-// CrosSettingsProvider that abstracts switching of stats/crash
-// reporting to Google.
-class MetricsCrosSettingsProvider : public CrosSettingsProvider {
- public:
- MetricsCrosSettingsProvider() {}
-
- // Actual methods to control stats/crash reporting. Currently these
- // methods are public and static so they are accessible directly
- // from cros code. But this will change soon: crosbug.com/7359
- static bool SetMetricsStatus(bool enabled);
- static bool GetMetricsStatus();
-
- private:
- // CrosSettingsProvider implementation.
- virtual void DoSet(const std::string& path, base::Value* value);
- virtual bool Get(const std::string& path, base::Value** value) const;
- virtual bool HandlesSetting(const std::string& path);
-
- DISALLOW_COPY_AND_ASSIGN(MetricsCrosSettingsProvider);
-};
-
-}; // namespace chromeos
-
-#endif // CHROME_BROWSER_CHROMEOS_METRICS_CROS_SETTINGS_PROVIDER_H_
diff --git a/chrome/browser/chromeos/user_cros_settings_provider.cc b/chrome/browser/chromeos/user_cros_settings_provider.cc
index 21f1809..a79d32a0 100644
--- a/chrome/browser/chromeos/user_cros_settings_provider.cc
+++ b/chrome/browser/chromeos/user_cros_settings_provider.cc
@@ -24,6 +24,8 @@
#include "chrome/browser/policy/browser_policy_connector.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
+#include "chrome/browser/ui/options/options_util.h"
+#include "chrome/installer/util/google_update_settings.h"
#include "content/browser/browser_thread.h"
namespace chromeos {
@@ -42,6 +44,7 @@ const char* kBooleanSettings[] = {
kAccountsPrefAllowGuest,
kAccountsPrefShowUserNamesOnSignIn,
kSignedDataRoamingEnabled,
+ kStatsReportingPref
};
const char* kStringSettings[] = {
@@ -60,7 +63,8 @@ bool IsControlledBooleanSetting(const std::string& pref_path) {
return (pref_path == kAccountsPrefAllowNewUser) ||
(pref_path == kAccountsPrefAllowGuest) ||
(pref_path == kAccountsPrefShowUserNamesOnSignIn) ||
- (pref_path == kSignedDataRoamingEnabled);
+ (pref_path == kSignedDataRoamingEnabled) ||
+ (pref_path == kStatsReportingPref);
}
bool IsControlledStringSetting(const std::string& pref_path) {
@@ -82,7 +86,8 @@ void RegisterSetting(PrefService* local_state, const std::string& pref_path) {
false,
PrefService::UNSYNCABLE_PREF);
if (IsControlledBooleanSetting(pref_path)) {
- if (pref_path == kSignedDataRoamingEnabled)
+ if (pref_path == kSignedDataRoamingEnabled ||
+ pref_path == kStatsReportingPref)
local_state->RegisterBooleanPref(pref_path.c_str(),
false,
PrefService::UNSYNCABLE_PREF);
@@ -286,6 +291,10 @@ class UserCrosSettingsTrust : public SignedSettingsHelper::Callback {
NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
cros->SetCellularDataRoamingAllowed(new_value);
+ } else if (path == kStatsReportingPref) {
+ // TODO(pastarmovj): Remove this once we don't need to regenerate the
+ // consent file for the GUID anymore.
+ OptionsUtil::ResolveMetricsReportingEnabled(new_value);
}
}
@@ -305,6 +314,13 @@ class UserCrosSettingsTrust : public SignedSettingsHelper::Callback {
if (device_value != new_value)
cros->SetCellularDataRoamingAllowed(new_value);
}
+ } else if (path == kStatsReportingPref) {
+ bool stats_consent = (use_value == USE_VALUE_SUPPLIED) ? value : false;
+ // TODO(pastarmovj): Remove this once we don't need to regenerate the
+ // consent file for the GUID anymore.
+ VLOG(1) << "Metrics policy is being set to : " << stats_consent
+ << "(reason : " << use_value << ")";
+ OptionsUtil::ResolveMetricsReportingEnabled(stats_consent);
}
}
@@ -488,6 +504,11 @@ bool UserCrosSettingsProvider::RequestTrustedOwner(Task* callback) {
kDeviceOwner, callback);
}
+bool UserCrosSettingsProvider::RequestTrustedReportingEnabled(Task* callback) {
+ return UserCrosSettingsTrust::GetInstance()->RequestTrustedEntity(
+ kStatsReportingPref, callback);
+}
+
void UserCrosSettingsProvider::Reload() {
UserCrosSettingsTrust::GetInstance()->Reload();
}
@@ -524,6 +545,14 @@ bool UserCrosSettingsProvider::cached_show_users_on_signin() {
}
// static
+bool UserCrosSettingsProvider::cached_reporting_enabled() {
+ // Trigger prefetching if singleton object still does not exist.
+ UserCrosSettingsTrust::GetInstance();
+ return g_browser_process->local_state()->GetBoolean(
+ kStatsReportingPref);
+}
+
+// static
const ListValue* UserCrosSettingsProvider::cached_whitelist() {
PrefService* prefs = g_browser_process->local_state();
const ListValue* cached_users = prefs->GetList(kAccountsPrefUsers);
@@ -597,6 +626,7 @@ bool UserCrosSettingsProvider::Get(const std::string& path,
bool UserCrosSettingsProvider::HandlesSetting(const std::string& path) {
return ::StartsWithASCII(path, "cros.accounts.", true) ||
::StartsWithASCII(path, "cros.signed.", true) ||
+ ::StartsWithASCII(path, "cros.metrics.", true) ||
path == kReleaseChannel;
}
diff --git a/chrome/browser/chromeos/user_cros_settings_provider.h b/chrome/browser/chromeos/user_cros_settings_provider.h
index 901218f..b4d1363 100644
--- a/chrome/browser/chromeos/user_cros_settings_provider.h
+++ b/chrome/browser/chromeos/user_cros_settings_provider.h
@@ -42,6 +42,7 @@ class UserCrosSettingsProvider : public CrosSettingsProvider {
bool RequestTrustedDataRoamingEnabled(Task* callback);
bool RequestTrustedShowUsersOnSignin(Task* callback);
bool RequestTrustedOwner(Task* callback);
+ bool RequestTrustedReportingEnabled(Task* callback);
// Reloads values from device settings.
void Reload();
@@ -51,6 +52,7 @@ class UserCrosSettingsProvider : public CrosSettingsProvider {
static bool cached_allow_new_user();
static bool cached_data_roaming_enabled();
static bool cached_show_users_on_signin();
+ static bool cached_reporting_enabled();
static const base::ListValue* cached_whitelist();
static std::string cached_owner();
diff --git a/chrome/browser/ui/webui/crashes_ui.cc b/chrome/browser/ui/webui/crashes_ui.cc
index f137b3b..c5e7fc3 100644
--- a/chrome/browser/ui/webui/crashes_ui.cc
+++ b/chrome/browser/ui/webui/crashes_ui.cc
@@ -28,7 +28,7 @@
#include "ui/base/resource/resource_bundle.h"
#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/metrics_cros_settings_provider.h"
+#include "chrome/browser/chromeos/user_cros_settings_provider.h"
#endif
namespace {
@@ -175,7 +175,7 @@ bool CrashesUI::CrashReportingEnabled() {
PrefService* prefs = g_browser_process->local_state();
return prefs->GetBoolean(prefs::kMetricsReportingEnabled);
#elif defined(GOOGLE_CHROME_BUILD) && defined(OS_CHROMEOS)
- return chromeos::MetricsCrosSettingsProvider::GetMetricsStatus();
+ return chromeos::UserCrosSettingsProvider::cached_reporting_enabled();
#else
return false;
#endif
diff --git a/chrome/browser/ui/webui/options/chromeos/stats_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/stats_options_handler.cc
index 30a1030..dbd4dfc 100644
--- a/chrome/browser/ui/webui/options/chromeos/stats_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/stats_options_handler.cc
@@ -4,27 +4,24 @@
#include "chrome/browser/ui/webui/options/chromeos/stats_options_handler.h"
-#include "base/basictypes.h"
#include "base/callback.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "chrome/browser/chromeos/cros_settings_names.h"
-#include "chrome/browser/chromeos/login/user_manager.h"
-#include "chrome/browser/chromeos/metrics_cros_settings_provider.h"
+#include "chrome/browser/chromeos/user_cros_settings_provider.h"
#include "content/browser/user_metrics.h"
namespace chromeos {
StatsOptionsHandler::StatsOptionsHandler()
- : CrosOptionsPageUIHandler(new MetricsCrosSettingsProvider()) {
+ : CrosOptionsPageUIHandler(new UserCrosSettingsProvider) {
}
// OptionsPageUIHandler implementation.
void StatsOptionsHandler::GetLocalizedValues(
DictionaryValue* localized_strings) {
}
+
void StatsOptionsHandler::Initialize() {
- SetupMetricsReportingCheckbox(false);
}
// WebUIMessageHandler implementation.
@@ -34,10 +31,6 @@ void StatsOptionsHandler::RegisterMessages() {
NewCallback(this, &StatsOptionsHandler::HandleMetricsReportingCheckbox));
}
-MetricsCrosSettingsProvider* StatsOptionsHandler::provider() const {
- return static_cast<MetricsCrosSettingsProvider*>(settings_provider_.get());
-}
-
void StatsOptionsHandler::HandleMetricsReportingCheckbox(
const ListValue* args) {
#if defined(GOOGLE_CHROME_BUILD)
@@ -47,19 +40,6 @@ void StatsOptionsHandler::HandleMetricsReportingCheckbox(
enabled ?
UserMetricsAction("Options_MetricsReportingCheckbox_Enable") :
UserMetricsAction("Options_MetricsReportingCheckbox_Disable"));
- const bool is_enabled = MetricsCrosSettingsProvider::GetMetricsStatus();
- SetupMetricsReportingCheckbox(enabled == is_enabled);
-#endif
-}
-
-void StatsOptionsHandler::SetupMetricsReportingCheckbox(bool user_changed) {
-#if defined(GOOGLE_CHROME_BUILD)
- FundamentalValue checked(MetricsCrosSettingsProvider::GetMetricsStatus());
- FundamentalValue disabled(!UserManager::Get()->current_user_is_owner());
- FundamentalValue user_has_changed(user_changed);
- web_ui_->CallJavascriptFunction(
- "options.AdvancedOptions.SetMetricsReportingCheckboxState", checked,
- disabled, user_has_changed);
#endif
}
diff --git a/chrome/browser/ui/webui/options/chromeos/stats_options_handler.h b/chrome/browser/ui/webui/options/chromeos/stats_options_handler.h
index 564e4d0..557fc36 100644
--- a/chrome/browser/ui/webui/options/chromeos/stats_options_handler.h
+++ b/chrome/browser/ui/webui/options/chromeos/stats_options_handler.h
@@ -10,8 +10,6 @@
namespace chromeos {
-class MetricsCrosSettingsProvider;
-
// ChromeOS handler for "Stats/crash reporting to Google" option of the Advanced
// settings page. This handler does only ChromeOS-specific actions while default
// code is in Chrome's AdvancedOptionsHandler
@@ -28,9 +26,7 @@ class StatsOptionsHandler : public CrosOptionsPageUIHandler {
virtual void RegisterMessages();
private:
- MetricsCrosSettingsProvider* provider() const;
void HandleMetricsReportingCheckbox(const base::ListValue* args);
- void SetupMetricsReportingCheckbox(bool user_changed);
DISALLOW_COPY_AND_ASSIGN(StatsOptionsHandler);
};
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index f82d6d1..3168fd3 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -643,8 +643,6 @@
'browser/chromeos/low_battery_observer.h',
'browser/chromeos/media/media_player.cc',
'browser/chromeos/media/media_player.h',
- 'browser/chromeos/metrics_cros_settings_provider.cc',
- 'browser/chromeos/metrics_cros_settings_provider.h',
'browser/chromeos/native_dialog_window.cc',
'browser/chromeos/native_dialog_window.h',
'browser/chromeos/net/cros_network_change_notifier_factory.cc',