Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_provider.cc

Issue 2890843002: Policy implementation for encryptfs to ext4 migration strategy (Closed)
Patch Set: Fixed review comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" 21 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
22 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 22 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
23 #include "chrome/browser/chromeos/policy/device_local_account.h" 23 #include "chrome/browser/chromeos/policy/device_local_account.h"
24 #include "chrome/browser/chromeos/settings/cros_settings.h" 24 #include "chrome/browser/chromeos/settings/cros_settings.h"
25 #include "chrome/browser/chromeos/settings/device_settings_cache.h" 25 #include "chrome/browser/chromeos/settings/device_settings_cache.h"
26 #include "chrome/browser/metrics/metrics_reporting_state.h" 26 #include "chrome/browser/metrics/metrics_reporting_state.h"
27 #include "chromeos/chromeos_switches.h" 27 #include "chromeos/chromeos_switches.h"
28 #include "chromeos/dbus/cryptohome_client.h" 28 #include "chromeos/dbus/cryptohome_client.h"
29 #include "chromeos/dbus/dbus_thread_manager.h" 29 #include "chromeos/dbus/dbus_thread_manager.h"
30 #include "chromeos/settings/cros_settings_names.h" 30 #include "chromeos/settings/cros_settings_names.h"
31 #include "components/arc/arc_util.h"
31 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 32 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
32 #include "components/policy/proto/device_management_backend.pb.h" 33 #include "components/policy/proto/device_management_backend.pb.h"
33 #include "components/prefs/pref_service.h" 34 #include "components/prefs/pref_service.h"
34 35
35 using google::protobuf::RepeatedField; 36 using google::protobuf::RepeatedField;
36 using google::protobuf::RepeatedPtrField; 37 using google::protobuf::RepeatedPtrField;
37 38
38 namespace em = enterprise_management; 39 namespace em = enterprise_management;
39 40
40 namespace chromeos { 41 namespace chromeos {
(...skipping 15 matching lines...) Expand all
56 kAccountsPrefTransferSAMLCookies, 57 kAccountsPrefTransferSAMLCookies,
57 kAccountsPrefUsers, 58 kAccountsPrefUsers,
58 kAccountsPrefLoginScreenDomainAutoComplete, 59 kAccountsPrefLoginScreenDomainAutoComplete,
59 kAllowBluetooth, 60 kAllowBluetooth,
60 kAllowRedeemChromeOsRegistrationOffers, 61 kAllowRedeemChromeOsRegistrationOffers,
61 kAllowedConnectionTypesForUpdate, 62 kAllowedConnectionTypesForUpdate,
62 kAttestationForContentProtectionEnabled, 63 kAttestationForContentProtectionEnabled,
63 kDeviceAttestationEnabled, 64 kDeviceAttestationEnabled,
64 kDeviceDisabled, 65 kDeviceDisabled,
65 kDeviceDisabledMessage, 66 kDeviceDisabledMessage,
67 kDeviceEcryptfsMigrationStrategy,
66 kDeviceLoginScreenAppInstallList, 68 kDeviceLoginScreenAppInstallList,
67 kDeviceOwner, 69 kDeviceOwner,
68 kDeviceQuirksDownloadEnabled, 70 kDeviceQuirksDownloadEnabled,
69 kDeviceWallpaperImage, 71 kDeviceWallpaperImage,
70 kDisplayRotationDefault, 72 kDisplayRotationDefault,
71 kExtensionCacheSize, 73 kExtensionCacheSize,
72 kHeartbeatEnabled, 74 kHeartbeatEnabled,
73 kHeartbeatFrequency, 75 kHeartbeatFrequency,
74 kLoginAuthenticationBehavior, 76 kLoginAuthenticationBehavior,
75 kLoginVideoCaptureAllowedUrls, 77 kLoginVideoCaptureAllowedUrls,
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if (policy.has_login_screen_input_methods()) { 334 if (policy.has_login_screen_input_methods()) {
333 std::unique_ptr<base::ListValue> input_methods(new base::ListValue); 335 std::unique_ptr<base::ListValue> input_methods(new base::ListValue);
334 const em::LoginScreenInputMethodsProto& login_screen_input_methods( 336 const em::LoginScreenInputMethodsProto& login_screen_input_methods(
335 policy.login_screen_input_methods()); 337 policy.login_screen_input_methods());
336 for (const auto& input_method : 338 for (const auto& input_method :
337 login_screen_input_methods.login_screen_input_methods()) 339 login_screen_input_methods.login_screen_input_methods())
338 input_methods->AppendString(input_method); 340 input_methods->AppendString(input_method);
339 new_values_cache->SetValue(kDeviceLoginScreenInputMethods, 341 new_values_cache->SetValue(kDeviceLoginScreenInputMethods,
340 std::move(input_methods)); 342 std::move(input_methods));
341 } 343 }
344
345 if (policy.has_device_ecryptfs_migration_strategy()) {
346 new_values_cache->SetInteger(
347 kDeviceEcryptfsMigrationStrategy,
348 policy.device_ecryptfs_migration_strategy().migration_strategy());
349 }
342 } 350 }
343 351
344 void DecodeNetworkPolicies( 352 void DecodeNetworkPolicies(
345 const em::ChromeDeviceSettingsProto& policy, 353 const em::ChromeDeviceSettingsProto& policy,
346 PrefValueMap* new_values_cache) { 354 PrefValueMap* new_values_cache) {
347 // kSignedDataRoamingEnabled has a default value of false. 355 // kSignedDataRoamingEnabled has a default value of false.
348 new_values_cache->SetBoolean( 356 new_values_cache->SetBoolean(
349 kSignedDataRoamingEnabled, 357 kSignedDataRoamingEnabled,
350 policy.has_data_roaming_enabled() && 358 policy.has_data_roaming_enabled() &&
351 policy.data_roaming_enabled().has_data_roaming_enabled() && 359 policy.data_roaming_enabled().has_data_roaming_enabled() &&
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 UpdateValuesCache(policy_data, device_settings_, trusted_status_); 744 UpdateValuesCache(policy_data, device_settings_, trusted_status_);
737 } 745 }
738 746
739 void DeviceSettingsProvider::UpdateValuesCache( 747 void DeviceSettingsProvider::UpdateValuesCache(
740 const em::PolicyData& policy_data, 748 const em::PolicyData& policy_data,
741 const em::ChromeDeviceSettingsProto& settings, 749 const em::ChromeDeviceSettingsProto& settings,
742 TrustedStatus trusted_status) { 750 TrustedStatus trusted_status) {
743 PrefValueMap new_values_cache; 751 PrefValueMap new_values_cache;
744 752
745 // If the device is not managed, we set the device owner value. 753 // If the device is not managed, we set the device owner value.
746 if (policy_data.has_username() && !policy_data.has_request_token()) 754 if (policy_data.has_username() && !policy_data.has_request_token()) {
747 new_values_cache.SetString(kDeviceOwner, policy_data.username()); 755 new_values_cache.SetString(kDeviceOwner, policy_data.username());
756 arc::SetHasDeviceOwner();
757 }
748 758
749 if (policy_data.has_service_account_identity()) { 759 if (policy_data.has_service_account_identity()) {
750 new_values_cache.SetString(kServiceAccountIdentity, 760 new_values_cache.SetString(kServiceAccountIdentity,
751 policy_data.service_account_identity()); 761 policy_data.service_account_identity());
752 } 762 }
753 763
754 DecodeLoginPolicies(settings, &new_values_cache); 764 DecodeLoginPolicies(settings, &new_values_cache);
755 DecodeNetworkPolicies(settings, &new_values_cache); 765 DecodeNetworkPolicies(settings, &new_values_cache);
756 DecodeAutoUpdatePolicies(settings, &new_values_cache); 766 DecodeAutoUpdatePolicies(settings, &new_values_cache);
757 DecodeReportingPolicies(settings, &new_values_cache); 767 DecodeReportingPolicies(settings, &new_values_cache);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 // Notify the observers we are done. 910 // Notify the observers we are done.
901 std::vector<base::Closure> callbacks; 911 std::vector<base::Closure> callbacks;
902 callbacks.swap(callbacks_); 912 callbacks.swap(callbacks_);
903 for (size_t i = 0; i < callbacks.size(); ++i) 913 for (size_t i = 0; i < callbacks.size(); ++i)
904 callbacks[i].Run(); 914 callbacks[i].Run();
905 915
906 return settings_loaded; 916 return settings_loaded;
907 } 917 }
908 918
909 } // namespace chromeos 919 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698