OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chromeos/network/network_connection_handler.h" | 5 #include "chromeos/network/network_connection_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "chromeos/chromeos_switches.h" | 10 #include "chromeos/chromeos_switches.h" |
11 #include "chromeos/dbus/dbus_thread_manager.h" | 11 #include "chromeos/dbus/dbus_thread_manager.h" |
12 #include "chromeos/dbus/shill_manager_client.h" | 12 #include "chromeos/dbus/shill_manager_client.h" |
13 #include "chromeos/dbus/shill_service_client.h" | 13 #include "chromeos/dbus/shill_service_client.h" |
14 #include "chromeos/network/cert_loader.h" | |
15 #include "chromeos/network/certificate_pattern_matcher.h" | 14 #include "chromeos/network/certificate_pattern_matcher.h" |
16 #include "chromeos/network/managed_network_configuration_handler.h" | 15 #include "chromeos/network/managed_network_configuration_handler.h" |
17 #include "chromeos/network/network_configuration_handler.h" | 16 #include "chromeos/network/network_configuration_handler.h" |
18 #include "chromeos/network/network_event_log.h" | 17 #include "chromeos/network/network_event_log.h" |
19 #include "chromeos/network/network_handler_callbacks.h" | 18 #include "chromeos/network/network_handler_callbacks.h" |
20 #include "chromeos/network/network_state.h" | 19 #include "chromeos/network/network_state.h" |
21 #include "chromeos/network/network_state_handler.h" | 20 #include "chromeos/network/network_state_handler.h" |
22 #include "chromeos/network/network_ui_data.h" | 21 #include "chromeos/network/network_ui_data.h" |
23 #include "dbus/object_path.h" | 22 #include "dbus/object_path.h" |
24 #include "net/cert/x509_certificate.h" | 23 #include "net/cert/x509_certificate.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 NetworkConnectionHandler::~NetworkConnectionHandler() { | 167 NetworkConnectionHandler::~NetworkConnectionHandler() { |
169 if (network_state_handler_) | 168 if (network_state_handler_) |
170 network_state_handler_->RemoveObserver(this, FROM_HERE); | 169 network_state_handler_->RemoveObserver(this, FROM_HERE); |
171 if (cert_loader_) | 170 if (cert_loader_) |
172 cert_loader_->RemoveObserver(this); | 171 cert_loader_->RemoveObserver(this); |
173 if (LoginState::IsInitialized()) | 172 if (LoginState::IsInitialized()) |
174 LoginState::Get()->RemoveObserver(this); | 173 LoginState::Get()->RemoveObserver(this); |
175 } | 174 } |
176 | 175 |
177 void NetworkConnectionHandler::Init( | 176 void NetworkConnectionHandler::Init( |
178 CertLoader* cert_loader, | |
179 NetworkStateHandler* network_state_handler, | 177 NetworkStateHandler* network_state_handler, |
180 NetworkConfigurationHandler* network_configuration_handler) { | 178 NetworkConfigurationHandler* network_configuration_handler) { |
181 if (LoginState::IsInitialized()) { | 179 if (LoginState::IsInitialized()) { |
182 LoginState::Get()->AddObserver(this); | 180 LoginState::Get()->AddObserver(this); |
183 logged_in_ = | 181 logged_in_ = |
184 LoginState::Get()->GetLoggedInState() == LoginState::LOGGED_IN_ACTIVE; | 182 LoginState::Get()->GetLoggedInState() == LoginState::LOGGED_IN_ACTIVE; |
185 } | 183 } |
186 if (cert_loader) { | 184 if (CertLoader::IsInitialized()) { |
187 cert_loader_ = cert_loader; | 185 cert_loader_ = CertLoader::Get(); |
188 cert_loader_->AddObserver(this); | 186 cert_loader_->AddObserver(this); |
189 certificates_loaded_ = cert_loader->certificates_loaded(); | 187 certificates_loaded_ = cert_loader_->certificates_loaded(); |
190 } else { | 188 } else { |
191 // TODO(stevenjb): Require a mock or stub cert_loader in tests. | 189 // TODO(stevenjb): Require a mock or stub cert_loader in tests. |
192 certificates_loaded_ = true; | 190 certificates_loaded_ = true; |
193 } | 191 } |
194 if (network_state_handler) { | 192 if (network_state_handler) { |
195 network_state_handler_ = network_state_handler; | 193 network_state_handler_ = network_state_handler; |
196 network_state_handler_->AddObserver(this, FROM_HERE); | 194 network_state_handler_->AddObserver(this, FROM_HERE); |
197 } | 195 } |
198 network_configuration_handler_ = network_configuration_handler; | 196 network_configuration_handler_ = network_configuration_handler; |
199 } | 197 } |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 | 588 |
591 void NetworkConnectionHandler::HandleShillDisconnectSuccess( | 589 void NetworkConnectionHandler::HandleShillDisconnectSuccess( |
592 const std::string& service_path, | 590 const std::string& service_path, |
593 const base::Closure& success_callback) { | 591 const base::Closure& success_callback) { |
594 NET_LOG_EVENT("Disconnect Request Sent", service_path); | 592 NET_LOG_EVENT("Disconnect Request Sent", service_path); |
595 if (!success_callback.is_null()) | 593 if (!success_callback.is_null()) |
596 success_callback.Run(); | 594 success_callback.Run(); |
597 } | 595 } |
598 | 596 |
599 } // namespace chromeos | 597 } // namespace chromeos |
OLD | NEW |