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" |
11 #include "net/dns/dns_config_service.h" | 11 #include "net/dns/dns_config_service.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 class NetworkChangeNotifierLinux::Thread : public base::Thread { | 15 class NetworkChangeNotifierLinux::Thread : public base::Thread { |
16 public: | 16 public: |
17 Thread(); | 17 Thread(); |
18 virtual ~Thread(); | 18 ~Thread() override; |
19 | 19 |
20 // Plumbing for NetworkChangeNotifier::GetCurrentConnectionType. | 20 // Plumbing for NetworkChangeNotifier::GetCurrentConnectionType. |
21 // Safe to call from any thread. | 21 // Safe to call from any thread. |
22 NetworkChangeNotifier::ConnectionType GetCurrentConnectionType() { | 22 NetworkChangeNotifier::ConnectionType GetCurrentConnectionType() { |
23 return address_tracker_.GetCurrentConnectionType(); | 23 return address_tracker_.GetCurrentConnectionType(); |
24 } | 24 } |
25 | 25 |
26 const internal::AddressTrackerLinux* address_tracker() const { | 26 const internal::AddressTrackerLinux* address_tracker() const { |
27 return &address_tracker_; | 27 return &address_tracker_; |
28 } | 28 } |
29 | 29 |
30 protected: | 30 protected: |
31 // base::Thread | 31 // base::Thread |
32 virtual void Init() override; | 32 void Init() override; |
33 virtual void CleanUp() override; | 33 void CleanUp() override; |
34 | 34 |
35 private: | 35 private: |
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() |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 NetworkChangeNotifierLinux::GetCurrentConnectionType() const { | 103 NetworkChangeNotifierLinux::GetCurrentConnectionType() const { |
104 return notifier_thread_->GetCurrentConnectionType(); | 104 return notifier_thread_->GetCurrentConnectionType(); |
105 } | 105 } |
106 | 106 |
107 const internal::AddressTrackerLinux* | 107 const internal::AddressTrackerLinux* |
108 NetworkChangeNotifierLinux::GetAddressTrackerInternal() const { | 108 NetworkChangeNotifierLinux::GetAddressTrackerInternal() const { |
109 return notifier_thread_->address_tracker(); | 109 return notifier_thread_->address_tracker(); |
110 } | 110 } |
111 | 111 |
112 } // namespace net | 112 } // namespace net |
OLD | NEW |