Index: chrome/browser/chromeos/cros/network_library.cc |
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc |
index a347ec714b32544bfe482bdd594efcbc1802d900..314438a8117676e9cafdc970f33a2917d9eb1958 100644 |
--- a/chrome/browser/chromeos/cros/network_library.cc |
+++ b/chrome/browser/chromeos/cros/network_library.cc |
@@ -103,6 +103,12 @@ const int kRecentPlanPaymentHours = 6; |
// If cellular device doesn't have SIM card, then retries are never used. |
const int kDefaultSimUnlockRetriesCount = 999; |
+// List of cellular operators names that should have data roaming always enabled |
+// to be able to connect to any network. |
+const char* kAlwaysInRoamingOperators[] = { |
+ "CUBIC" |
+}; |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// Misc. |
@@ -1374,6 +1380,7 @@ class NetworkLibraryImplBase : public NetworkLibrary { |
// virtual RequestCellularScan implemented in derived classes. |
// virtual RequestCellularRegister implemented in derived classes. |
// virtual SetCellularDataRoamingAllowed implemented in derived classes. |
+ // virtual IsCellularAlwaysInRoaming implemented in derived classes. |
// virtual RequestNetworkScan implemented in derived classes. |
// virtual GetWifiAccessPoints implemented in derived classes. |
@@ -2955,6 +2962,7 @@ class NetworkLibraryImplCros : public NetworkLibraryImplBase { |
virtual void RequestCellularScan() OVERRIDE; |
virtual void RequestCellularRegister(const std::string& network_id) OVERRIDE; |
virtual void SetCellularDataRoamingAllowed(bool new_value) OVERRIDE; |
+ virtual bool IsCellularAlwaysInRoaming() OVERRIDE; |
virtual void RequestNetworkScan() OVERRIDE; |
virtual bool GetWifiAccessPoints(WifiAccessPointVector* result) OVERRIDE; |
@@ -3211,12 +3219,16 @@ void NetworkLibraryImplCros::UpdateNetworkDeviceStatus( |
PropertyIndex index = PROPERTY_INDEX_UNKNOWN; |
if (device->UpdateStatus(key, value, &index)) { |
if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) { |
- bool settings_value = |
- UserCrosSettingsProvider::cached_data_roaming_enabled(); |
- if (device->data_roaming_allowed() != settings_value) { |
- // Switch back to signed settings value. |
- SetCellularDataRoamingAllowed(settings_value); |
- return; |
+ if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { |
+ SetCellularDataRoamingAllowed(true); |
+ } else { |
+ bool settings_value = |
+ UserCrosSettingsProvider::cached_data_roaming_enabled(); |
+ if (device->data_roaming_allowed() != settings_value) { |
+ // Switch back to signed settings value. |
+ SetCellularDataRoamingAllowed(settings_value); |
+ return; |
+ } |
} |
} |
} else { |
@@ -3476,6 +3488,21 @@ void NetworkLibraryImplCros::SetCellularDataRoamingAllowed(bool new_value) { |
value.get()); |
} |
+bool NetworkLibraryImplCros::IsCellularAlwaysInRoaming() { |
+ const NetworkDevice* cellular = FindCellularDevice(); |
+ if (!cellular) { |
+ NOTREACHED() << "Calling IsCellularAlwaysInRoaming method " |
+ "w/o cellular device."; |
+ return false; |
+ } |
+ const std::string& home_provider = cellular->home_provider(); |
Nikita (slow)
2011/08/25 11:32:46
home_provider_name()
network.home_provider_ is no
Dmitry Polukhin
2011/08/25 12:39:27
Done. Thanks for catching it!
|
+ for (size_t i = 0; i < arraysize(kAlwaysInRoamingOperators); i++) { |
Nikita (slow)
2011/08/25 11:59:17
optional optimization proposal: Cache result of th
|
+ if (home_provider == kAlwaysInRoamingOperators[i]) |
+ return true; |
+ } |
+ return false; |
+} |
+ |
void NetworkLibraryImplCros::RequestNetworkScan() { |
if (wifi_enabled()) { |
wifi_scanning_ = true; // Cleared when updates are received. |
@@ -4300,6 +4327,7 @@ class NetworkLibraryImplStub : public NetworkLibraryImplBase { |
virtual void RequestCellularRegister( |
const std::string& network_id) OVERRIDE {} |
virtual void SetCellularDataRoamingAllowed(bool new_value) OVERRIDE {} |
+ virtual bool IsCellularAlwaysInRoaming() OVERRIDE { return false; } |
virtual void RequestNetworkScan() OVERRIDE {} |
virtual bool GetWifiAccessPoints(WifiAccessPointVector* result) OVERRIDE; |