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

Unified Diff: chrome/browser/chromeos/user_cros_settings_provider.cc

Issue 7524002: Merge 94322 - Rewire the metrics pref to the signed settings store on chromeos. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/user_cros_settings_provider.h ('k') | chrome/browser/ui/webui/crashes_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/user_cros_settings_provider.cc
===================================================================
--- chrome/browser/chromeos/user_cros_settings_provider.cc (revision 94348)
+++ chrome/browser/chromeos/user_cros_settings_provider.cc (working copy)
@@ -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 @@
kAccountsPrefAllowGuest,
kAccountsPrefShowUserNamesOnSignIn,
kSignedDataRoamingEnabled,
+ kStatsReportingPref
};
const char* kStringSettings[] = {
@@ -60,7 +63,8 @@
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 @@
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 @@
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 @@
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 @@
kDeviceOwner, callback);
}
+bool UserCrosSettingsProvider::RequestTrustedReportingEnabled(Task* callback) {
+ return UserCrosSettingsTrust::GetInstance()->RequestTrustedEntity(
+ kStatsReportingPref, callback);
+}
+
void UserCrosSettingsProvider::Reload() {
UserCrosSettingsTrust::GetInstance()->Reload();
}
@@ -524,6 +545,14 @@
}
// 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::HandlesSetting(const std::string& path) {
return ::StartsWithASCII(path, "cros.accounts.", true) ||
::StartsWithASCII(path, "cros.signed.", true) ||
+ ::StartsWithASCII(path, "cros.metrics.", true) ||
path == kReleaseChannel;
}
« no previous file with comments | « chrome/browser/chromeos/user_cros_settings_provider.h ('k') | chrome/browser/ui/webui/crashes_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698