| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 } | 380 } |
| 381 | 381 |
| 382 void NetworkLibrary::NotifyNetworkTraffic(int traffic_type) { | 382 void NetworkLibrary::NotifyNetworkTraffic(int traffic_type) { |
| 383 FOR_EACH_OBSERVER(Observer, observers_, NetworkTraffic(this, traffic_type)); | 383 FOR_EACH_OBSERVER(Observer, observers_, NetworkTraffic(this, traffic_type)); |
| 384 } | 384 } |
| 385 | 385 |
| 386 bool NetworkLibrary::Connected() const { | 386 bool NetworkLibrary::Connected() const { |
| 387 return ethernet_connected() || wifi_connected() || cellular_connected(); | 387 return ethernet_connected() || wifi_connected() || cellular_connected(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 const std::string& NetworkLibrary::IPAddress() const { |
| 391 // Returns highest priority IP address. |
| 392 if (ethernet_connected()) |
| 393 return ethernet_.ip_address; |
| 394 if (wifi_connected()) |
| 395 return wifi_.ip_address; |
| 396 if (cellular_connected()) |
| 397 return cellular_.ip_address; |
| 398 return ethernet_.ip_address; |
| 399 } |
| 400 |
| 390 } // namespace chromeos | 401 } // namespace chromeos |
| OLD | NEW |