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" |
(...skipping 25 matching lines...) Expand all Loading... |
36 scoped_ptr<DnsConfigService> dns_config_service_; | 36 scoped_ptr<DnsConfigService> dns_config_service_; |
37 // Used to detect online/offline state and IP address changes. | 37 // Used to detect online/offline state and IP address changes. |
38 internal::AddressTrackerLinux address_tracker_; | 38 internal::AddressTrackerLinux address_tracker_; |
39 | 39 |
40 DISALLOW_COPY_AND_ASSIGN(Thread); | 40 DISALLOW_COPY_AND_ASSIGN(Thread); |
41 }; | 41 }; |
42 | 42 |
43 NetworkChangeNotifierLinux::Thread::Thread() | 43 NetworkChangeNotifierLinux::Thread::Thread() |
44 : base::Thread("NetworkChangeNotifier"), | 44 : base::Thread("NetworkChangeNotifier"), |
45 address_tracker_( | 45 address_tracker_( |
46 base::Bind(&NetworkChangeNotifier:: | 46 base::Bind(&NetworkChangeNotifier::NotifyObserversOfIPAddressChange), |
47 NotifyObserversOfIPAddressChange), | 47 base::Bind( |
48 base::Bind(&NetworkChangeNotifier:: | 48 &NetworkChangeNotifier::NotifyObserversOfConnectionTypeChange), |
49 NotifyObserversOfConnectionTypeChange), | |
50 base::Bind(base::DoNothing)) { | 49 base::Bind(base::DoNothing)) { |
51 } | 50 } |
52 | 51 |
53 NetworkChangeNotifierLinux::Thread::~Thread() { | 52 NetworkChangeNotifierLinux::Thread::~Thread() { |
54 DCHECK(!Thread::IsRunning()); | 53 DCHECK(!Thread::IsRunning()); |
55 } | 54 } |
56 | 55 |
57 void NetworkChangeNotifierLinux::Thread::Init() { | 56 void NetworkChangeNotifierLinux::Thread::Init() { |
58 address_tracker_.Init(); | 57 address_tracker_.Init(); |
59 dns_config_service_ = DnsConfigService::CreateSystemService(); | 58 dns_config_service_ = DnsConfigService::CreateSystemService(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 NetworkChangeNotifierLinux::GetCurrentConnectionType() const { | 102 NetworkChangeNotifierLinux::GetCurrentConnectionType() const { |
104 return notifier_thread_->GetCurrentConnectionType(); | 103 return notifier_thread_->GetCurrentConnectionType(); |
105 } | 104 } |
106 | 105 |
107 const internal::AddressTrackerLinux* | 106 const internal::AddressTrackerLinux* |
108 NetworkChangeNotifierLinux::GetAddressTrackerInternal() const { | 107 NetworkChangeNotifierLinux::GetAddressTrackerInternal() const { |
109 return notifier_thread_->address_tracker(); | 108 return notifier_thread_->address_tracker(); |
110 } | 109 } |
111 | 110 |
112 } // namespace net | 111 } // namespace net |
OLD | NEW |