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" | |
21 #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h " | 22 #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h " |
22 #endif // defined(OS_CHROMEOS) | 23 #endif // defined(OS_CHROMEOS) |
23 | 24 |
24 namespace policy { | 25 namespace policy { |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
29 const char kNoPref[] = ""; | |
Mattias Nissler (ping if slow)
2013/06/12 13:55:16
Why not just NULL?
bartfab (slow)
2013/06/12 18:57:49
Done.
| |
30 | |
28 // Maps a policy type to a preference path, and to the expected value type. | 31 // Maps a policy type to a preference path, and to the expected value type. |
29 // This is the entry type of |kSimplePolicyMap| below. | 32 // This is the entry type of |kSimplePolicyMap| below. |
30 struct PolicyToPreferenceMapEntry { | 33 struct PolicyToPreferenceMapEntry { |
31 const char* policy_name; | 34 const char* policy_name; |
32 const char* preference_path; | 35 const char* preference_path; |
33 base::Value::Type value_type; | 36 base::Value::Type value_type; |
34 }; | 37 }; |
35 | 38 |
36 // List of policy types to preference names. This is used for simple policies | 39 // List of policy types to preference names. This is used for simple policies |
37 // that directly map to a single preference. | 40 // that directly map to a single preference. |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
376 Value::TYPE_BOOLEAN }, | 379 Value::TYPE_BOOLEAN }, |
377 { key::kLargeCursorEnabled, | 380 { key::kLargeCursorEnabled, |
378 prefs::kLargeCursorEnabled, | 381 prefs::kLargeCursorEnabled, |
379 Value::TYPE_BOOLEAN }, | 382 Value::TYPE_BOOLEAN }, |
380 { key::kSpokenFeedbackEnabled, | 383 { key::kSpokenFeedbackEnabled, |
381 prefs::kSpokenFeedbackEnabled, | 384 prefs::kSpokenFeedbackEnabled, |
382 Value::TYPE_BOOLEAN }, | 385 Value::TYPE_BOOLEAN }, |
383 { key::kHighContrastEnabled, | 386 { key::kHighContrastEnabled, |
384 prefs::kHighContrastEnabled, | 387 prefs::kHighContrastEnabled, |
385 Value::TYPE_BOOLEAN }, | 388 Value::TYPE_BOOLEAN }, |
389 { key::kLoginScreenDefaultLargeCursorEnabled, | |
390 kNoPref, | |
391 Value::TYPE_BOOLEAN }, | |
392 { key::kLoginScreenDefaultSpokenFeedbackEnabled, | |
393 kNoPref, | |
394 Value::TYPE_BOOLEAN }, | |
395 { key::kLoginScreenDefaultHighContrastEnabled, | |
396 kNoPref, | |
397 Value::TYPE_BOOLEAN }, | |
386 { key::kRebootAfterUpdate, | 398 { key::kRebootAfterUpdate, |
387 prefs::kRebootAfterUpdate, | 399 prefs::kRebootAfterUpdate, |
388 Value::TYPE_BOOLEAN }, | 400 Value::TYPE_BOOLEAN }, |
389 { key::kAttestationEnabledForUser, | 401 { key::kAttestationEnabledForUser, |
390 prefs::kAttestationEnabled, | 402 prefs::kAttestationEnabled, |
391 Value::TYPE_BOOLEAN }, | 403 Value::TYPE_BOOLEAN }, |
392 #endif // defined(OS_CHROMEOS) | 404 #endif // defined(OS_CHROMEOS) |
393 | 405 |
394 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) | 406 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) |
395 { key::kBackgroundModeEnabled, | 407 { key::kBackgroundModeEnabled, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
531 prefs::kPowerPresentationIdleDelayFactor, | 543 prefs::kPowerPresentationIdleDelayFactor, |
532 100, INT_MAX, true)); | 544 100, INT_MAX, true)); |
533 handlers_.push_back( | 545 handlers_.push_back( |
534 new IntPercentageToDoublePolicyHandler( | 546 new IntPercentageToDoublePolicyHandler( |
535 key::kUserActivityScreenDimDelayScale, | 547 key::kUserActivityScreenDimDelayScale, |
536 prefs::kPowerUserActivityScreenDimDelayFactor, | 548 prefs::kPowerUserActivityScreenDimDelayFactor, |
537 100, INT_MAX, true)); | 549 100, INT_MAX, true)); |
538 handlers_.push_back(new IntRangePolicyHandler(key::kUptimeLimit, | 550 handlers_.push_back(new IntRangePolicyHandler(key::kUptimeLimit, |
539 prefs::kUptimeLimit, | 551 prefs::kUptimeLimit, |
540 3600, INT_MAX, true)); | 552 3600, INT_MAX, true)); |
553 handlers_.push_back( | |
554 new IntRangePolicyHandler(key::kLoginScreenDefaultScreenMagnifierType, | |
555 kNoPref, | |
556 0, ash::MAGNIFIER_FULL, false)); | |
541 #endif // defined(OS_CHROMEOS) | 557 #endif // defined(OS_CHROMEOS) |
542 } | 558 } |
543 | 559 |
544 ConfigurationPolicyHandlerList::~ConfigurationPolicyHandlerList() { | 560 ConfigurationPolicyHandlerList::~ConfigurationPolicyHandlerList() { |
545 STLDeleteElements(&handlers_); | 561 STLDeleteElements(&handlers_); |
546 } | 562 } |
547 | 563 |
548 void ConfigurationPolicyHandlerList::ApplyPolicySettings( | 564 void ConfigurationPolicyHandlerList::ApplyPolicySettings( |
549 const PolicyMap& policies, | 565 const PolicyMap& policies, |
550 PrefValueMap* prefs, | 566 PrefValueMap* prefs, |
(...skipping 17 matching lines...) Expand all Loading... | |
568 } | 584 } |
569 | 585 |
570 void ConfigurationPolicyHandlerList::PrepareForDisplaying( | 586 void ConfigurationPolicyHandlerList::PrepareForDisplaying( |
571 PolicyMap* policies) const { | 587 PolicyMap* policies) const { |
572 std::vector<ConfigurationPolicyHandler*>::const_iterator handler; | 588 std::vector<ConfigurationPolicyHandler*>::const_iterator handler; |
573 for (handler = handlers_.begin(); handler != handlers_.end(); ++handler) | 589 for (handler = handlers_.begin(); handler != handlers_.end(); ++handler) |
574 (*handler)->PrepareForDisplaying(policies); | 590 (*handler)->PrepareForDisplaying(policies); |
575 } | 591 } |
576 | 592 |
577 } // namespace policy | 593 } // namespace policy |
OLD | NEW |