| OLD | NEW |
| 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 "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 LOG(INFO) << "Getting initial CrOS network info."; | 639 LOG(INFO) << "Getting initial CrOS network info."; |
| 640 UpdateSystemInfo(); | 640 UpdateSystemInfo(); |
| 641 | 641 |
| 642 LOG(INFO) << "Registering for network status updates."; | 642 LOG(INFO) << "Registering for network status updates."; |
| 643 // Now, register to receive updates on network status. | 643 // Now, register to receive updates on network status. |
| 644 network_status_connection_ = MonitorNetwork(&NetworkStatusChangedHandler, | 644 network_status_connection_ = MonitorNetwork(&NetworkStatusChangedHandler, |
| 645 this); | 645 this); |
| 646 } | 646 } |
| 647 | 647 |
| 648 void NetworkLibraryImpl::UpdateSystemInfo() { | 648 void NetworkLibraryImpl::UpdateSystemInfo() { |
| 649 UpdateNetworkStatus(); | 649 if (CrosLibrary::Get()->EnsureLoaded()) { |
| 650 UpdateNetworkStatus(); |
| 651 } |
| 650 } | 652 } |
| 651 | 653 |
| 652 WifiNetwork* NetworkLibraryImpl::GetPreferredNetwork() { | 654 WifiNetwork* NetworkLibraryImpl::GetPreferredNetwork() { |
| 653 // First look for Google-A then look for Google. | 655 // First look for Google-A then look for Google. |
| 654 // Only care if set to auto-connect. | 656 // Only care if set to auto-connect. |
| 655 WifiNetwork* wifi = GetWifiNetworkByName(kGoogleAWifi); | 657 WifiNetwork* wifi = GetWifiNetworkByName(kGoogleAWifi); |
| 656 // If wifi found and set to not auto-connect, then ignore it. | 658 // If wifi found and set to not auto-connect, then ignore it. |
| 657 if (wifi && !wifi->auto_connect()) | 659 if (wifi && !wifi->auto_connect()) |
| 658 wifi = NULL; | 660 wifi = NULL; |
| 659 | 661 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 if (ethernet_connected()) | 814 if (ethernet_connected()) |
| 813 return ethernet_.ip_address(); | 815 return ethernet_.ip_address(); |
| 814 if (wifi_connected()) | 816 if (wifi_connected()) |
| 815 return wifi_.ip_address(); | 817 return wifi_.ip_address(); |
| 816 if (cellular_connected()) | 818 if (cellular_connected()) |
| 817 return cellular_.ip_address(); | 819 return cellular_.ip_address(); |
| 818 return ethernet_.ip_address(); | 820 return ethernet_.ip_address(); |
| 819 } | 821 } |
| 820 | 822 |
| 821 } // namespace chromeos | 823 } // namespace chromeos |
| OLD | NEW |