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

Side by Side Diff: chromeos/network/network_change_notifier_chromeos.h

Issue 11469044: Implement new network change notifier that uses NetworkStateHandler (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix clang warning (missing virtual on OVERRIDE) 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
« no previous file with comments | « chromeos/network/managed_state.h ('k') | chromeos/network/network_change_notifier_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CHROMEOS_NETWORK_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_
6 #define CHROMEOS_NETWORK_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/network/network_state_handler_observer.h"
15 #include "net/base/network_change_notifier.h"
16
17 namespace chromeos {
18
19 class CHROMEOS_EXPORT NetworkChangeNotifierChromeos
20 : public net::NetworkChangeNotifier,
21 public chromeos::NetworkStateHandlerObserver {
22 public:
23 NetworkChangeNotifierChromeos();
24 virtual ~NetworkChangeNotifierChromeos();
25
26 // Starts observing changes from the network state handler.
27 void Initialize();
28
29 // Stops observing changes from the network state handler.
30 void Shutdown();
31
32 // NetworkChangeNotifier overrides.
33 virtual net::NetworkChangeNotifier::ConnectionType
34 GetCurrentConnectionType() const OVERRIDE;
35
36 // NetworkStateHandlerObserver overrides.
37 virtual void ActiveNetworkChanged(
38 const chromeos::NetworkState* active_network) OVERRIDE;
39 virtual void ActiveNetworkStateChanged(
40 const chromeos::NetworkState* active_network) OVERRIDE;
41
42 private:
43 FRIEND_TEST_ALL_PREFIXES(NetworkChangeNotifierChromeosTest,
44 ConnectionTypeFromShill);
45 friend class NetworkChangeNotifierChromeosUpdateTest;
46
47 class DnsConfigService;
48
49 // Updates the notifier state based on an active network update.
50 // |connection_type_changed| is set to true if we must report a connection
51 // type change.
52 // |ip_address_changed| is set to true if we must report an IP address change.
53 // |dns_changed| is set to true if we must report a DNS config change.
54 void UpdateState(const chromeos::NetworkState* active_network,
55 bool* connection_type_changed,
56 bool* ip_address_changed,
57 bool* dns_changed);
58
59 // Maps the shill network type and technology to its NetworkChangeNotifier
60 // equivalent.
61 static net::NetworkChangeNotifier::ConnectionType
62 ConnectionTypeFromShill(const std::string& type,
63 const std::string& technology);
64
65 // Calculates parameters used for network change notifier online/offline
66 // signals.
67 static net::NetworkChangeNotifier::NetworkChangeCalculatorParams
68 NetworkChangeCalculatorParamsChromeos();
69
70 NetworkChangeNotifier::ConnectionType connection_type_;
71 // IP address for the current active network.
72 std::string ip_address_;
73 // Service path for the current active network.
74 std::string service_path_;
75
76 scoped_ptr<DnsConfigService> dns_config_service_;
77
78 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierChromeos);
79 };
80
81 } // namespace chromeos
82
83 #endif // CHROMEOS_NETWORK_NETWORK_CHANGE_NOTIFIER_CHROMEOS_H_
OLDNEW
« no previous file with comments | « chromeos/network/managed_state.h ('k') | chromeos/network/network_change_notifier_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698