| 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 implementation of NetworkChangeNotifier's offline state detection | 5 // This implementation of NetworkChangeNotifier's offline state detection |
| 6 // depends on D-Bus and NetworkManager, and is known to work on at least | 6 // depends on D-Bus and NetworkManager, and is known to work on at least |
| 7 // GNOME version 2.30. If D-Bus or NetworkManager are unavailable, this | 7 // GNOME version 2.30. If D-Bus or NetworkManager are unavailable, this |
| 8 // implementation will always behave as if it is online. | 8 // implementation will always behave as if it is online. |
| 9 | 9 |
| 10 #include "net/base/network_change_notifier_linux.h" | 10 #include "net/base/network_change_notifier_linux.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 base::Bind(&NetworkChangeNotifier:: | 278 base::Bind(&NetworkChangeNotifier:: |
| 279 NotifyObserversOfIPAddressChange)) { | 279 NotifyObserversOfIPAddressChange)) { |
| 280 } | 280 } |
| 281 | 281 |
| 282 NetworkChangeNotifierLinux::Thread::~Thread() { | 282 NetworkChangeNotifierLinux::Thread::~Thread() { |
| 283 DCHECK(!Thread::IsRunning()); | 283 DCHECK(!Thread::IsRunning()); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void NetworkChangeNotifierLinux::Thread::Init() { | 286 void NetworkChangeNotifierLinux::Thread::Init() { |
| 287 network_manager_api_.Init(); | 287 network_manager_api_.Init(); |
| 288 address_tracker_.Init(); |
| 288 dns_config_service_ = DnsConfigService::CreateSystemService(); | 289 dns_config_service_ = DnsConfigService::CreateSystemService(); |
| 289 dns_config_service_->WatchConfig( | 290 dns_config_service_->WatchConfig( |
| 290 base::Bind(&NetworkChangeNotifier::SetDnsConfig)); | 291 base::Bind(&NetworkChangeNotifier::SetDnsConfig)); |
| 291 address_tracker_.Init(); | |
| 292 } | 292 } |
| 293 | 293 |
| 294 void NetworkChangeNotifierLinux::Thread::CleanUp() { | 294 void NetworkChangeNotifierLinux::Thread::CleanUp() { |
| 295 network_manager_api_.CleanUp(); | 295 network_manager_api_.CleanUp(); |
| 296 dns_config_service_.reset(); | 296 dns_config_service_.reset(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 NetworkChangeNotifierLinux* NetworkChangeNotifierLinux::Create() { | 299 NetworkChangeNotifierLinux* NetworkChangeNotifierLinux::Create() { |
| 300 return new NetworkChangeNotifierLinux(NULL); | 300 return new NetworkChangeNotifierLinux(NULL); |
| 301 } | 301 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 324 NetworkChangeNotifierLinux::GetCurrentConnectionType() const { | 324 NetworkChangeNotifierLinux::GetCurrentConnectionType() const { |
| 325 return notifier_thread_->GetCurrentConnectionType(); | 325 return notifier_thread_->GetCurrentConnectionType(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 const internal::AddressTrackerLinux* | 328 const internal::AddressTrackerLinux* |
| 329 NetworkChangeNotifierLinux::GetAddressTrackerInternal() const { | 329 NetworkChangeNotifierLinux::GetAddressTrackerInternal() const { |
| 330 return notifier_thread_->address_tracker(); | 330 return notifier_thread_->address_tracker(); |
| 331 } | 331 } |
| 332 | 332 |
| 333 } // namespace net | 333 } // namespace net |
| OLD | NEW |