OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <dbus/dbus-glib.h> | 7 #include <dbus/dbus-glib.h> |
8 #include <dbus/dbus-gtype-specialized.h> | 8 #include <dbus/dbus-gtype-specialized.h> |
9 #include <glib-object.h> | 9 #include <glib-object.h> |
10 | 10 |
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 // Returns the IP address for the active network. | 2165 // Returns the IP address for the active network. |
2166 // TODO(stevenjb): Fix this for VPNs. See chromium-os:13972. | 2166 // TODO(stevenjb): Fix this for VPNs. See chromium-os:13972. |
2167 const std::string& NetworkLibraryImplBase::IPAddress() const { | 2167 const std::string& NetworkLibraryImplBase::IPAddress() const { |
2168 const Network* result = active_network(); | 2168 const Network* result = active_network(); |
2169 if (!result) | 2169 if (!result) |
2170 result = connected_network(); // happens if we are connected to a VPN. | 2170 result = connected_network(); // happens if we are connected to a VPN. |
2171 if (!result) | 2171 if (!result) |
2172 result = ethernet_; // Use non active ethernet addr if no active network. | 2172 result = ethernet_; // Use non active ethernet addr if no active network. |
2173 if (result) | 2173 if (result) |
2174 return result->ip_address(); | 2174 return result->ip_address(); |
2175 static std::string null_address("0.0.0.0"); | 2175 CR_DEFINE_STATIC_LOCAL(std::string, null_address, ("0.0.0.0")); |
2176 return null_address; | 2176 return null_address; |
2177 } | 2177 } |
2178 | 2178 |
2179 ///////////////////////////////////////////////////////////////////////////// | 2179 ///////////////////////////////////////////////////////////////////////////// |
2180 | 2180 |
2181 const NetworkDevice* NetworkLibraryImplBase::FindNetworkDeviceByPath( | 2181 const NetworkDevice* NetworkLibraryImplBase::FindNetworkDeviceByPath( |
2182 const std::string& path) const { | 2182 const std::string& path) const { |
2183 NetworkDeviceMap::const_iterator iter = device_map_.find(path); | 2183 NetworkDeviceMap::const_iterator iter = device_map_.find(path); |
2184 if (iter != device_map_.end()) | 2184 if (iter != device_map_.end()) |
2185 return iter->second; | 2185 return iter->second; |
(...skipping 2971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5157 return impl; | 5157 return impl; |
5158 } | 5158 } |
5159 | 5159 |
5160 ///////////////////////////////////////////////////////////////////////////// | 5160 ///////////////////////////////////////////////////////////////////////////// |
5161 | 5161 |
5162 } // namespace chromeos | 5162 } // namespace chromeos |
5163 | 5163 |
5164 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 5164 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
5165 // won't be deleted until its last InvokeLater is run. | 5165 // won't be deleted until its last InvokeLater is run. |
5166 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); | 5166 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); |
OLD | NEW |