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

Side by Side Diff: net/tools/net_watcher/net_watcher.cc

Issue 2944313003: Remove the dependence on BrowserThread::FILE for (Closed)
Patch Set: address mmenke's comments Created 3 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | net/url_request/url_request_context_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // It prints out the current network connection type and proxy configuration 6 // It prints out the current network connection type and proxy configuration
7 // upon startup and then prints out changes as they happen. 7 // upon startup and then prints out changes as they happen.
8 // It's useful for testing NetworkChangeNotifier and ProxyConfigService. 8 // It's useful for testing NetworkChangeNotifier and ProxyConfigService.
9 // The only command line option supported is --ignore-netif which is followed 9 // The only command line option supported is --ignore-netif which is followed
10 // by a comma seperated list of network interfaces to ignore when computing 10 // by a comma seperated list of network interfaces to ignore when computing
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier( 174 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier(
175 new net::NetworkChangeNotifierLinux(ignored_interfaces)); 175 new net::NetworkChangeNotifierLinux(ignored_interfaces));
176 #else 176 #else
177 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier( 177 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier(
178 net::NetworkChangeNotifier::Create()); 178 net::NetworkChangeNotifier::Create());
179 #endif 179 #endif
180 180
181 // Use the network loop as the file loop also. 181 // Use the network loop as the file loop also.
182 std::unique_ptr<net::ProxyConfigService> proxy_config_service( 182 std::unique_ptr<net::ProxyConfigService> proxy_config_service(
183 net::ProxyService::CreateSystemProxyConfigService( 183 net::ProxyService::CreateSystemProxyConfigService(
184 network_loop.task_runner(), network_loop.task_runner())); 184 network_loop.task_runner()));
185 185
186 // Uses |network_change_notifier|. 186 // Uses |network_change_notifier|.
187 net::NetworkChangeNotifier::AddIPAddressObserver(&net_watcher); 187 net::NetworkChangeNotifier::AddIPAddressObserver(&net_watcher);
188 net::NetworkChangeNotifier::AddConnectionTypeObserver(&net_watcher); 188 net::NetworkChangeNotifier::AddConnectionTypeObserver(&net_watcher);
189 net::NetworkChangeNotifier::AddDNSObserver(&net_watcher); 189 net::NetworkChangeNotifier::AddDNSObserver(&net_watcher);
190 net::NetworkChangeNotifier::AddNetworkChangeObserver(&net_watcher); 190 net::NetworkChangeNotifier::AddNetworkChangeObserver(&net_watcher);
191 191
192 proxy_config_service->AddObserver(&net_watcher); 192 proxy_config_service->AddObserver(&net_watcher);
193 193
194 LOG(INFO) << "Initial connection type: " 194 LOG(INFO) << "Initial connection type: "
(...skipping 17 matching lines...) Expand all
212 proxy_config_service->RemoveObserver(&net_watcher); 212 proxy_config_service->RemoveObserver(&net_watcher);
213 213
214 // Uses |network_change_notifier|. 214 // Uses |network_change_notifier|.
215 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); 215 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher);
216 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); 216 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher);
217 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); 217 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher);
218 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); 218 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher);
219 219
220 return 0; 220 return 0;
221 } 221 }
OLDNEW
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | net/url_request/url_request_context_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698