OLD | NEW |
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_list.h" | 5 #include "chrome/browser/policy/configuration_policy_handler_list.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/prefs/pref_value_map.h" | 9 #include "base/prefs/pref_value_map.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/policy/configuration_policy_handler.h" | 12 #include "chrome/browser/policy/configuration_policy_handler.h" |
13 #include "chrome/browser/policy/policy_error_map.h" | 13 #include "chrome/browser/policy/policy_error_map.h" |
14 #include "chrome/browser/policy/policy_map.h" | 14 #include "chrome/browser/policy/policy_map.h" |
15 #include "chrome/common/extensions/manifest.h" | 15 #include "chrome/common/extensions/manifest.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
18 #include "policy/policy_constants.h" | 18 #include "policy/policy_constants.h" |
19 | 19 |
20 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
21 #include "ash/magnifier/magnifier_constants.h" | |
22 #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h
" | 21 #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h
" |
23 #endif // defined(OS_CHROMEOS) | 22 #endif // defined(OS_CHROMEOS) |
24 | 23 |
25 namespace policy { | 24 namespace policy { |
26 | 25 |
27 namespace { | 26 namespace { |
28 | 27 |
29 // Maps a policy type to a preference path, and to the expected value type. | 28 // Maps a policy type to a preference path, and to the expected value type. |
30 // This is the entry type of |kSimplePolicyMap| below. | 29 // This is the entry type of |kSimplePolicyMap| below. |
31 struct PolicyToPreferenceMapEntry { | 30 struct PolicyToPreferenceMapEntry { |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 Value::TYPE_BOOLEAN }, | 376 Value::TYPE_BOOLEAN }, |
378 { key::kLargeCursorEnabled, | 377 { key::kLargeCursorEnabled, |
379 prefs::kLargeCursorEnabled, | 378 prefs::kLargeCursorEnabled, |
380 Value::TYPE_BOOLEAN }, | 379 Value::TYPE_BOOLEAN }, |
381 { key::kSpokenFeedbackEnabled, | 380 { key::kSpokenFeedbackEnabled, |
382 prefs::kSpokenFeedbackEnabled, | 381 prefs::kSpokenFeedbackEnabled, |
383 Value::TYPE_BOOLEAN }, | 382 Value::TYPE_BOOLEAN }, |
384 { key::kHighContrastEnabled, | 383 { key::kHighContrastEnabled, |
385 prefs::kHighContrastEnabled, | 384 prefs::kHighContrastEnabled, |
386 Value::TYPE_BOOLEAN }, | 385 Value::TYPE_BOOLEAN }, |
387 { key::kDeviceLoginScreenDefaultLargeCursorEnabled, | |
388 NULL, | |
389 Value::TYPE_BOOLEAN }, | |
390 { key::kDeviceLoginScreenDefaultSpokenFeedbackEnabled, | |
391 NULL, | |
392 Value::TYPE_BOOLEAN }, | |
393 { key::kDeviceLoginScreenDefaultHighContrastEnabled, | |
394 NULL, | |
395 Value::TYPE_BOOLEAN }, | |
396 { key::kRebootAfterUpdate, | 386 { key::kRebootAfterUpdate, |
397 prefs::kRebootAfterUpdate, | 387 prefs::kRebootAfterUpdate, |
398 Value::TYPE_BOOLEAN }, | 388 Value::TYPE_BOOLEAN }, |
399 { key::kAttestationEnabledForUser, | 389 { key::kAttestationEnabledForUser, |
400 prefs::kAttestationEnabled, | 390 prefs::kAttestationEnabled, |
401 Value::TYPE_BOOLEAN }, | 391 Value::TYPE_BOOLEAN }, |
402 #endif // defined(OS_CHROMEOS) | 392 #endif // defined(OS_CHROMEOS) |
403 | 393 |
404 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 394 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
405 { key::kBackgroundModeEnabled, | 395 { key::kBackgroundModeEnabled, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 prefs::kPowerPresentationIdleDelayFactor, | 531 prefs::kPowerPresentationIdleDelayFactor, |
542 100, INT_MAX, true)); | 532 100, INT_MAX, true)); |
543 handlers_.push_back( | 533 handlers_.push_back( |
544 new IntPercentageToDoublePolicyHandler( | 534 new IntPercentageToDoublePolicyHandler( |
545 key::kUserActivityScreenDimDelayScale, | 535 key::kUserActivityScreenDimDelayScale, |
546 prefs::kPowerUserActivityScreenDimDelayFactor, | 536 prefs::kPowerUserActivityScreenDimDelayFactor, |
547 100, INT_MAX, true)); | 537 100, INT_MAX, true)); |
548 handlers_.push_back(new IntRangePolicyHandler(key::kUptimeLimit, | 538 handlers_.push_back(new IntRangePolicyHandler(key::kUptimeLimit, |
549 prefs::kUptimeLimit, | 539 prefs::kUptimeLimit, |
550 3600, INT_MAX, true)); | 540 3600, INT_MAX, true)); |
551 handlers_.push_back(new IntRangePolicyHandler( | |
552 key::kDeviceLoginScreenDefaultScreenMagnifierType, | |
553 NULL, | |
554 0, ash::MAGNIFIER_FULL, false)); | |
555 #endif // defined(OS_CHROMEOS) | 541 #endif // defined(OS_CHROMEOS) |
556 } | 542 } |
557 | 543 |
558 ConfigurationPolicyHandlerList::~ConfigurationPolicyHandlerList() { | 544 ConfigurationPolicyHandlerList::~ConfigurationPolicyHandlerList() { |
559 STLDeleteElements(&handlers_); | 545 STLDeleteElements(&handlers_); |
560 } | 546 } |
561 | 547 |
562 void ConfigurationPolicyHandlerList::ApplyPolicySettings( | 548 void ConfigurationPolicyHandlerList::ApplyPolicySettings( |
563 const PolicyMap& policies, | 549 const PolicyMap& policies, |
564 PrefValueMap* prefs, | 550 PrefValueMap* prefs, |
(...skipping 17 matching lines...) Expand all Loading... |
582 } | 568 } |
583 | 569 |
584 void ConfigurationPolicyHandlerList::PrepareForDisplaying( | 570 void ConfigurationPolicyHandlerList::PrepareForDisplaying( |
585 PolicyMap* policies) const { | 571 PolicyMap* policies) const { |
586 std::vector<ConfigurationPolicyHandler*>::const_iterator handler; | 572 std::vector<ConfigurationPolicyHandler*>::const_iterator handler; |
587 for (handler = handlers_.begin(); handler != handlers_.end(); ++handler) | 573 for (handler = handlers_.begin(); handler != handlers_.end(); ++handler) |
588 (*handler)->PrepareForDisplaying(policies); | 574 (*handler)->PrepareForDisplaying(policies); |
589 } | 575 } |
590 | 576 |
591 } // namespace policy | 577 } // namespace policy |
OLD | NEW |