Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: chrome/browser/chromeos/cros/network_library_impl_cros.cc

Issue 10854112: Fix always-in-roaming reset loop for cellular connections on Chromium OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // If a device's power state changes, new properties may become defined. 155 // If a device's power state changes, new properties may become defined.
155 if (index == PROPERTY_INDEX_POWERED) { 156 if (index == PROPERTY_INDEX_POWERED) {
156 CrosRequestNetworkDeviceProperties( 157 CrosRequestNetworkDeviceProperties(
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(NetworkDevice* device,
165 NetworkDevice* device, PropertyIndex index) { 166 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 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 } else { 1170 } else {
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
1179 if (!device->data_roaming_allowed() && IsCellularAlwaysInRoaming()) { 1181 // Re-synchronize the roaming setting with the device property if required.
1180 SetCellularDataRoamingAllowed(true); 1182 if (device && device->type() == TYPE_CELLULAR)
1181 } else { 1183 UpdateCellularDeviceStatus(device, PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING);
1182 bool settings_value; 1184
1183 if (CrosSettings::Get()->GetBoolean(
1184 kSignedDataRoamingEnabled, &settings_value) &&
1185 device->data_roaming_allowed() != settings_value) {
1186 // Switch back to signed settings value.
1187 SetCellularDataRoamingAllowed(settings_value);
1188 }
1189 }
1190 }
1191 NotifyNetworkManagerChanged(false); // Not forced. 1185 NotifyNetworkManagerChanged(false); // Not forced.
1192 AddNetworkDeviceObserver(device_path, network_device_observer_.get()); 1186 AddNetworkDeviceObserver(device_path, network_device_observer_.get());
1193 } 1187 }
1194 1188
1195 } // namespace chromeos 1189 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698