| 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 <stddef.h> | 8 #include <stddef.h> |
| 8 #include <utility> | 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 16 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 kDeviceAttestationEnabled, | 64 kDeviceAttestationEnabled, |
| 64 kDeviceDisabled, | 65 kDeviceDisabled, |
| 65 kDeviceDisabledMessage, | 66 kDeviceDisabledMessage, |
| 66 kDeviceOwner, | 67 kDeviceOwner, |
| 67 kDeviceQuirksDownloadEnabled, | 68 kDeviceQuirksDownloadEnabled, |
| 68 kDisplayRotationDefault, | 69 kDisplayRotationDefault, |
| 69 kExtensionCacheSize, | 70 kExtensionCacheSize, |
| 70 kHeartbeatEnabled, | 71 kHeartbeatEnabled, |
| 71 kHeartbeatFrequency, | 72 kHeartbeatFrequency, |
| 72 kLoginAuthenticationBehavior, | 73 kLoginAuthenticationBehavior, |
| 74 kLoginVideoCaptureAllowedUrls, |
| 73 kPolicyMissingMitigationMode, | 75 kPolicyMissingMitigationMode, |
| 74 kRebootOnShutdown, | 76 kRebootOnShutdown, |
| 75 kReleaseChannel, | 77 kReleaseChannel, |
| 76 kReleaseChannelDelegated, | 78 kReleaseChannelDelegated, |
| 77 kReportDeviceActivityTimes, | 79 kReportDeviceActivityTimes, |
| 78 kReportDeviceBootMode, | 80 kReportDeviceBootMode, |
| 79 kReportDeviceHardwareStatus, | 81 kReportDeviceHardwareStatus, |
| 80 kReportDeviceLocation, | 82 kReportDeviceLocation, |
| 81 kReportDeviceNetworkInterfaces, | 83 kReportDeviceNetworkInterfaces, |
| 82 kReportDeviceSessionStatus, | 84 kReportDeviceSessionStatus, |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 .login_screen_domain_auto_complete()); | 265 .login_screen_domain_auto_complete()); |
| 264 } | 266 } |
| 265 | 267 |
| 266 if (policy.has_login_authentication_behavior() && | 268 if (policy.has_login_authentication_behavior() && |
| 267 policy.login_authentication_behavior() | 269 policy.login_authentication_behavior() |
| 268 .has_login_authentication_behavior()) { | 270 .has_login_authentication_behavior()) { |
| 269 new_values_cache->SetInteger( | 271 new_values_cache->SetInteger( |
| 270 kLoginAuthenticationBehavior, | 272 kLoginAuthenticationBehavior, |
| 271 policy.login_authentication_behavior().login_authentication_behavior()); | 273 policy.login_authentication_behavior().login_authentication_behavior()); |
| 272 } | 274 } |
| 275 |
| 276 if (policy.has_login_video_capture_allowed_urls()) { |
| 277 std::unique_ptr<base::ListValue> list(new base::ListValue()); |
| 278 const em::LoginVideoCaptureAllowedUrlsProto& |
| 279 login_video_capture_allowed_urls_proto = |
| 280 policy.login_video_capture_allowed_urls(); |
| 281 for (const auto& value : login_video_capture_allowed_urls_proto.urls()) { |
| 282 list->Append(new base::StringValue(value)); |
| 283 } |
| 284 new_values_cache->SetValue(kLoginVideoCaptureAllowedUrls, std::move(list)); |
| 285 } |
| 273 } | 286 } |
| 274 | 287 |
| 275 void DecodeNetworkPolicies( | 288 void DecodeNetworkPolicies( |
| 276 const em::ChromeDeviceSettingsProto& policy, | 289 const em::ChromeDeviceSettingsProto& policy, |
| 277 PrefValueMap* new_values_cache) { | 290 PrefValueMap* new_values_cache) { |
| 278 // kSignedDataRoamingEnabled has a default value of false. | 291 // kSignedDataRoamingEnabled has a default value of false. |
| 279 new_values_cache->SetBoolean( | 292 new_values_cache->SetBoolean( |
| 280 kSignedDataRoamingEnabled, | 293 kSignedDataRoamingEnabled, |
| 281 policy.has_data_roaming_enabled() && | 294 policy.has_data_roaming_enabled() && |
| 282 policy.data_roaming_enabled().has_data_roaming_enabled() && | 295 policy.data_roaming_enabled().has_data_roaming_enabled() && |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 | 582 |
| 570 // Set the cache to the updated value. | 583 // Set the cache to the updated value. |
| 571 UpdateValuesCache(data, device_settings_, TEMPORARILY_UNTRUSTED); | 584 UpdateValuesCache(data, device_settings_, TEMPORARILY_UNTRUSTED); |
| 572 | 585 |
| 573 if (!device_settings_cache::Store(data, g_browser_process->local_state())) { | 586 if (!device_settings_cache::Store(data, g_browser_process->local_state())) { |
| 574 LOG(ERROR) << "Couldn't store to the temp storage."; | 587 LOG(ERROR) << "Couldn't store to the temp storage."; |
| 575 NotifyObservers(path); | 588 NotifyObservers(path); |
| 576 return; | 589 return; |
| 577 } | 590 } |
| 578 } | 591 } |
| 579 | |
| 580 } | 592 } |
| 581 | 593 |
| 582 void DeviceSettingsProvider::OwnershipStatusChanged() { | 594 void DeviceSettingsProvider::OwnershipStatusChanged() { |
| 583 DeviceSettingsService::OwnershipStatus new_ownership_status = | 595 DeviceSettingsService::OwnershipStatus new_ownership_status = |
| 584 device_settings_service_->GetOwnershipStatus(); | 596 device_settings_service_->GetOwnershipStatus(); |
| 585 | 597 |
| 586 if (device_settings_service_->GetOwnerSettingsService()) | 598 if (device_settings_service_->GetOwnerSettingsService()) |
| 587 device_settings_service_->GetOwnerSettingsService()->AddObserver(this); | 599 device_settings_service_->GetOwnerSettingsService()->AddObserver(this); |
| 588 | 600 |
| 589 // If the device just became owned, write the settings accumulated in the | 601 // If the device just became owned, write the settings accumulated in the |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 // Notify the observers we are done. | 828 // Notify the observers we are done. |
| 817 std::vector<base::Closure> callbacks; | 829 std::vector<base::Closure> callbacks; |
| 818 callbacks.swap(callbacks_); | 830 callbacks.swap(callbacks_); |
| 819 for (size_t i = 0; i < callbacks.size(); ++i) | 831 for (size_t i = 0; i < callbacks.size(); ++i) |
| 820 callbacks[i].Run(); | 832 callbacks[i].Run(); |
| 821 | 833 |
| 822 return settings_loaded; | 834 return settings_loaded; |
| 823 } | 835 } |
| 824 | 836 |
| 825 } // namespace chromeos | 837 } // namespace chromeos |
| OLD | NEW |