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

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

Issue 3744009: chromium-os:5494 Networks with identical names not handled properly. (Closed)
Patch Set: Rebase from trunk. Created 10 years, 2 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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.h" 5 #include "chrome/browser/chromeos/cros/network_library.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 443 }
444 444
445 void RemoveObserver(Observer* observer) { 445 void RemoveObserver(Observer* observer) {
446 observers_.RemoveObserver(observer); 446 observers_.RemoveObserver(observer);
447 } 447 }
448 448
449 virtual const EthernetNetwork& ethernet_network() const { return ethernet_; } 449 virtual const EthernetNetwork& ethernet_network() const { return ethernet_; }
450 virtual bool ethernet_connecting() const { return ethernet_.connecting(); } 450 virtual bool ethernet_connecting() const { return ethernet_.connecting(); }
451 virtual bool ethernet_connected() const { return ethernet_.connected(); } 451 virtual bool ethernet_connected() const { return ethernet_.connected(); }
452 452
453 virtual const std::string& wifi_name() const { return wifi_.name(); } 453 virtual const WifiNetwork& wifi_network() const { return wifi_; }
454 virtual bool wifi_connecting() const { return wifi_.connecting(); } 454 virtual bool wifi_connecting() const { return wifi_.connecting(); }
455 virtual bool wifi_connected() const { return wifi_.connected(); } 455 virtual bool wifi_connected() const { return wifi_.connected(); }
456 virtual int wifi_strength() const { return wifi_.strength(); }
457 456
458 virtual const std::string& cellular_name() const { return cellular_.name(); } 457 virtual const CellularNetwork& cellular_network() const { return cellular_; }
459 virtual const std::string& cellular_service_path() const {
460 return cellular_.service_path(); }
461 virtual bool cellular_connecting() const { return cellular_.connecting(); } 458 virtual bool cellular_connecting() const { return cellular_.connecting(); }
462 virtual bool cellular_connected() const { return cellular_.connected(); } 459 virtual bool cellular_connected() const { return cellular_.connected(); }
463 virtual int cellular_strength() const { return cellular_.strength(); }
464 460
465 bool Connected() const { 461 bool Connected() const {
466 return ethernet_connected() || wifi_connected() || cellular_connected(); 462 return ethernet_connected() || wifi_connected() || cellular_connected();
467 } 463 }
468 464
469 bool Connecting() const { 465 bool Connecting() const {
470 return ethernet_connecting() || wifi_connecting() || cellular_connecting(); 466 return ethernet_connecting() || wifi_connecting() || cellular_connecting();
471 } 467 }
472 468
473 const std::string& IPAddress() const { 469 const std::string& IPAddress() const {
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 DCHECK(network); 829 DCHECK(network);
834 network->UpdateNetworkStatus(); 830 network->UpdateNetworkStatus();
835 } 831 }
836 832
837 static void DataPlanUpdateHandler(void* object, 833 static void DataPlanUpdateHandler(void* object,
838 const char* modem_service_path, 834 const char* modem_service_path,
839 const CellularDataPlanList* dataplan) { 835 const CellularDataPlanList* dataplan) {
840 NetworkLibraryImpl* network = static_cast<NetworkLibraryImpl*>(object); 836 NetworkLibraryImpl* network = static_cast<NetworkLibraryImpl*>(object);
841 DCHECK(network); 837 DCHECK(network);
842 // Store data plan for currently connected cellular network. 838 // Store data plan for currently connected cellular network.
843 if (network->cellular_service_path().compare(modem_service_path) == 0) { 839 if (network->cellular_network().service_path()
840 .compare(modem_service_path) == 0) {
844 if (dataplan != NULL) { 841 if (dataplan != NULL) {
845 network->UpdateCellularDataPlan(*dataplan); 842 network->UpdateCellularDataPlan(*dataplan);
846 } 843 }
847 } 844 }
848 } 845 }
849 846
850 static void ParseSystem(SystemInfo* system, 847 static void ParseSystem(SystemInfo* system,
851 EthernetNetwork* ethernet, 848 EthernetNetwork* ethernet,
852 WifiNetworkVector* wifi_networks, 849 WifiNetworkVector* wifi_networks,
853 CellularNetworkVector* cellular_networks, 850 CellularNetworkVector* cellular_networks,
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 public: 1167 public:
1171 NetworkLibraryStubImpl() : ip_address_("1.1.1.1") {} 1168 NetworkLibraryStubImpl() : ip_address_("1.1.1.1") {}
1172 ~NetworkLibraryStubImpl() {} 1169 ~NetworkLibraryStubImpl() {}
1173 void AddObserver(Observer* observer) {} 1170 void AddObserver(Observer* observer) {}
1174 void RemoveObserver(Observer* observer) {} 1171 void RemoveObserver(Observer* observer) {}
1175 virtual const EthernetNetwork& ethernet_network() const { 1172 virtual const EthernetNetwork& ethernet_network() const {
1176 return ethernet_; 1173 return ethernet_;
1177 } 1174 }
1178 virtual bool ethernet_connecting() const { return false; } 1175 virtual bool ethernet_connecting() const { return false; }
1179 virtual bool ethernet_connected() const { return true; } 1176 virtual bool ethernet_connected() const { return true; }
1180 virtual const std::string& wifi_name() const { return EmptyString(); } 1177 virtual const WifiNetwork& wifi_network() const {
1178 return wifi_;
1179 }
1181 virtual bool wifi_connecting() const { return false; } 1180 virtual bool wifi_connecting() const { return false; }
1182 virtual bool wifi_connected() const { return false; } 1181 virtual bool wifi_connected() const { return false; }
1183 virtual int wifi_strength() const { return 0; } 1182 virtual const CellularNetwork& cellular_network() const {
1184 1183 return cellular_;
1185 virtual const std::string& cellular_name() const { return EmptyString(); } 1184 }
1186 virtual const std::string& cellular_service_path() const {
1187 return EmptyString(); }
1188 virtual bool cellular_connecting() const { return false; } 1185 virtual bool cellular_connecting() const { return false; }
1189 virtual bool cellular_connected() const { return false; } 1186 virtual bool cellular_connected() const { return false; }
1190 virtual int cellular_strength() const { return false; }
1191 1187
1192 bool Connected() const { return true; } 1188 bool Connected() const { return true; }
1193 bool Connecting() const { return false; } 1189 bool Connecting() const { return false; }
1194 const std::string& IPAddress() const { return ip_address_; } 1190 const std::string& IPAddress() const { return ip_address_; }
1195 virtual const WifiNetworkVector& wifi_networks() const { 1191 virtual const WifiNetworkVector& wifi_networks() const {
1196 return wifi_networks_; 1192 return wifi_networks_;
1197 } 1193 }
1198 virtual const WifiNetworkVector& remembered_wifi_networks() const { 1194 virtual const WifiNetworkVector& remembered_wifi_networks() const {
1199 return wifi_networks_; 1195 return wifi_networks_;
1200 } 1196 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 virtual void EnableOfflineMode(bool enable) {} 1240 virtual void EnableOfflineMode(bool enable) {}
1245 virtual NetworkIPConfigVector GetIPConfigs(const std::string& device_path) { 1241 virtual NetworkIPConfigVector GetIPConfigs(const std::string& device_path) {
1246 return NetworkIPConfigVector(); 1242 return NetworkIPConfigVector();
1247 } 1243 }
1248 virtual std::string GetHtmlInfo(int refresh) { return std::string(); } 1244 virtual std::string GetHtmlInfo(int refresh) { return std::string(); }
1249 virtual void UpdateSystemInfo() {} 1245 virtual void UpdateSystemInfo() {}
1250 1246
1251 private: 1247 private:
1252 std::string ip_address_; 1248 std::string ip_address_;
1253 EthernetNetwork ethernet_; 1249 EthernetNetwork ethernet_;
1250 WifiNetwork wifi_;
1251 CellularNetwork cellular_;
1254 WifiNetworkVector wifi_networks_; 1252 WifiNetworkVector wifi_networks_;
1255 CellularNetworkVector cellular_networks_; 1253 CellularNetworkVector cellular_networks_;
1256 }; 1254 };
1257 1255
1258 // static 1256 // static
1259 NetworkLibrary* NetworkLibrary::GetImpl(bool stub) { 1257 NetworkLibrary* NetworkLibrary::GetImpl(bool stub) {
1260 if (stub) 1258 if (stub)
1261 return new NetworkLibraryStubImpl(); 1259 return new NetworkLibraryStubImpl();
1262 else 1260 else
1263 return new NetworkLibraryImpl(); 1261 return new NetworkLibraryImpl();
1264 } 1262 }
1265 1263
1266 } // namespace chromeos 1264 } // namespace chromeos
1267 1265
1268 // Allows InvokeLater without adding refcounting. This class is a Singleton and 1266 // Allows InvokeLater without adding refcounting. This class is a Singleton and
1269 // won't be deleted until it's last InvokeLater is run. 1267 // won't be deleted until it's last InvokeLater is run.
1270 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImpl); 1268 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImpl);
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/network_library.h ('k') | chrome/browser/chromeos/login/network_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698