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

Side by Side Diff: net/base/network_change_notifier_linux.h

Issue 8249008: Offline state detection for linux, using new D-Bus library. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More updates from review Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « net/base/network_change_notifier.h ('k') | net/base/network_change_notifier_linux.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) 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/network_change_notifier.h" 12 #include "net/base/network_change_notifier.h"
13 13
14 namespace dbus {
15 class Bus;
16 }
17
14 namespace net { 18 namespace net {
15 19
16 class NetworkChangeNotifierLinux : public NetworkChangeNotifier { 20 class NetworkChangeNotifierLinux : public NetworkChangeNotifier {
17 public: 21 public:
18 NetworkChangeNotifierLinux(); 22 NetworkChangeNotifierLinux();
19 23
24 // Unittests inject a mock bus.
25 static NetworkChangeNotifierLinux* CreateForTest(dbus::Bus* bus) {
satorux1 2011/10/26 18:53:15 I'm slightly worrying about inlining the function
adamk 2011/10/26 19:09:34 Done (though my memory is that clang cares more ab
26 return new NetworkChangeNotifierLinux(bus);
27 }
28
29 protected:
30
20 private: 31 private:
21 class Thread; 32 class Thread;
22 33
34 // For unittests.
35 explicit NetworkChangeNotifierLinux(dbus::Bus* bus);
36
23 virtual ~NetworkChangeNotifierLinux(); 37 virtual ~NetworkChangeNotifierLinux();
24 38
25 // NetworkChangeNotifier: 39 // NetworkChangeNotifier:
26 virtual bool IsCurrentlyOffline() const OVERRIDE; 40 virtual bool IsCurrentlyOffline() const OVERRIDE;
27 41
28 // The thread used to listen for notifications. This relays the notification 42 // The thread used to listen for notifications. This relays the notification
29 // to the registered observers without posting back to the thread the object 43 // to the registered observers without posting back to the thread the object
30 // was created on. 44 // was created on.
31 scoped_ptr<Thread> notifier_thread_; 45 scoped_ptr<Thread> notifier_thread_;
32 46
33 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierLinux); 47 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierLinux);
34 }; 48 };
35 49
36 } // namespace net 50 } // namespace net
37 51
38 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ 52 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_
OLDNEW
« no previous file with comments | « net/base/network_change_notifier.h ('k') | net/base/network_change_notifier_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698