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

Side by Side Diff: chrome/browser/chromeos/net/network_change_notifier_chromeos.h

Issue 11488011: Rename NetworkChangeNotifierChromeos to NetworkChangeNotifierNetworkLibrary (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 80 chars Created 8 years 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
OLDNEW
(Empty)
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
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
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/chromeos/cros/network_library.h"
14 #include "chromeos/dbus/root_power_manager_observer.h"
15 #include "net/base/network_change_notifier.h"
16
17 namespace chromeos {
18
19 class OnlineStatusReportThreadTask;
20
21 class NetworkChangeNotifierChromeos
22 : public net::NetworkChangeNotifier,
23 public chromeos::RootPowerManagerObserver,
24 public chromeos::NetworkLibrary::NetworkObserver,
25 public chromeos::NetworkLibrary::NetworkManagerObserver {
26 public:
27 NetworkChangeNotifierChromeos();
28 virtual ~NetworkChangeNotifierChromeos();
29
30 // Initializes the network change notifier. Starts to observe changes
31 // from the power manager and the network manager.
32 void Init();
33
34 // Shutdowns the network change notifier. Stops observing changes from
35 // the power manager and the network manager.
36 void Shutdown();
37
38 private:
39 friend class OnlineStatusReportThreadTask;
40
41 class DnsConfigServiceChromeos;
42
43 // RootPowerManagerObserver overrides:
44 virtual void OnResume(const base::TimeDelta& sleep_duration) OVERRIDE;
45
46 // NetworkChangeNotifier overrides:
47 virtual net::NetworkChangeNotifier::ConnectionType
48 GetCurrentConnectionType() const OVERRIDE;
49
50 // NetworkManagerObserver overrides:
51 virtual void OnNetworkManagerChanged(chromeos::NetworkLibrary* obj) OVERRIDE;
52
53 // NetworkObserver overrides:
54 virtual void OnNetworkChanged(chromeos::NetworkLibrary* cros,
55 const chromeos::Network* network) OVERRIDE;
56
57 // Initiate online status change reporting.
58 void ReportConnectionChange();
59 void ReportConnectionChangeOnUIThread();
60 // Callback from online_notification_task_ when online state notification
61 // is actually scheduled.
62 void OnOnlineStateNotificationFired();
63
64 // Initiates an update of data members that keep the track the network stack
65 // state.
66 void UpdateNetworkState(chromeos::NetworkLibrary* cros);
67 // Called when a network state update has completed. Updates data members that
68 // keep the track the network stack state.
69 void UpdateNetworkStateCallback(chromeos::NetworkLibrary* cros,
70 const NetworkIPConfigVector& ip_configs,
71 const std::string& hardware_address);
72 // Updates network connectivity state.
73 void UpdateConnectivityState(const chromeos::Network* network);
74
75 // Updates the initial state. Lets us trigger initial eval of the
76 // connectivity status without waiting for an event from the connection
77 // manager.
78 static void UpdateInitialState(NetworkChangeNotifierChromeos* self);
79
80 // Gets connection type for given |network|.
81 static net::NetworkChangeNotifier::ConnectionType GetNetworkConnectionType(
82 const chromeos::Network* network);
83
84 // Get parameters for calculating new combined signal.
85 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsChromeos();
86
87 // True if we previously had an active network around.
88 bool has_active_network_;
89 // Current active network's connection state.
90 chromeos::ConnectionState connection_state_;
91 // Current active network's connection type.
92 net::NetworkChangeNotifier::ConnectionType connection_type_;
93 // Current active network's service path.
94 std::string service_path_;
95 // Current active network's IP address.
96 std::string ip_address_;
97 // Current active network's name servers.
98 std::vector<std::string> name_servers_;
99
100 scoped_ptr<DnsConfigServiceChromeos> dns_config_service_;
101
102 base::WeakPtrFactory<NetworkChangeNotifierChromeos> weak_factory_;
103
104 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierChromeos);
105 };
106
107 } // namespace chromeos
108
109 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698