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

Unified Diff: chrome/browser/policy/configuration_policy_handler.cc

Issue 12217068: Add policies to control Chrome OS power management (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
Index: chrome/browser/policy/configuration_policy_handler.cc
diff --git a/chrome/browser/policy/configuration_policy_handler.cc b/chrome/browser/policy/configuration_policy_handler.cc
index 5587cae14c2c6582bdbdd08633edf7282a5e7b15..7d78dadfabfc499a4bdc2c2a2b52e39ac351673a 100644
--- a/chrome/browser/policy/configuration_policy_handler.cc
+++ b/chrome/browser/policy/configuration_policy_handler.cc
@@ -287,6 +287,25 @@ bool StringToIntEnumListPolicyHandler::Convert(const base::Value* input,
return true;
}
+// IntPercentageToDoublePolicyHandler implementation ---------------------------
+
+IntPercentageToDoublePolicyHandler::IntPercentageToDoublePolicyHandler(
+ const char* policy_name,
+ const char* pref_path)
+ : TypeCheckingPolicyHandler(policy_name, base::Value::TYPE_INTEGER),
+ pref_path_(pref_path) {}
Mattias Nissler (ping if slow) 2013/02/07 16:52:01 Should this also have a CheckPolicySettings that m
bartfab (slow) 2013/02/07 17:25:53 For the policy in question, the valid range actual
Mattias Nissler (ping if slow) 2013/02/08 09:47:49 It'd be nice to be able to get feedback in about:p
bartfab (slow) 2013/02/08 11:39:24 Done.
+
+void IntPercentageToDoublePolicyHandler::ApplyPolicySettings(
+ const PolicyMap& policies,
+ PrefValueMap* prefs) {
+ const base::Value* value = policies.GetValue(policy_name());
+ int percentage;
+ if (value && value->GetAsInteger(&percentage)) {
+ prefs->SetValue(pref_path_, base::Value::CreateDoubleValue(
+ static_cast<double>(percentage) / 100.));
+ }
+}
+
// ExtensionListPolicyHandler implementation -----------------------------------
ExtensionListPolicyHandler::ExtensionListPolicyHandler(const char* policy_name,

Powered by Google App Engine
This is Rietveld 408576698