| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 using google::protobuf::RepeatedField; | 29 using google::protobuf::RepeatedField; |
| 30 using google::protobuf::RepeatedPtrField; | 30 using google::protobuf::RepeatedPtrField; |
| 31 | 31 |
| 32 namespace em = enterprise_management; | 32 namespace em = enterprise_management; |
| 33 | 33 |
| 34 namespace chromeos { | 34 namespace chromeos { |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 // List of settings handled by the DeviceSettingsProvider. | 38 // List of settings handled by the DeviceSettingsProvider. |
| 39 const char* kKnownSettings[] = { | 39 const char* const kKnownSettings[] = { |
| 40 kAccountsPrefAllowGuest, | 40 kAccountsPrefAllowGuest, |
| 41 kAccountsPrefAllowNewUser, | 41 kAccountsPrefAllowNewUser, |
| 42 kAccountsPrefDeviceLocalAccounts, | 42 kAccountsPrefDeviceLocalAccounts, |
| 43 kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled, | 43 kAccountsPrefDeviceLocalAccountAutoLoginBailoutEnabled, |
| 44 kAccountsPrefDeviceLocalAccountAutoLoginDelay, | 44 kAccountsPrefDeviceLocalAccountAutoLoginDelay, |
| 45 kAccountsPrefDeviceLocalAccountAutoLoginId, | 45 kAccountsPrefDeviceLocalAccountAutoLoginId, |
| 46 kAccountsPrefDeviceLocalAccountPromptForNetworkWhenOffline, | 46 kAccountsPrefDeviceLocalAccountPromptForNetworkWhenOffline, |
| 47 kAccountsPrefEphemeralUsersEnabled, | 47 kAccountsPrefEphemeralUsersEnabled, |
| 48 kAccountsPrefShowUserNamesOnSignIn, | 48 kAccountsPrefShowUserNamesOnSignIn, |
| 49 kAccountsPrefSupervisedUsersEnabled, | 49 kAccountsPrefSupervisedUsersEnabled, |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 RetrieveCachedData(); | 447 RetrieveCachedData(); |
| 448 } | 448 } |
| 449 } | 449 } |
| 450 | 450 |
| 451 DeviceSettingsProvider::~DeviceSettingsProvider() { | 451 DeviceSettingsProvider::~DeviceSettingsProvider() { |
| 452 device_settings_service_->RemoveObserver(this); | 452 device_settings_service_->RemoveObserver(this); |
| 453 } | 453 } |
| 454 | 454 |
| 455 // static | 455 // static |
| 456 bool DeviceSettingsProvider::IsDeviceSetting(const std::string& name) { | 456 bool DeviceSettingsProvider::IsDeviceSetting(const std::string& name) { |
| 457 const char** end = kKnownSettings + arraysize(kKnownSettings); | 457 const char* const* end = kKnownSettings + arraysize(kKnownSettings); |
| 458 return std::find(kKnownSettings, end, name) != end; | 458 return std::find(kKnownSettings, end, name) != end; |
| 459 } | 459 } |
| 460 | 460 |
| 461 void DeviceSettingsProvider::DoSet(const std::string& path, | 461 void DeviceSettingsProvider::DoSet(const std::string& path, |
| 462 const base::Value& in_value) { | 462 const base::Value& in_value) { |
| 463 // Make sure that either the current user is the device owner or the | 463 // Make sure that either the current user is the device owner or the |
| 464 // device doesn't have an owner yet. | 464 // device doesn't have an owner yet. |
| 465 if (!(device_settings_service_->HasPrivateOwnerKey() || | 465 if (!(device_settings_service_->HasPrivateOwnerKey() || |
| 466 ownership_status_ == DeviceSettingsService::OWNERSHIP_NONE)) { | 466 ownership_status_ == DeviceSettingsService::OWNERSHIP_NONE)) { |
| 467 LOG(WARNING) << "Changing settings from non-owner, setting=" << path; | 467 LOG(WARNING) << "Changing settings from non-owner, setting=" << path; |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 void DeviceSettingsProvider::AttemptMigration() { | 1009 void DeviceSettingsProvider::AttemptMigration() { |
| 1010 if (device_settings_service_->HasPrivateOwnerKey()) { | 1010 if (device_settings_service_->HasPrivateOwnerKey()) { |
| 1011 PrefValueMap::const_iterator i; | 1011 PrefValueMap::const_iterator i; |
| 1012 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 1012 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
| 1013 DoSet(i->first, *i->second); | 1013 DoSet(i->first, *i->second); |
| 1014 migration_values_.Clear(); | 1014 migration_values_.Clear(); |
| 1015 } | 1015 } |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 } // namespace chromeos | 1018 } // namespace chromeos |
| OLD | NEW |