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

Side by Side Diff: chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.cc

Issue 18153007: Add policies to control power management on the Chrome OS login screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Correct example in policy_templates.json. Created 7 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 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/chromeos/policy/configuration_policy_handler_chromeos.h " 5 #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h "
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/magnifier/magnifier_constants.h" 9 #include "ash/magnifier/magnifier_constants.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
12 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/prefs/pref_value_map.h" 14 #include "base/prefs/pref_value_map.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/chromeos/policy/login_screen_power_management_policy.h"
17 #include "chrome/browser/policy/external_data_fetcher.h" 18 #include "chrome/browser/policy/external_data_fetcher.h"
18 #include "chrome/browser/policy/policy_error_map.h" 19 #include "chrome/browser/policy/policy_error_map.h"
19 #include "chrome/browser/policy/policy_map.h" 20 #include "chrome/browser/policy/policy_map.h"
20 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" 21 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
21 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
22 #include "chromeos/network/onc/onc_constants.h" 23 #include "chromeos/network/onc/onc_constants.h"
23 #include "chromeos/network/onc/onc_signature.h" 24 #include "chromeos/network/onc/onc_signature.h"
24 #include "chromeos/network/onc/onc_utils.h" 25 #include "chromeos/network/onc/onc_utils.h"
25 #include "chromeos/network/onc/onc_validator.h" 26 #include "chromeos/network/onc/onc_validator.h"
26 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 const base::Value* value = policies.GetValue(policy_name()); 186 const base::Value* value = policies.GetValue(policy_name());
186 int value_in_range; 187 int value_in_range;
187 if (value && EnsureInRange(value, &value_in_range, NULL)) { 188 if (value && EnsureInRange(value, &value_in_range, NULL)) {
188 prefs->SetValue(prefs::kScreenMagnifierEnabled, 189 prefs->SetValue(prefs::kScreenMagnifierEnabled,
189 base::Value::CreateBooleanValue(value_in_range != 0)); 190 base::Value::CreateBooleanValue(value_in_range != 0));
190 prefs->SetValue(prefs::kScreenMagnifierType, 191 prefs->SetValue(prefs::kScreenMagnifierType,
191 base::Value::CreateIntegerValue(value_in_range)); 192 base::Value::CreateIntegerValue(value_in_range));
192 } 193 }
193 } 194 }
194 195
196 LoginScreenPowerManagementPolicyHandler::
197 LoginScreenPowerManagementPolicyHandler()
198 : TypeCheckingPolicyHandler(key::kDeviceLoginScreenPowerManagement,
199 base::Value::TYPE_STRING) {
200 }
201
202 LoginScreenPowerManagementPolicyHandler::
203 ~LoginScreenPowerManagementPolicyHandler() {
204 }
205
206 bool LoginScreenPowerManagementPolicyHandler::CheckPolicySettings(
207 const PolicyMap& policies,
208 PolicyErrorMap* errors) {
209 const base::Value* value;
210 if (!CheckAndGetValue(policies, errors, &value))
211 return false;
212
213 if (!value)
214 return true;
215
216 std::string json;
217 value->GetAsString(&json);
218 return LoginScreenPowerManagementPolicy().Init(json, errors);
219 }
220
221 void LoginScreenPowerManagementPolicyHandler::ApplyPolicySettings(
222 const PolicyMap& policies,
223 PrefValueMap* prefs) {
224 }
225
195 } // namespace policy 226 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698