| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ | 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ |
| 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ | 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "net/base/net_export.h" |
| 12 #include "net/base/network_change_notifier.h" | 13 #include "net/base/network_change_notifier.h" |
| 13 | 14 |
| 15 namespace dbus { |
| 16 class Bus; |
| 17 } |
| 18 |
| 14 namespace net { | 19 namespace net { |
| 15 | 20 |
| 16 class NetworkChangeNotifierLinux : public NetworkChangeNotifier { | 21 class NET_EXPORT_PRIVATE NetworkChangeNotifierLinux |
| 22 : public NetworkChangeNotifier { |
| 17 public: | 23 public: |
| 18 NetworkChangeNotifierLinux(); | 24 static NetworkChangeNotifierLinux* Create(); |
| 25 |
| 26 // Unittests inject a mock bus. |
| 27 static NetworkChangeNotifierLinux* CreateForTest(dbus::Bus* bus); |
| 19 | 28 |
| 20 private: | 29 private: |
| 21 class Thread; | 30 class Thread; |
| 22 | 31 |
| 32 explicit NetworkChangeNotifierLinux(dbus::Bus* bus); |
| 23 virtual ~NetworkChangeNotifierLinux(); | 33 virtual ~NetworkChangeNotifierLinux(); |
| 24 | 34 |
| 25 // NetworkChangeNotifier: | 35 // NetworkChangeNotifier: |
| 26 virtual bool IsCurrentlyOffline() const OVERRIDE; | 36 virtual bool IsCurrentlyOffline() const OVERRIDE; |
| 27 | 37 |
| 28 // The thread used to listen for notifications. This relays the notification | 38 // The thread used to listen for notifications. This relays the notification |
| 29 // to the registered observers without posting back to the thread the object | 39 // to the registered observers without posting back to the thread the object |
| 30 // was created on. | 40 // was created on. |
| 31 scoped_ptr<Thread> notifier_thread_; | 41 scoped_ptr<Thread> notifier_thread_; |
| 32 | 42 |
| 33 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierLinux); | 43 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierLinux); |
| 34 }; | 44 }; |
| 35 | 45 |
| 36 } // namespace net | 46 } // namespace net |
| 37 | 47 |
| 38 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ | 48 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ |
| OLD | NEW |