Chromium Code Reviews| 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 a4bc595ea45ab6403fa994fcf3712bd1c5268faf..349000781821032395c2ffcaff1da932179f0afa 100644 |
| --- a/net/base/network_change_notifier_linux.cc |
| +++ b/net/base/network_change_notifier_linux.cc |
| @@ -107,9 +107,9 @@ class NetworkManagerApi { |
| // Must be called by the helper thread's CleanUp() method. |
| void CleanUp(); |
| - // Implementation of NetworkChangeNotifierLinux::IsCurrentlyOffline(). |
| + // Implementation of NetworkChangeNotifierLinux::GetCurrentConnectionType(). |
| // Safe to call from any thread, but will block until Init() has completed. |
| - bool IsCurrentlyOffline(); |
| + NetworkChangeNotifier::ConnectionType GetCurrentConnectionType(); |
| private: |
| // Callbacks for D-Bus API. |
| @@ -256,12 +256,15 @@ bool NetworkManagerApi::StateIsOffline(uint32 state) { |
| } |
| } |
| -bool NetworkManagerApi::IsCurrentlyOffline() { |
| +NetworkChangeNotifier::ConnectionType |
| +NetworkManagerApi::GetCurrentConnectionType() { |
| // http://crbug.com/125097 |
| base::ThreadRestrictions::ScopedAllowWait allow_wait; |
| offline_state_initialized_.Wait(); |
| base::AutoLock lock(is_offline_lock_); |
| - return is_offline_; |
| + // TODO(droger): Return something more detailed than CONNECTION_UNKNOWN. |
| + return is_offline_ ? NetworkChangeNotifier::CONNECTION_NONE : |
| + NetworkChangeNotifier::CONNECTION_UNKNOWN; |
| } |
| class NetworkChangeNotifierLinux::Thread |
| @@ -274,10 +277,10 @@ class NetworkChangeNotifierLinux::Thread |
| virtual void OnFileCanReadWithoutBlocking(int fd); |
| virtual void OnFileCanWriteWithoutBlocking(int /* fd */); |
| - // Plumbing for NetworkChangeNotifier::IsCurrentlyOffline. |
| + // Plumbing for NetworkChangeNotifier::GetCurrentConnectionType. |
| // Safe to call from any thread. |
| - bool IsCurrentlyOffline() { |
| - return network_manager_api_.IsCurrentlyOffline(); |
| + NetworkChangeNotifier::ConnectionType GetCurrentConnectionType() { |
| + return network_manager_api_.GetCurrentConnectionType(); |
| } |
| protected: |
| @@ -308,7 +311,7 @@ class NetworkChangeNotifierLinux::Thread |
| scoped_refptr<DNSWatchDelegate> resolv_watcher_delegate_; |
| scoped_refptr<DNSWatchDelegate> hosts_watcher_delegate_; |
| - // Used to detect online/offline state changes. |
| + // Used to detect connection type changes. |
| NetworkManagerApi network_manager_api_; |
| DISALLOW_COPY_AND_ASSIGN(Thread); |
| @@ -320,7 +323,7 @@ NetworkChangeNotifierLinux::Thread::Thread(dbus::Bus* bus) |
| ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)), |
| network_manager_api_( |
| base::Bind(&NetworkChangeNotifier |
| - ::NotifyObserversOfOnlineStateChange), |
| + ::NotifyObserversOfConnectionTypeChange), |
|
wtc
2012/05/11 18:46:22
Nit: put :: on the previous line. Our convention
|
| bus) { |
| } |
| @@ -442,8 +445,9 @@ NetworkChangeNotifierLinux::~NetworkChangeNotifierLinux() { |
| notifier_thread_->Stop(); |
| } |
| -bool NetworkChangeNotifierLinux::IsCurrentlyOffline() const { |
| - return notifier_thread_->IsCurrentlyOffline(); |
| +NetworkChangeNotifier::ConnectionType |
| +NetworkChangeNotifierLinux::GetCurrentConnectionType() const { |
| + return notifier_thread_->GetCurrentConnectionType(); |
| } |
| } // namespace net |