| 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 // This is a small utility that watches for and logs network changes. | 5 // This is a small utility that watches for and logs network changes. | 
| 6 | 6 | 
| 7 #include <string> | 7 #include <string> | 
| 8 | 8 | 
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" | 
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" | 
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 163   base::MessageLoopForIO network_loop; | 163   base::MessageLoopForIO network_loop; | 
| 164 | 164 | 
| 165   NetWatcher net_watcher; | 165   NetWatcher net_watcher; | 
| 166 | 166 | 
| 167 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 167 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 
| 168   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 168   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 
| 169   std::string ignored_netifs_str = | 169   std::string ignored_netifs_str = | 
| 170       command_line->GetSwitchValueASCII(kIgnoreNetifFlag); | 170       command_line->GetSwitchValueASCII(kIgnoreNetifFlag); | 
| 171   base::hash_set<std::string> ignored_interfaces; | 171   base::hash_set<std::string> ignored_interfaces; | 
| 172   if (!ignored_netifs_str.empty()) { | 172   if (!ignored_netifs_str.empty()) { | 
| 173     std::vector<std::string> ignored_netifs; | 173     for (const std::string& ignored_netif : | 
| 174     base::SplitString(ignored_netifs_str, ',', &ignored_netifs); | 174          base::SplitString(ignored_netifs_str, ",", base::TRIM_WHITESPACE, | 
| 175     for (const std::string& ignored_netif : ignored_netifs) { | 175                            base::SPLIT_WANT_ALL)) { | 
| 176       LOG(INFO) << "Ignoring: " << ignored_netif; | 176       LOG(INFO) << "Ignoring: " << ignored_netif; | 
| 177       ignored_interfaces.insert(ignored_netif); | 177       ignored_interfaces.insert(ignored_netif); | 
| 178     } | 178     } | 
| 179   } | 179   } | 
| 180   scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( | 180   scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( | 
| 181       new net::NetworkChangeNotifierLinux(ignored_interfaces)); | 181       new net::NetworkChangeNotifierLinux(ignored_interfaces)); | 
| 182 #else | 182 #else | 
| 183   scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( | 183   scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( | 
| 184       net::NetworkChangeNotifier::Create()); | 184       net::NetworkChangeNotifier::Create()); | 
| 185 #endif | 185 #endif | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 218   proxy_config_service->RemoveObserver(&net_watcher); | 218   proxy_config_service->RemoveObserver(&net_watcher); | 
| 219 | 219 | 
| 220   // Uses |network_change_notifier|. | 220   // Uses |network_change_notifier|. | 
| 221   net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); | 221   net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); | 
| 222   net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); | 222   net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); | 
| 223   net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); | 223   net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); | 
| 224   net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); | 224   net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); | 
| 225 | 225 | 
| 226   return 0; | 226   return 0; | 
| 227 } | 227 } | 
| OLD | NEW | 
|---|