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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 UMA_HISTOGRAM_COUNTS("DeviceSettings.MetricsMigrated", 1); | 676 UMA_HISTOGRAM_COUNTS("DeviceSettings.MetricsMigrated", 1); |
677 } | 677 } |
678 VLOG(1) << "Metrics policy is being set to : " << new_value | 678 VLOG(1) << "Metrics policy is being set to : " << new_value |
679 << "(use file : " << use_file << ")"; | 679 << "(use file : " << use_file << ")"; |
680 // TODO(pastarmovj): Remove this once we don't need to regenerate the | 680 // TODO(pastarmovj): Remove this once we don't need to regenerate the |
681 // consent file for the GUID anymore. | 681 // consent file for the GUID anymore. |
682 OptionsUtil::ResolveMetricsReportingEnabled(new_value); | 682 OptionsUtil::ResolveMetricsReportingEnabled(new_value); |
683 } | 683 } |
684 | 684 |
685 void DeviceSettingsProvider::ApplyRoamingSetting(bool new_value) { | 685 void DeviceSettingsProvider::ApplyRoamingSetting(bool new_value) { |
| 686 if (!CrosLibrary::Get()) |
| 687 return; // May not be initialized in tests. |
686 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); | 688 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); |
687 const NetworkDevice* cellular = cros->FindCellularDevice(); | 689 const NetworkDevice* cellular = cros->FindCellularDevice(); |
688 if (cellular) { | 690 if (cellular) { |
689 bool device_value = cellular->data_roaming_allowed(); | 691 bool device_value = cellular->data_roaming_allowed(); |
690 if (!device_value && cros->IsCellularAlwaysInRoaming()) { | 692 if (!device_value && cros->IsCellularAlwaysInRoaming()) { |
691 // If operator requires roaming always enabled, ignore supplied value | 693 // If operator requires roaming always enabled, ignore supplied value |
692 // and set data roaming allowed in true always. | 694 // and set data roaming allowed in true always. |
693 cros->SetCellularDataRoamingAllowed(true); | 695 cros->SetCellularDataRoamingAllowed(true); |
694 } else if (device_value != new_value) { | 696 } else if (device_value != new_value) { |
695 cros->SetCellularDataRoamingAllowed(new_value); | 697 cros->SetCellularDataRoamingAllowed(new_value); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 void DeviceSettingsProvider::AttemptMigration() { | 858 void DeviceSettingsProvider::AttemptMigration() { |
857 if (device_settings_service_->HasPrivateOwnerKey()) { | 859 if (device_settings_service_->HasPrivateOwnerKey()) { |
858 PrefValueMap::const_iterator i; | 860 PrefValueMap::const_iterator i; |
859 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) | 861 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) |
860 DoSet(i->first, *i->second); | 862 DoSet(i->first, *i->second); |
861 migration_values_.Clear(); | 863 migration_values_.Clear(); |
862 } | 864 } |
863 } | 865 } |
864 | 866 |
865 } // namespace chromeos | 867 } // namespace chromeos |
OLD | NEW |