Chromium Code Reviews| 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/cros/network_library_impl_cros.h" | 5 #include "chrome/browser/chromeos/cros/network_library_impl_cros.h" |
| 6 | 6 |
| 7 #include <dbus/dbus-glib.h> | 7 #include <dbus/dbus-glib.h> |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/json/json_writer.h" // for debug output only. | 9 #include "base/json/json_writer.h" // for debug output only. |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "chrome/browser/chromeos/cros/cros_library.h" | 11 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 12 #include "chrome/browser/chromeos/cros/native_network_constants.h" | 12 #include "chrome/browser/chromeos/cros/native_network_constants.h" |
| 13 #include "chrome/browser/chromeos/cros/native_network_parser.h" | 13 #include "chrome/browser/chromeos/cros/native_network_parser.h" |
| 14 #include "chrome/browser/chromeos/settings/cros_settings.h" | 14 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "third_party/cros_system_api/dbus/service_constants.h" | 17 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 18 | 18 |
| 19 using content::BrowserThread; | 19 using content::BrowserThread; |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // List of cellular operators names that should have data roaming always enabled | 25 // List of cellular operators names that should have data roaming always enabled |
| 26 // to be able to connect to any network. | 26 // to be able to connect to any network. |
| 27 const char* kAlwaysInRoamingOperators[] = { | 27 const char* kAlwaysInRoamingOperators[] = { |
| 28 "CUBIC" | 28 "CUBIC", |
| 29 "Cubic", | |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 // List of interfaces that have portal check enabled by default. | 32 // List of interfaces that have portal check enabled by default. |
| 32 const char kDefaultCheckPortalList[] = "ethernet,wifi,cellular"; | 33 const char kDefaultCheckPortalList[] = "ethernet,wifi,cellular"; |
| 33 | 34 |
| 34 } // namespace | 35 } // namespace |
| 35 | 36 |
| 36 //////////////////////////////////////////////////////////////////////////// | 37 //////////////////////////////////////////////////////////////////////////// |
| 37 | 38 |
| 38 NetworkLibraryImplCros::NetworkLibraryImplCros() | 39 NetworkLibraryImplCros::NetworkLibraryImplCros() |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 path, | 158 path, |
| 158 base::Bind(&NetworkLibraryImplCros::NetworkDeviceUpdate, | 159 base::Bind(&NetworkLibraryImplCros::NetworkDeviceUpdate, |
| 159 weak_ptr_factory_.GetWeakPtr())); | 160 weak_ptr_factory_.GetWeakPtr())); |
| 160 } | 161 } |
| 161 } | 162 } |
| 162 } | 163 } |
| 163 | 164 |
| 164 bool NetworkLibraryImplCros::UpdateCellularDeviceStatus( | 165 bool NetworkLibraryImplCros::UpdateCellularDeviceStatus( |
| 165 NetworkDevice* device, PropertyIndex index) { | 166 NetworkDevice* device, PropertyIndex index) { |
| 166 if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) { | 167 if (index == PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING) { |
| 167 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { | 168 if (IsCellularAlwaysInRoaming()) { |
| 168 SetCellularDataRoamingAllowed(true); | 169 if (!device->data_roaming_allowed()) |
| 170 SetCellularDataRoamingAllowed(true); | |
| 169 } else { | 171 } else { |
| 170 bool settings_value; | 172 bool settings_value; |
| 171 if ((CrosSettings::Get()->GetBoolean( | 173 if ((CrosSettings::Get()->GetBoolean( |
| 172 kSignedDataRoamingEnabled, &settings_value)) && | 174 kSignedDataRoamingEnabled, &settings_value)) && |
| 173 (device->data_roaming_allowed() != settings_value)) { | 175 (device->data_roaming_allowed() != settings_value)) { |
| 174 // Switch back to signed settings value. | 176 // Switch back to signed settings value. |
| 175 SetCellularDataRoamingAllowed(settings_value); | 177 SetCellularDataRoamingAllowed(settings_value); |
| 176 return false; | 178 return false; |
| 177 } | 179 } |
| 178 } | 180 } |
| (...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1169 NativeNetworkDeviceParser parser; | 1171 NativeNetworkDeviceParser parser; |
| 1170 device = parser.CreateDeviceFromInfo(device_path, info); | 1172 device = parser.CreateDeviceFromInfo(device_path, info); |
| 1171 VLOG(2) << " Adding device: " << device_path; | 1173 VLOG(2) << " Adding device: " << device_path; |
| 1172 if (device) { | 1174 if (device) { |
| 1173 device_map_[device_path] = device; | 1175 device_map_[device_path] = device; |
| 1174 } | 1176 } |
| 1175 CHECK(device) << "Attempted to add NULL device for path: " << device_path; | 1177 CHECK(device) << "Attempted to add NULL device for path: " << device_path; |
| 1176 } | 1178 } |
| 1177 VLOG(2) << "ParseNetworkDevice:" << device->name(); | 1179 VLOG(2) << "ParseNetworkDevice:" << device->name(); |
| 1178 if (device && device->type() == TYPE_CELLULAR) { | 1180 if (device && device->type() == TYPE_CELLULAR) { |
| 1179 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { | 1181 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { |
|
petkov
2012/08/13 09:55:13
Should we change this logic too?
Mattias Nissler (ping if slow)
2012/08/13 11:05:00
Yes, good catch. I think in this case it actually
| |
| 1180 SetCellularDataRoamingAllowed(true); | 1182 SetCellularDataRoamingAllowed(true); |
| 1181 } else { | 1183 } else { |
| 1182 bool settings_value; | 1184 bool settings_value; |
| 1183 if (CrosSettings::Get()->GetBoolean( | 1185 if (CrosSettings::Get()->GetBoolean( |
| 1184 kSignedDataRoamingEnabled, &settings_value) && | 1186 kSignedDataRoamingEnabled, &settings_value) && |
| 1185 device->data_roaming_allowed() != settings_value) { | 1187 device->data_roaming_allowed() != settings_value) { |
| 1186 // Switch back to signed settings value. | 1188 // Switch back to signed settings value. |
| 1187 SetCellularDataRoamingAllowed(settings_value); | 1189 SetCellularDataRoamingAllowed(settings_value); |
| 1188 } | 1190 } |
| 1189 } | 1191 } |
| 1190 } | 1192 } |
| 1191 NotifyNetworkManagerChanged(false); // Not forced. | 1193 NotifyNetworkManagerChanged(false); // Not forced. |
| 1192 AddNetworkDeviceObserver(device_path, network_device_observer_.get()); | 1194 AddNetworkDeviceObserver(device_path, network_device_observer_.get()); |
| 1193 } | 1195 } |
| 1194 | 1196 |
| 1195 } // namespace chromeos | 1197 } // namespace chromeos |
| OLD | NEW |