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/chromeos/policy/device_policy_decoder_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 588 |
589 if (container.has_login_screen_default_virtual_keyboard_enabled()) { | 589 if (container.has_login_screen_default_virtual_keyboard_enabled()) { |
590 policies->Set( | 590 policies->Set( |
591 key::kDeviceLoginScreenDefaultVirtualKeyboardEnabled, | 591 key::kDeviceLoginScreenDefaultVirtualKeyboardEnabled, |
592 POLICY_LEVEL_MANDATORY, | 592 POLICY_LEVEL_MANDATORY, |
593 POLICY_SCOPE_MACHINE, | 593 POLICY_SCOPE_MACHINE, |
594 new base::FundamentalValue( | 594 new base::FundamentalValue( |
595 container.login_screen_default_virtual_keyboard_enabled()), | 595 container.login_screen_default_virtual_keyboard_enabled()), |
596 NULL); | 596 NULL); |
597 } | 597 } |
598 | |
599 // The behavior when policy is not set and when it is set to an empty string | |
600 // is the same. Thus lets add policy to the map only if it is set and its | |
601 // value is not an empty string. | |
602 if (container.has_login_screen_domain_auto_complete() && | |
603 !container.login_screen_domain_auto_complete().empty()) { | |
604 policies->Set( | |
605 key::kDeviceLoginScreenDomainAutoComplete, POLICY_LEVEL_MANDATORY, | |
606 POLICY_SCOPE_MACHINE, | |
607 new base::StringValue(container.login_screen_domain_auto_complete()), | |
608 nullptr); | |
609 } | |
610 } | 598 } |
611 } | 599 } |
612 | 600 |
613 void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy, | 601 void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy, |
614 PolicyMap* policies) { | 602 PolicyMap* policies) { |
615 if (policy.has_device_policy_refresh_rate()) { | 603 if (policy.has_device_policy_refresh_rate()) { |
616 const em::DevicePolicyRefreshRateProto& container( | 604 const em::DevicePolicyRefreshRateProto& container( |
617 policy.device_policy_refresh_rate()); | 605 policy.device_policy_refresh_rate()); |
618 if (container.has_device_policy_refresh_rate()) { | 606 if (container.has_device_policy_refresh_rate()) { |
619 policies->Set( | 607 policies->Set( |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 if (policy.has_extension_cache_size()) { | 751 if (policy.has_extension_cache_size()) { |
764 const em::ExtensionCacheSizeProto& container(policy.extension_cache_size()); | 752 const em::ExtensionCacheSizeProto& container(policy.extension_cache_size()); |
765 if (container.has_extension_cache_size()) { | 753 if (container.has_extension_cache_size()) { |
766 policies->Set( | 754 policies->Set( |
767 key::kExtensionCacheSize, POLICY_LEVEL_MANDATORY, | 755 key::kExtensionCacheSize, POLICY_LEVEL_MANDATORY, |
768 POLICY_SCOPE_MACHINE, | 756 POLICY_SCOPE_MACHINE, |
769 DecodeIntegerValue(container.extension_cache_size()).release(), | 757 DecodeIntegerValue(container.extension_cache_size()).release(), |
770 nullptr); | 758 nullptr); |
771 } | 759 } |
772 } | 760 } |
| 761 |
| 762 if (policy.has_login_screen_domain_auto_complete()) { |
| 763 const em::LoginScreenDomainAutoCompleteProto& container( |
| 764 policy.login_screen_domain_auto_complete()); |
| 765 policies->Set( |
| 766 key::kDeviceLoginScreenDomainAutoComplete, POLICY_LEVEL_MANDATORY, |
| 767 POLICY_SCOPE_MACHINE, |
| 768 new base::StringValue(container.login_screen_domain_auto_complete()), |
| 769 nullptr); |
| 770 } |
773 } | 771 } |
774 | 772 |
775 } // namespace | 773 } // namespace |
776 | 774 |
777 void DecodeDevicePolicy(const em::ChromeDeviceSettingsProto& policy, | 775 void DecodeDevicePolicy(const em::ChromeDeviceSettingsProto& policy, |
778 PolicyMap* policies) { | 776 PolicyMap* policies) { |
779 // TODO(achuith): Remove this once crbug.com/263527 is resolved. | 777 // TODO(achuith): Remove this once crbug.com/263527 is resolved. |
780 VLOG(2) << "DecodeDevicePolicy " << policy.SerializeAsString(); | 778 VLOG(2) << "DecodeDevicePolicy " << policy.SerializeAsString(); |
781 | 779 |
782 // Decode the various groups of policies. | 780 // Decode the various groups of policies. |
783 DecodeLoginPolicies(policy, policies); | 781 DecodeLoginPolicies(policy, policies); |
784 DecodeNetworkPolicies(policy, policies); | 782 DecodeNetworkPolicies(policy, policies); |
785 DecodeReportingPolicies(policy, policies); | 783 DecodeReportingPolicies(policy, policies); |
786 DecodeAutoUpdatePolicies(policy, policies); | 784 DecodeAutoUpdatePolicies(policy, policies); |
787 DecodeAccessibilityPolicies(policy, policies); | 785 DecodeAccessibilityPolicies(policy, policies); |
788 DecodeGenericPolicies(policy, policies); | 786 DecodeGenericPolicies(policy, policies); |
789 } | 787 } |
790 | 788 |
791 } // namespace policy | 789 } // namespace policy |
OLD | NEW |