| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/base/network_change_notifier_linux.h" | 5 #include "net/base/network_change_notifier_linux.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "net/base/address_tracker_linux.h" | 10 #include "net/base/address_tracker_linux.h" |
| 11 #include "net/dns/dns_config_service.h" | 11 #include "net/dns/dns_config_service.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 class NetworkChangeNotifierLinux::Thread : public base::Thread { | 15 class NetworkChangeNotifierLinux::Thread : public base::Thread { |
| 16 public: | 16 public: |
| 17 Thread(); | 17 Thread(); |
| 18 ~Thread() override; | 18 ~Thread() override; |
| 19 | 19 |
| 20 // Plumbing for NetworkChangeNotifier::GetCurrentConnectionType. | 20 // Plumbing for NetworkChangeNotifier::GetCurrentConnectionType. |
| 21 // Safe to call from any thread. | 21 // Safe to call from any thread. |
| 22 NetworkChangeNotifier::ConnectionType GetCurrentConnectionType() { | 22 NetworkChangeNotifier::ConnectionType GetCurrentConnectionType() { |
| 23 return address_tracker_.GetCurrentConnectionType(); | 23 return address_tracker_.GetCurrentConnectionType(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 std::string GetCurrentWiFiSSID() { |
| 27 return address_tracker_.GetCurrentWiFiSSID(); |
| 28 } |
| 29 |
| 26 const internal::AddressTrackerLinux* address_tracker() const { | 30 const internal::AddressTrackerLinux* address_tracker() const { |
| 27 return &address_tracker_; | 31 return &address_tracker_; |
| 28 } | 32 } |
| 29 | 33 |
| 30 protected: | 34 protected: |
| 31 // base::Thread | 35 // base::Thread |
| 32 void Init() override; | 36 void Init() override; |
| 33 void CleanUp() override; | 37 void CleanUp() override; |
| 34 | 38 |
| 35 private: | 39 private: |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 base::TimeDelta::FromMilliseconds(1500); | 119 base::TimeDelta::FromMilliseconds(1500); |
| 116 params.connection_type_online_delay_ = base::TimeDelta::FromMilliseconds(500); | 120 params.connection_type_online_delay_ = base::TimeDelta::FromMilliseconds(500); |
| 117 return params; | 121 return params; |
| 118 } | 122 } |
| 119 | 123 |
| 120 NetworkChangeNotifier::ConnectionType | 124 NetworkChangeNotifier::ConnectionType |
| 121 NetworkChangeNotifierLinux::GetCurrentConnectionType() const { | 125 NetworkChangeNotifierLinux::GetCurrentConnectionType() const { |
| 122 return notifier_thread_->GetCurrentConnectionType(); | 126 return notifier_thread_->GetCurrentConnectionType(); |
| 123 } | 127 } |
| 124 | 128 |
| 129 std::string NetworkChangeNotifierLinux::GetCurrentWiFiSSID() const { |
| 130 return notifier_thread_->GetCurrentWiFiSSID(); |
| 131 } |
| 132 |
| 125 const internal::AddressTrackerLinux* | 133 const internal::AddressTrackerLinux* |
| 126 NetworkChangeNotifierLinux::GetAddressTrackerInternal() const { | 134 NetworkChangeNotifierLinux::GetAddressTrackerInternal() const { |
| 127 return notifier_thread_->address_tracker(); | 135 return notifier_thread_->address_tracker(); |
| 128 } | 136 } |
| 129 | 137 |
| 130 } // namespace net | 138 } // namespace net |
| OLD | NEW |