Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: net/base/network_change_notifier_linux.cc

Issue 739983005: Determine connection type in NetworkChangeNotifierLinux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f77025a33d8904750a0d3e227c59f7086305c09b..dfdea59a006d8de65845ed8e2ffc3e849cb43d54 100644
--- a/net/base/network_change_notifier_linux.cc
+++ b/net/base/network_change_notifier_linux.cc
@@ -12,6 +12,10 @@
namespace net {
+namespace {
+NetworkChangeNotifierLinux* g_instance;
+} // namespace
+
class NetworkChangeNotifierLinux::Thread : public base::Thread {
public:
Thread();
@@ -27,6 +31,17 @@ class NetworkChangeNotifierLinux::Thread : public base::Thread {
return &address_tracker_;
}
+ bool AddNetifToIgnore(const std::string& netif_name) {
+ return address_tracker_.AddNetifToIgnore(netif_name);
+ }
+ bool RemoveNetifToIgnore(const std::string& netif_name) {
+ return address_tracker_.RemoveNetifToIgnore(netif_name);
+ }
+
+ std::string GetPrimaryNetif() const {
+ return address_tracker_.GetPrimaryNetif();
+ };
+
protected:
// base::Thread
void Init() override;
@@ -66,7 +81,12 @@ void NetworkChangeNotifierLinux::Thread::CleanUp() {
}
NetworkChangeNotifierLinux* NetworkChangeNotifierLinux::Create() {
- return new NetworkChangeNotifierLinux();
+ g_instance = new NetworkChangeNotifierLinux();
+ return g_instance;
+}
+
+NetworkChangeNotifierLinux* NetworkChangeNotifierLinux::GetInstance() {
+ return g_instance;
}
NetworkChangeNotifierLinux::NetworkChangeNotifierLinux()
@@ -99,11 +119,30 @@ NetworkChangeNotifierLinux::NetworkChangeCalculatorParamsLinux() {
return params;
}
+scoped_refptr<base::MessageLoopProxy>
+NetworkChangeNotifierLinux::GetMessageLoopProxy() const {
+ return notifier_thread_->message_loop_proxy();
+}
+
NetworkChangeNotifier::ConnectionType
NetworkChangeNotifierLinux::GetCurrentConnectionType() const {
return notifier_thread_->GetCurrentConnectionType();
}
+bool NetworkChangeNotifierLinux::AddNetifToIgnore(
+ const std::string& netif_name) {
+ return notifier_thread_->AddNetifToIgnore(netif_name);
+}
+
+bool NetworkChangeNotifierLinux::RemoveNetifToIgnore(
+ const std::string& netif_name) {
+ return notifier_thread_->RemoveNetifToIgnore(netif_name);
+}
+
+std::string NetworkChangeNotifierLinux::GetPrimaryNetif() const {
+ return notifier_thread_->GetPrimaryNetif();
+}
+
const internal::AddressTrackerLinux*
NetworkChangeNotifierLinux::GetAddressTrackerInternal() const {
return notifier_thread_->address_tracker();
« net/base/network_change_notifier_linux.h ('K') | « net/base/network_change_notifier_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698