| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_SERVICE_NET_SERVICE_NETWORK_CHANGE_NOTIFIER_THREAD_H_ | |
| 6 #define CHROME_SERVICE_NET_SERVICE_NETWORK_CHANGE_NOTIFIER_THREAD_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/ref_counted.h" | |
| 10 #include "base/scoped_ptr.h" | |
| 11 #include "chrome/common/net/network_change_notifier_thread.h" | |
| 12 | |
| 13 class MessageLoop; | |
| 14 | |
| 15 namespace net { | |
| 16 class NetworkChangeNotifier; | |
| 17 } // namespace net | |
| 18 | |
| 19 // This is a simple implementation of NetworkChangeNotifierThread. | |
| 20 // Note that Initialize MUST be called before this class can be used. | |
| 21 class ServiceNetworkChangeNotifierThread | |
| 22 : public chrome_common_net::NetworkChangeNotifierThread, | |
| 23 public base::RefCountedThreadSafe<ServiceNetworkChangeNotifierThread> { | |
| 24 public: | |
| 25 // Does not take ownership of |io_thread_message_loop|. This instance must | |
| 26 // live no longer than |io_thread_message_loop|. | |
| 27 // TODO(sanjeevr): Change NetworkChangeNotifierThread to use MessageLoopProxy | |
| 28 explicit ServiceNetworkChangeNotifierThread( | |
| 29 MessageLoop* io_thread_message_loop); | |
| 30 virtual ~ServiceNetworkChangeNotifierThread(); | |
| 31 | |
| 32 // Initialize MUST be called before this class can be used. | |
| 33 void Initialize(); | |
| 34 | |
| 35 // chrome_common_net::NetworkChangeNotifierThread implementation. | |
| 36 | |
| 37 virtual MessageLoop* GetMessageLoop() const; | |
| 38 | |
| 39 virtual net::NetworkChangeNotifier* GetNetworkChangeNotifier() const; | |
| 40 | |
| 41 private: | |
| 42 MessageLoop* const io_thread_message_loop_; | |
| 43 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | |
| 44 | |
| 45 void CreateNetworkChangeNotifier(); | |
| 46 DISALLOW_COPY_AND_ASSIGN(ServiceNetworkChangeNotifierThread); | |
| 47 }; | |
| 48 | |
| 49 #endif // CHROME_SERVICE_NET_SERVICE_NETWORK_CHANGE_NOTIFIER_THREAD_H_ | |
| 50 | |
| OLD | NEW |