OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chromeos/dbus/dbus_thread_manager.h" | 10 #include "chromeos/dbus/dbus_thread_manager.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 NetworkChangeNotifierChromeos::NetworkChangeNotifierChromeos() | 51 NetworkChangeNotifierChromeos::NetworkChangeNotifierChromeos() |
52 : NetworkChangeNotifier(NetworkChangeCalculatorParamsChromeos()), | 52 : NetworkChangeNotifier(NetworkChangeCalculatorParamsChromeos()), |
53 connection_type_(CONNECTION_NONE) { | 53 connection_type_(CONNECTION_NONE) { |
54 } | 54 } |
55 | 55 |
56 NetworkChangeNotifierChromeos::~NetworkChangeNotifierChromeos() { | 56 NetworkChangeNotifierChromeos::~NetworkChangeNotifierChromeos() { |
57 } | 57 } |
58 | 58 |
59 void NetworkChangeNotifierChromeos::Initialize() { | 59 void NetworkChangeNotifierChromeos::Initialize() { |
60 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); | 60 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); |
61 NetworkStateHandler::Get()->AddObserver(this); | 61 NetworkHandler::Get()->network_state_handler()->AddObserver(this); |
62 | 62 |
63 dns_config_service_.reset(new DnsConfigService()); | 63 dns_config_service_.reset(new DnsConfigService()); |
64 dns_config_service_->WatchConfig( | 64 dns_config_service_->WatchConfig( |
65 base::Bind(net::NetworkChangeNotifier::SetDnsConfig)); | 65 base::Bind(net::NetworkChangeNotifier::SetDnsConfig)); |
66 | 66 |
67 // Update initial connection state. | 67 // Update initial connection state. |
68 DefaultNetworkChanged(NetworkStateHandler::Get()->DefaultNetwork()); | 68 DefaultNetworkChanged( |
| 69 NetworkHandler::Get()->network_state_handler()->DefaultNetwork()); |
69 } | 70 } |
70 | 71 |
71 void NetworkChangeNotifierChromeos::Shutdown() { | 72 void NetworkChangeNotifierChromeos::Shutdown() { |
72 dns_config_service_.reset(); | 73 dns_config_service_.reset(); |
73 if (NetworkStateHandler::Get()) | 74 NetworkHandler::Get()->network_state_handler()->RemoveObserver(this); |
74 NetworkStateHandler::Get()->RemoveObserver(this); | |
75 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 75 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
76 } | 76 } |
77 | 77 |
78 net::NetworkChangeNotifier::ConnectionType | 78 net::NetworkChangeNotifier::ConnectionType |
79 NetworkChangeNotifierChromeos::GetCurrentConnectionType() const { | 79 NetworkChangeNotifierChromeos::GetCurrentConnectionType() const { |
80 return connection_type_; | 80 return connection_type_; |
81 } | 81 } |
82 | 82 |
83 void NetworkChangeNotifierChromeos::SystemResumed( | 83 void NetworkChangeNotifierChromeos::SystemResumed( |
84 const base::TimeDelta& sleep_duration) { | 84 const base::TimeDelta& sleep_duration) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // produce a single signal when switching between network connections. | 203 // produce a single signal when switching between network connections. |
204 params.ip_address_offline_delay_ = base::TimeDelta::FromMilliseconds(4000); | 204 params.ip_address_offline_delay_ = base::TimeDelta::FromMilliseconds(4000); |
205 params.ip_address_online_delay_ = base::TimeDelta::FromMilliseconds(1000); | 205 params.ip_address_online_delay_ = base::TimeDelta::FromMilliseconds(1000); |
206 params.connection_type_offline_delay_ = | 206 params.connection_type_offline_delay_ = |
207 base::TimeDelta::FromMilliseconds(500); | 207 base::TimeDelta::FromMilliseconds(500); |
208 params.connection_type_online_delay_ = base::TimeDelta::FromMilliseconds(500); | 208 params.connection_type_online_delay_ = base::TimeDelta::FromMilliseconds(500); |
209 return params; | 209 return params; |
210 } | 210 } |
211 | 211 |
212 } // namespace chromeos | 212 } // namespace chromeos |
213 | |
OLD | NEW |