| Index: net/base/network_change_notifier_linux.cc
|
| diff --git a/net/base/network_change_notifier_linux.cc b/net/base/network_change_notifier_linux.cc
|
| index 99167dc93610247b38ac3c6f33f3b0d3e523c896..59db24571a1dbf921543622d5859170da48faf15 100644
|
| --- a/net/base/network_change_notifier_linux.cc
|
| +++ b/net/base/network_change_notifier_linux.cc
|
| @@ -82,9 +82,9 @@ class NetworkManagerApi {
|
| // Must be called by the helper thread's CleanUp() method.
|
| void CleanUp();
|
|
|
| - // Implementation of NetworkChangeNotifierLinux::IsCurrentlyOffline().
|
| + // Implementation of NetworkChangeNotifierLinux::GetCurrentConnectionState().
|
| // Safe to call from any thread, but will block until Init() has completed.
|
| - bool IsCurrentlyOffline();
|
| + NetworkChangeNotifier::ConnectionState GetCurrentConnectionState();
|
|
|
| private:
|
| // Callbacks for D-Bus API.
|
| @@ -230,10 +230,12 @@ bool NetworkManagerApi::StateIsOffline(uint32 state) {
|
| }
|
| }
|
|
|
| -bool NetworkManagerApi::IsCurrentlyOffline() {
|
| +NetworkChangeNotifier::ConnectionState
|
| +NetworkManagerApi::GetCurrentConnectionState() {
|
| offline_state_initialized_.Wait();
|
| base::AutoLock lock(is_offline_lock_);
|
| - return is_offline_;
|
| + return is_offline_ ? NetworkChangeNotifier::NONE :
|
| + NetworkChangeNotifier::ETHERNET;
|
| }
|
|
|
| class DNSWatchDelegate : public FilePathWatcher::Delegate {
|
| @@ -270,10 +272,10 @@ class NetworkChangeNotifierLinux::Thread
|
| virtual void OnFileCanReadWithoutBlocking(int fd);
|
| virtual void OnFileCanWriteWithoutBlocking(int /* fd */);
|
|
|
| - // Plumbing for NetworkChangeNotifier::IsCurrentlyOffline.
|
| + // Plumbing for NetworkChangeNotifier::GetCurrentConnectionState.
|
| // Safe to call from any thread.
|
| - bool IsCurrentlyOffline() {
|
| - return network_manager_api_.IsCurrentlyOffline();
|
| + NetworkChangeNotifier::ConnectionState GetCurrentConnectionState() {
|
| + return network_manager_api_.GetCurrentConnectionState();
|
| }
|
|
|
| protected:
|
| @@ -290,8 +292,8 @@ class NetworkChangeNotifierLinux::Thread
|
| NetworkChangeNotifier::NotifyObserversOfDNSChange();
|
| }
|
|
|
| - static void NotifyObserversOfOnlineStateChange() {
|
| - NetworkChangeNotifier::NotifyObserversOfOnlineStateChange();
|
| + static void NotifyObserversOfConnectionStateChange() {
|
| + NetworkChangeNotifier::NotifyObserversOfConnectionStateChange();
|
| }
|
|
|
| // Starts listening for netlink messages. Also handles the messages if there
|
| @@ -315,7 +317,7 @@ class NetworkChangeNotifierLinux::Thread
|
| scoped_ptr<base::files::FilePathWatcher> hosts_file_watcher_;
|
| scoped_refptr<DNSWatchDelegate> file_watcher_delegate_;
|
|
|
| - // Used to detect online/offline state changes.
|
| + // Used to detect connection state changes.
|
| NetworkManagerApi network_manager_api_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(Thread);
|
| @@ -327,7 +329,7 @@ NetworkChangeNotifierLinux::Thread::Thread(dbus::Bus* bus)
|
| ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)),
|
| network_manager_api_(
|
| base::Bind(&NetworkChangeNotifierLinux::Thread
|
| - ::NotifyObserversOfOnlineStateChange),
|
| + ::NotifyObserversOfConnectionStateChange),
|
| bus) {
|
| }
|
|
|
| @@ -459,8 +461,9 @@ NetworkChangeNotifierLinux::~NetworkChangeNotifierLinux() {
|
| notifier_thread_->Stop();
|
| }
|
|
|
| -bool NetworkChangeNotifierLinux::IsCurrentlyOffline() const {
|
| - return notifier_thread_->IsCurrentlyOffline();
|
| +NetworkChangeNotifier::ConnectionState
|
| +NetworkChangeNotifierMac::GetCurrentConnectionState() const {
|
| + return notifier_thread_->GetCurrentConnectionState();
|
| }
|
|
|
| } // namespace net
|
|
|