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/settings/device_settings_provider.h" | 5 #include "chrome/browser/chromeos/settings/device_settings_provider.h" |
6 | 6 |
7 #include <memory.h> | 7 #include <memory.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 kServiceAccountIdentity, | 91 kServiceAccountIdentity, |
92 kSignedDataRoamingEnabled, | 92 kSignedDataRoamingEnabled, |
93 kStartUpFlags, | 93 kStartUpFlags, |
94 kStatsReportingPref, | 94 kStatsReportingPref, |
95 kSystemLogUploadEnabled, | 95 kSystemLogUploadEnabled, |
96 kSystemTimezonePolicy, | 96 kSystemTimezonePolicy, |
97 kSystemUse24HourClock, | 97 kSystemUse24HourClock, |
98 kTargetVersionPrefix, | 98 kTargetVersionPrefix, |
99 kUpdateDisabled, | 99 kUpdateDisabled, |
100 kVariationsRestrictParameter, | 100 kVariationsRestrictParameter, |
101 }; | 101 kDeviceLoginScreenLocales, |
102 kDeviceLoginScreenInputMethods}; | |
pastarmovj
2017/01/25 15:42:20
Is the closing } put there by clang-format? If so
pmarko
2017/01/26 12:32:58
clang format does that, but it looks better if I l
| |
102 | 103 |
103 void DecodeLoginPolicies( | 104 void DecodeLoginPolicies( |
104 const em::ChromeDeviceSettingsProto& policy, | 105 const em::ChromeDeviceSettingsProto& policy, |
105 PrefValueMap* new_values_cache) { | 106 PrefValueMap* new_values_cache) { |
106 // For all our boolean settings the following is applicable: | 107 // For all our boolean settings the following is applicable: |
107 // true is default permissive value and false is safe prohibitive value. | 108 // true is default permissive value and false is safe prohibitive value. |
108 // Exceptions: | 109 // Exceptions: |
109 // kAccountsPrefEphemeralUsersEnabled has a default value of false. | 110 // kAccountsPrefEphemeralUsersEnabled has a default value of false. |
110 // kAccountsPrefSupervisedUsersEnabled has a default value of false | 111 // kAccountsPrefSupervisedUsersEnabled has a default value of false |
111 // for enterprise devices and true for consumer devices. | 112 // for enterprise devices and true for consumer devices. |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
526 policy.quirks_download_enabled().quirks_download_enabled()); | 527 policy.quirks_download_enabled().quirks_download_enabled()); |
527 } | 528 } |
528 | 529 |
529 if (policy.has_device_wallpaper_image() && | 530 if (policy.has_device_wallpaper_image() && |
530 policy.device_wallpaper_image().has_device_wallpaper_image()) { | 531 policy.device_wallpaper_image().has_device_wallpaper_image()) { |
531 std::unique_ptr<base::DictionaryValue> dict_val = | 532 std::unique_ptr<base::DictionaryValue> dict_val = |
532 base::DictionaryValue::From(base::JSONReader::Read( | 533 base::DictionaryValue::From(base::JSONReader::Read( |
533 policy.device_wallpaper_image().device_wallpaper_image())); | 534 policy.device_wallpaper_image().device_wallpaper_image())); |
534 new_values_cache->SetValue(kDeviceWallpaperImage, std::move(dict_val)); | 535 new_values_cache->SetValue(kDeviceWallpaperImage, std::move(dict_val)); |
535 } | 536 } |
537 | |
538 if (policy.has_login_screen_locales()) { | |
539 std::unique_ptr<base::ListValue> locales(new base::ListValue); | |
540 const em::LoginScreenLocalesProto& login_screen_locales( | |
541 policy.login_screen_locales()); | |
542 for (const auto& locale : login_screen_locales.login_screen_locales()) | |
543 locales->AppendString(locale); | |
544 new_values_cache->SetValue(kDeviceLoginScreenLocales, std::move(locales)); | |
545 } | |
546 | |
547 if (policy.has_login_screen_input_methods()) { | |
548 std::unique_ptr<base::ListValue> input_methods(new base::ListValue); | |
549 const em::LoginScreenInputMethodsProto& login_screen_input_methods( | |
550 policy.login_screen_input_methods()); | |
551 for (const auto& input_method : | |
552 login_screen_input_methods.login_screen_input_methods()) | |
553 input_methods->AppendString(input_method); | |
554 new_values_cache->SetValue(kDeviceLoginScreenInputMethods, | |
555 std::move(input_methods)); | |
556 } | |
536 } | 557 } |
537 | 558 |
538 void DecodeLogUploadPolicies(const em::ChromeDeviceSettingsProto& policy, | 559 void DecodeLogUploadPolicies(const em::ChromeDeviceSettingsProto& policy, |
539 PrefValueMap* new_values_cache) { | 560 PrefValueMap* new_values_cache) { |
540 if (!policy.has_device_log_upload_settings()) | 561 if (!policy.has_device_log_upload_settings()) |
541 return; | 562 return; |
542 | 563 |
543 const em::DeviceLogUploadSettingsProto& log_upload_policy = | 564 const em::DeviceLogUploadSettingsProto& log_upload_policy = |
544 policy.device_log_upload_settings(); | 565 policy.device_log_upload_settings(); |
545 if (log_upload_policy.has_system_log_upload_enabled()) { | 566 if (log_upload_policy.has_system_log_upload_enabled()) { |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
871 // Notify the observers we are done. | 892 // Notify the observers we are done. |
872 std::vector<base::Closure> callbacks; | 893 std::vector<base::Closure> callbacks; |
873 callbacks.swap(callbacks_); | 894 callbacks.swap(callbacks_); |
874 for (size_t i = 0; i < callbacks.size(); ++i) | 895 for (size_t i = 0; i < callbacks.size(); ++i) |
875 callbacks[i].Run(); | 896 callbacks[i].Run(); |
876 | 897 |
877 return settings_loaded; | 898 return settings_loaded; |
878 } | 899 } |
879 | 900 |
880 } // namespace chromeos | 901 } // namespace chromeos |
OLD | NEW |