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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 578 |
579 if (container.has_login_screen_default_screen_magnifier_type()) { | 579 if (container.has_login_screen_default_screen_magnifier_type()) { |
580 policies->Set( | 580 policies->Set( |
581 key::kDeviceLoginScreenDefaultScreenMagnifierType, | 581 key::kDeviceLoginScreenDefaultScreenMagnifierType, |
582 POLICY_LEVEL_MANDATORY, | 582 POLICY_LEVEL_MANDATORY, |
583 POLICY_SCOPE_MACHINE, | 583 POLICY_SCOPE_MACHINE, |
584 DecodeIntegerValue( | 584 DecodeIntegerValue( |
585 container.login_screen_default_screen_magnifier_type()).release(), | 585 container.login_screen_default_screen_magnifier_type()).release(), |
586 NULL); | 586 NULL); |
587 } | 587 } |
| 588 |
588 if (container.has_login_screen_default_virtual_keyboard_enabled()) { | 589 if (container.has_login_screen_default_virtual_keyboard_enabled()) { |
589 policies->Set( | 590 policies->Set( |
590 key::kDeviceLoginScreenDefaultVirtualKeyboardEnabled, | 591 key::kDeviceLoginScreenDefaultVirtualKeyboardEnabled, |
591 POLICY_LEVEL_MANDATORY, | 592 POLICY_LEVEL_MANDATORY, |
592 POLICY_SCOPE_MACHINE, | 593 POLICY_SCOPE_MACHINE, |
593 new base::FundamentalValue( | 594 new base::FundamentalValue( |
594 container.login_screen_default_virtual_keyboard_enabled()), | 595 container.login_screen_default_virtual_keyboard_enabled()), |
595 NULL); | 596 NULL); |
596 } | 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 } |
597 } | 610 } |
598 } | 611 } |
599 | 612 |
600 void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy, | 613 void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy, |
601 PolicyMap* policies) { | 614 PolicyMap* policies) { |
602 if (policy.has_device_policy_refresh_rate()) { | 615 if (policy.has_device_policy_refresh_rate()) { |
603 const em::DevicePolicyRefreshRateProto& container( | 616 const em::DevicePolicyRefreshRateProto& container( |
604 policy.device_policy_refresh_rate()); | 617 policy.device_policy_refresh_rate()); |
605 if (container.has_device_policy_refresh_rate()) { | 618 if (container.has_device_policy_refresh_rate()) { |
606 policies->Set( | 619 policies->Set( |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 // Decode the various groups of policies. | 782 // Decode the various groups of policies. |
770 DecodeLoginPolicies(policy, policies); | 783 DecodeLoginPolicies(policy, policies); |
771 DecodeNetworkPolicies(policy, policies); | 784 DecodeNetworkPolicies(policy, policies); |
772 DecodeReportingPolicies(policy, policies); | 785 DecodeReportingPolicies(policy, policies); |
773 DecodeAutoUpdatePolicies(policy, policies); | 786 DecodeAutoUpdatePolicies(policy, policies); |
774 DecodeAccessibilityPolicies(policy, policies); | 787 DecodeAccessibilityPolicies(policy, policies); |
775 DecodeGenericPolicies(policy, policies); | 788 DecodeGenericPolicies(policy, policies); |
776 } | 789 } |
777 | 790 |
778 } // namespace policy | 791 } // namespace policy |
OLD | NEW |