OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/user_cros_settings_provider.h" | 5 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 301 } |
302 } | 302 } |
303 | 303 |
304 // Called right before boolean property is changed. | 304 // Called right before boolean property is changed. |
305 void OnBooleanPropertyChange(const std::string& path, bool new_value) { | 305 void OnBooleanPropertyChange(const std::string& path, bool new_value) { |
306 if (path == kSignedDataRoamingEnabled) { | 306 if (path == kSignedDataRoamingEnabled) { |
307 if (!CrosLibrary::Get()->EnsureLoaded()) | 307 if (!CrosLibrary::Get()->EnsureLoaded()) |
308 return; | 308 return; |
309 | 309 |
310 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); | 310 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); |
| 311 if (cros->IsCellularAlwaysInRoaming()) { |
| 312 // If operator requires roaming always enabled, ignore supplied value |
| 313 // and set data roaming allowed in true always. |
| 314 new_value = true; |
| 315 } |
311 cros->SetCellularDataRoamingAllowed(new_value); | 316 cros->SetCellularDataRoamingAllowed(new_value); |
312 } else if (path == kStatsReportingPref) { | 317 } else if (path == kStatsReportingPref) { |
313 // TODO(pastarmovj): Remove this once we don't need to regenerate the | 318 // TODO(pastarmovj): Remove this once we don't need to regenerate the |
314 // consent file for the GUID anymore. | 319 // consent file for the GUID anymore. |
315 OptionsUtil::ResolveMetricsReportingEnabled(new_value); | 320 OptionsUtil::ResolveMetricsReportingEnabled(new_value); |
316 } | 321 } |
317 } | 322 } |
318 | 323 |
319 // Called right after signed value was checked. | 324 // Called right after signed value was checked. |
320 void OnBooleanPropertyRetrieve(const std::string& path, | 325 void OnBooleanPropertyRetrieve(const std::string& path, |
321 bool value, | 326 bool value, |
322 UseValue use_value) { | 327 UseValue use_value) { |
323 if (path == kSignedDataRoamingEnabled) { | 328 if (path == kSignedDataRoamingEnabled) { |
324 if (!CrosLibrary::Get()->EnsureLoaded()) | 329 if (!CrosLibrary::Get()->EnsureLoaded()) |
325 return; | 330 return; |
326 | 331 |
327 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); | 332 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); |
328 const NetworkDevice* cellular = cros->FindCellularDevice(); | 333 const NetworkDevice* cellular = cros->FindCellularDevice(); |
329 if (cellular) { | 334 if (cellular) { |
330 bool device_value = cellular->data_roaming_allowed(); | 335 bool device_value = cellular->data_roaming_allowed(); |
331 bool new_value = (use_value == USE_VALUE_SUPPLIED) ? value : false; | 336 if (!device_value && cros->IsCellularAlwaysInRoaming()) { |
332 if (device_value != new_value) | 337 // If operator requires roaming always enabled, ignore supplied value |
333 cros->SetCellularDataRoamingAllowed(new_value); | 338 // and set data roaming allowed in true always. |
| 339 cros->SetCellularDataRoamingAllowed(true); |
| 340 } else { |
| 341 bool new_value = (use_value == USE_VALUE_SUPPLIED) ? value : false; |
| 342 if (device_value != new_value) |
| 343 cros->SetCellularDataRoamingAllowed(new_value); |
| 344 } |
334 } | 345 } |
335 } else if (path == kStatsReportingPref) { | 346 } else if (path == kStatsReportingPref) { |
336 bool stats_consent = (use_value == USE_VALUE_SUPPLIED) ? value : false; | 347 bool stats_consent = (use_value == USE_VALUE_SUPPLIED) ? value : false; |
337 // TODO(pastarmovj): Remove this once migration is not needed anymore. | 348 // TODO(pastarmovj): Remove this once migration is not needed anymore. |
338 // If the value is not set we should try to migrate legacy consent file. | 349 // If the value is not set we should try to migrate legacy consent file. |
339 if (use_value == USE_VALUE_DEFAULT) { | 350 if (use_value == USE_VALUE_DEFAULT) { |
340 // Loading consent file state causes us to do blocking IO on UI thread. | 351 // Loading consent file state causes us to do blocking IO on UI thread. |
341 // Temporarily allow it until we fix http://crbug.com/62626 | 352 // Temporarily allow it until we fix http://crbug.com/62626 |
342 base::ThreadRestrictions::ScopedAllowIO allow_io; | 353 base::ThreadRestrictions::ScopedAllowIO allow_io; |
343 stats_consent = GoogleUpdateSettings::GetCollectStatsConsent(); | 354 stats_consent = GoogleUpdateSettings::GetCollectStatsConsent(); |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 if (cached_whitelist_update->Remove(email_value, NULL)) | 698 if (cached_whitelist_update->Remove(email_value, NULL)) |
688 prefs->ScheduleSavePersistentPrefs(); | 699 prefs->ScheduleSavePersistentPrefs(); |
689 } | 700 } |
690 | 701 |
691 // static | 702 // static |
692 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { | 703 void UserCrosSettingsProvider::UpdateCachedOwner(const std::string& email) { |
693 UpdateCacheString(kDeviceOwner, email, USE_VALUE_SUPPLIED); | 704 UpdateCacheString(kDeviceOwner, email, USE_VALUE_SUPPLIED); |
694 } | 705 } |
695 | 706 |
696 } // namespace chromeos | 707 } // namespace chromeos |
OLD | NEW |