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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/policy/configuration_policy_handler.h" 5 #include "chrome/browser/policy/configuration_policy_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 errors->AddError(policy_name(), 280 errors->AddError(policy_name(),
281 entry - list_value->begin(), 281 entry - list_value->begin(),
282 IDS_POLICY_OUT_OF_RANGE_ERROR); 282 IDS_POLICY_OUT_OF_RANGE_ERROR);
283 } 283 }
284 } 284 }
285 } 285 }
286 286
287 return true; 287 return true;
288 } 288 }
289 289
290 // IntPercentageToDoublePolicyHandler implementation ---------------------------
291
292 IntPercentageToDoublePolicyHandler::IntPercentageToDoublePolicyHandler(
293 const char* policy_name,
294 const char* pref_path)
295 : TypeCheckingPolicyHandler(policy_name, base::Value::TYPE_INTEGER),
296 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.
297
298 void IntPercentageToDoublePolicyHandler::ApplyPolicySettings(
299 const PolicyMap& policies,
300 PrefValueMap* prefs) {
301 const base::Value* value = policies.GetValue(policy_name());
302 int percentage;
303 if (value && value->GetAsInteger(&percentage)) {
304 prefs->SetValue(pref_path_, base::Value::CreateDoubleValue(
305 static_cast<double>(percentage) / 100.));
306 }
307 }
308
290 // ExtensionListPolicyHandler implementation ----------------------------------- 309 // ExtensionListPolicyHandler implementation -----------------------------------
291 310
292 ExtensionListPolicyHandler::ExtensionListPolicyHandler(const char* policy_name, 311 ExtensionListPolicyHandler::ExtensionListPolicyHandler(const char* policy_name,
293 const char* pref_path, 312 const char* pref_path,
294 bool allow_wildcards) 313 bool allow_wildcards)
295 : TypeCheckingPolicyHandler(policy_name, base::Value::TYPE_LIST), 314 : TypeCheckingPolicyHandler(policy_name, base::Value::TYPE_LIST),
296 pref_path_(pref_path), 315 pref_path_(pref_path),
297 allow_wildcards_(allow_wildcards) {} 316 allow_wildcards_(allow_wildcards) {}
298 317
299 ExtensionListPolicyHandler::~ExtensionListPolicyHandler() {} 318 ExtensionListPolicyHandler::~ExtensionListPolicyHandler() {}
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 errors->AddError(policy_name(), 1480 errors->AddError(policy_name(),
1462 IDS_POLICY_OUT_OF_RANGE_ERROR, 1481 IDS_POLICY_OUT_OF_RANGE_ERROR,
1463 base::IntToString(restore_value)); 1482 base::IntToString(restore_value));
1464 } 1483 }
1465 } 1484 }
1466 } 1485 }
1467 return true; 1486 return true;
1468 } 1487 }
1469 1488
1470 } // namespace policy 1489 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698