| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // cache to device settings proper. It is important that writing only happens | 142 // cache to device settings proper. It is important that writing only happens |
| 143 // in this case, as during normal operation, the contents of the cache should | 143 // in this case, as during normal operation, the contents of the cache should |
| 144 // never overwrite actual device settings. | 144 // never overwrite actual device settings. |
| 145 if (new_ownership_status == DeviceSettingsService::OWNERSHIP_TAKEN && | 145 if (new_ownership_status == DeviceSettingsService::OWNERSHIP_TAKEN && |
| 146 ownership_status_ == DeviceSettingsService::OWNERSHIP_NONE && | 146 ownership_status_ == DeviceSettingsService::OWNERSHIP_NONE && |
| 147 device_settings_service_->HasPrivateOwnerKey()) { | 147 device_settings_service_->HasPrivateOwnerKey()) { |
| 148 // There shouldn't be any pending writes, since the cache writes are all | 148 // There shouldn't be any pending writes, since the cache writes are all |
| 149 // immediate. | 149 // immediate. |
| 150 DCHECK(!store_callback_factory_.HasWeakPtrs()); | 150 DCHECK(!store_callback_factory_.HasWeakPtrs()); |
| 151 | 151 |
| 152 trusted_status_ = TEMPORARILY_UNTRUSTED; |
| 152 // Apply the locally-accumulated device settings on top of the initial | 153 // Apply the locally-accumulated device settings on top of the initial |
| 153 // settings from the service and write back the result. | 154 // settings from the service and write back the result. |
| 154 if (device_settings_service_->device_settings()) { | 155 if (device_settings_service_->device_settings()) { |
| 155 em::ChromeDeviceSettingsProto new_settings( | 156 em::ChromeDeviceSettingsProto new_settings( |
| 156 *device_settings_service_->device_settings()); | 157 *device_settings_service_->device_settings()); |
| 157 new_settings.MergeFrom(device_settings_); | 158 new_settings.MergeFrom(device_settings_); |
| 158 device_settings_.Swap(&new_settings); | 159 device_settings_.Swap(&new_settings); |
| 159 } | 160 } |
| 160 StoreDeviceSettings(); | 161 StoreDeviceSettings(); |
| 161 } | 162 } |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 void DeviceSettingsProvider::AttemptMigration() { | 973 void DeviceSettingsProvider::AttemptMigration() { |
| 973 if (device_settings_service_->HasPrivateOwnerKey()) { | 974 if (device_settings_service_->HasPrivateOwnerKey()) { |
| 974 PrefValueMap::const_iterator i; | 975 PrefValueMap::const_iterator i; |
| 975 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 976 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
| 976 DoSet(i->first, *i->second); | 977 DoSet(i->first, *i->second); |
| 977 migration_values_.Clear(); | 978 migration_values_.Clear(); |
| 978 } | 979 } |
| 979 } | 980 } |
| 980 | 981 |
| 981 } // namespace chromeos | 982 } // namespace chromeos |
| OLD | NEW |