| 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" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 cert_loader_->RemoveObserver(this); | 150 cert_loader_->RemoveObserver(this); |
| 151 if (LoginState::IsInitialized()) | 151 if (LoginState::IsInitialized()) |
| 152 LoginState::Get()->RemoveObserver(this); | 152 LoginState::Get()->RemoveObserver(this); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void NetworkConnectionHandler::Init( | 155 void NetworkConnectionHandler::Init( |
| 156 NetworkStateHandler* network_state_handler, | 156 NetworkStateHandler* network_state_handler, |
| 157 NetworkConfigurationHandler* network_configuration_handler) { | 157 NetworkConfigurationHandler* network_configuration_handler) { |
| 158 if (LoginState::IsInitialized()) { | 158 if (LoginState::IsInitialized()) { |
| 159 LoginState::Get()->AddObserver(this); | 159 LoginState::Get()->AddObserver(this); |
| 160 logged_in_ = | 160 logged_in_ = LoginState::Get()->IsUserLoggedIn(); |
| 161 LoginState::Get()->GetLoggedInState() == LoginState::LOGGED_IN_ACTIVE; | |
| 162 } | 161 } |
| 163 if (CertLoader::IsInitialized()) { | 162 if (CertLoader::IsInitialized()) { |
| 164 cert_loader_ = CertLoader::Get(); | 163 cert_loader_ = CertLoader::Get(); |
| 165 cert_loader_->AddObserver(this); | 164 cert_loader_->AddObserver(this); |
| 166 certificates_loaded_ = cert_loader_->certificates_loaded(); | 165 certificates_loaded_ = cert_loader_->certificates_loaded(); |
| 167 } else { | 166 } else { |
| 168 // TODO(stevenjb): Require a mock or stub cert_loader in tests. | 167 // TODO(stevenjb): Require a mock or stub cert_loader in tests. |
| 169 certificates_loaded_ = true; | 168 certificates_loaded_ = true; |
| 170 } | 169 } |
| 171 if (network_state_handler) { | 170 if (network_state_handler) { |
| 172 network_state_handler_ = network_state_handler; | 171 network_state_handler_ = network_state_handler; |
| 173 network_state_handler_->AddObserver(this, FROM_HERE); | 172 network_state_handler_->AddObserver(this, FROM_HERE); |
| 174 } | 173 } |
| 175 network_configuration_handler_ = network_configuration_handler; | 174 network_configuration_handler_ = network_configuration_handler; |
| 176 } | 175 } |
| 177 | 176 |
| 178 void NetworkConnectionHandler::LoggedInStateChanged( | 177 void NetworkConnectionHandler::LoggedInStateChanged() { |
| 179 LoginState::LoggedInState state) { | 178 if (LoginState::Get()->IsUserLoggedIn()) { |
| 180 if (state == LoginState::LOGGED_IN_ACTIVE) { | |
| 181 logged_in_ = true; | 179 logged_in_ = true; |
| 182 NET_LOG_EVENT("Logged In", ""); | 180 NET_LOG_EVENT("Logged In", ""); |
| 183 } | 181 } |
| 184 } | 182 } |
| 185 | 183 |
| 186 void NetworkConnectionHandler::OnCertificatesLoaded( | 184 void NetworkConnectionHandler::OnCertificatesLoaded( |
| 187 const net::CertificateList& cert_list, | 185 const net::CertificateList& cert_list, |
| 188 bool initial_load) { | 186 bool initial_load) { |
| 189 certificates_loaded_ = true; | 187 certificates_loaded_ = true; |
| 190 NET_LOG_EVENT("Certificates Loaded", ""); | 188 NET_LOG_EVENT("Certificates Loaded", ""); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 | 648 |
| 651 void NetworkConnectionHandler::HandleShillDisconnectSuccess( | 649 void NetworkConnectionHandler::HandleShillDisconnectSuccess( |
| 652 const std::string& service_path, | 650 const std::string& service_path, |
| 653 const base::Closure& success_callback) { | 651 const base::Closure& success_callback) { |
| 654 NET_LOG_EVENT("Disconnect Request Sent", service_path); | 652 NET_LOG_EVENT("Disconnect Request Sent", service_path); |
| 655 if (!success_callback.is_null()) | 653 if (!success_callback.is_null()) |
| 656 success_callback.Run(); | 654 success_callback.Run(); |
| 657 } | 655 } |
| 658 | 656 |
| 659 } // namespace chromeos | 657 } // namespace chromeos |
| OLD | NEW |