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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_ 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_ 7 #pragma once 8 9 #include "base/basictypes.h" 10 #include "base/compiler_specific.h" 11 #include "chrome/browser/chromeos/cros/network_library.h" 12 #include "net/base/network_change_notifier.h" 13 14 namespace chromeos { 15 16 class NetworkChangeNotifierChromeos 17 : public net::NetworkChangeNotifier, 18 public chromeos::NetworkLibrary::NetworkManagerObserver, 19 public chromeos::NetworkLibrary::NetworkObserver { 20 public: 21 NetworkChangeNotifierChromeos(); 22 virtual ~NetworkChangeNotifierChromeos(); 23 24 private: 25 // NetworkChangeNotifier overrides. 26 virtual bool IsCurrentlyOffline() const OVERRIDE; 27 28 // NetworkManagerObserver overrides: 29 virtual void OnNetworkManagerChanged(chromeos::NetworkLibrary* obj) OVERRIDE; 30 31 // NetworkObserver overrides: 32 virtual void OnNetworkChanged(chromeos::NetworkLibrary* cros, 33 const chromeos::Network* network) OVERRIDE; 34 35 // Updates data members that keep the track the network stack state. 36 void UpdateNetworkState(chromeos::NetworkLibrary* cros); 37 38 // True if we previously had an active network around. 39 bool has_active_network_; 40 // Current active network's connectivity state. 41 chromeos::ConnectivityState connectivity_state_; 42 // Current active network's service path. 43 std::string service_path_; 44 // Current active network's IP address. 45 std::string ip_address_; 46 47 ScopedRunnableMethodFactory<NetworkChangeNotifierChromeos> method_factory_; 48 49 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierChromeos); 50 }; 51 52 } // namespace net 53 54 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_ 55