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

Side by Side Diff: chromeos/network/network_connection_handler.cc

Issue 22674011: Handle connecting to hidden networks correctly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + Address feedback Created 7 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/network/network_connection_handler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Clear any existing queued connect request. 224 // Clear any existing queued connect request.
225 queued_connect_.reset(); 225 queued_connect_.reset();
226 if (HasConnectingNetwork(service_path)) { 226 if (HasConnectingNetwork(service_path)) {
227 NET_LOG_USER("Connect Request While Pending", service_path); 227 NET_LOG_USER("Connect Request While Pending", service_path);
228 InvokeErrorCallback(service_path, error_callback, kErrorConnecting); 228 InvokeErrorCallback(service_path, error_callback, kErrorConnecting);
229 return; 229 return;
230 } 230 }
231 231
232 // Check cached network state for connected, connecting, or unactivated 232 // Check cached network state for connected, connecting, or unactivated
233 // networks. These states will not be affected by a recent configuration. 233 // networks. These states will not be affected by a recent configuration.
234 // Note: NetworkState may not exist for a network that was recently
235 // configured, in which case these checks do not apply anyway.
234 const NetworkState* network = 236 const NetworkState* network =
235 network_state_handler_->GetNetworkState(service_path); 237 network_state_handler_->GetNetworkState(service_path);
236 if (!network) {
237 InvokeErrorCallback(service_path, error_callback, kErrorNotFound);
238 return;
239 }
240 if (network->IsConnectedState()) {
241 InvokeErrorCallback(service_path, error_callback, kErrorConnected);
242 return;
243 }
244 if (network->IsConnectingState()) {
245 InvokeErrorCallback(service_path, error_callback, kErrorConnecting);
246 return;
247 }
248 if (NetworkRequiresActivation(network)) {
249 InvokeErrorCallback(service_path, error_callback, kErrorActivationRequired);
250 return;
251 }
252 238
253 if (check_error_state) { 239 if (network) {
254 const std::string& error = network->error(); 240 // For existing networks, perform some immediate consistency checks.
255 if (error == flimflam::kErrorConnectFailed) { 241 if (network->IsConnectedState()) {
256 InvokeErrorCallback( 242 InvokeErrorCallback(service_path, error_callback, kErrorConnected);
257 service_path, error_callback, kErrorPassphraseRequired);
258 return; 243 return;
259 } 244 }
260 if (error == flimflam::kErrorBadPassphrase) { 245 if (network->IsConnectingState()) {
261 InvokeErrorCallback( 246 InvokeErrorCallback(service_path, error_callback, kErrorConnecting);
262 service_path, error_callback, kErrorPassphraseRequired); 247 return;
248 }
249 if (NetworkRequiresActivation(network)) {
250 InvokeErrorCallback(service_path, error_callback,
251 kErrorActivationRequired);
263 return; 252 return;
264 } 253 }
265 254
266 if (IsAuthenticationError(error)) { 255 if (check_error_state) {
267 InvokeErrorCallback( 256 const std::string& error = network->error();
268 service_path, error_callback, kErrorAuthenticationRequired); 257 if (error == flimflam::kErrorConnectFailed) {
269 return; 258 InvokeErrorCallback(
259 service_path, error_callback, kErrorPassphraseRequired);
260 return;
261 }
262 if (error == flimflam::kErrorBadPassphrase) {
263 InvokeErrorCallback(
264 service_path, error_callback, kErrorPassphraseRequired);
265 return;
266 }
267 if (IsAuthenticationError(error)) {
268 InvokeErrorCallback(
269 service_path, error_callback, kErrorAuthenticationRequired);
270 return;
271 }
270 } 272 }
271 } 273 }
272 274
273 // All synchronous checks passed, add |service_path| to connecting list. 275 // All synchronous checks passed, add |service_path| to connecting list.
274 pending_requests_.insert(std::make_pair( 276 pending_requests_.insert(std::make_pair(
275 service_path, 277 service_path,
276 ConnectRequest(service_path, success_callback, error_callback))); 278 ConnectRequest(service_path, success_callback, error_callback)));
277 279
278 // Connect immediately to 'connectable' networks. 280 if (network) {
279 // TODO(stevenjb): Shill needs to properly set Connectable for VPN. 281 // Connect immediately to 'connectable' networks.
280 if (network->connectable() && network->type() != flimflam::kTypeVPN) { 282 // TODO(stevenjb): Shill needs to properly set Connectable for VPN.
281 CallShillConnect(service_path); 283 if (network->connectable() && network->type() != flimflam::kTypeVPN) {
pneubeck (no reviews) 2013/08/12 18:32:44 NIT: combine the two ifs
282 return; 284 CallShillConnect(service_path);
283 } 285 return;
284 286 }
285 if (network->type() == flimflam::kTypeCellular ||
286 (network->type() == flimflam::kTypeWifi &&
287 network->security() == flimflam::kSecurityNone)) {
288 NET_LOG_ERROR("Network has no security but is not 'Connectable'",
289 service_path);
290 CallShillConnect(service_path);
291 return;
292 } 287 }
293 288
294 // Request additional properties to check. VerifyConfiguredAndConnect will 289 // Request additional properties to check. VerifyConfiguredAndConnect will
295 // use only these properties, not cached properties, to ensure that they 290 // use only these properties, not cached properties, to ensure that they
296 // are up to date after any recent configuration. 291 // are up to date after any recent configuration.
297 network_configuration_handler_->GetProperties( 292 network_configuration_handler_->GetProperties(
298 network->path(), 293 service_path,
299 base::Bind(&NetworkConnectionHandler::VerifyConfiguredAndConnect, 294 base::Bind(&NetworkConnectionHandler::VerifyConfiguredAndConnect,
300 AsWeakPtr(), check_error_state), 295 AsWeakPtr(), check_error_state),
301 base::Bind(&NetworkConnectionHandler::HandleConfigurationFailure, 296 base::Bind(&NetworkConnectionHandler::HandleConfigurationFailure,
302 AsWeakPtr(), service_path)); 297 AsWeakPtr(), service_path));
303 } 298 }
304 299
305 void NetworkConnectionHandler::DisconnectNetwork( 300 void NetworkConnectionHandler::DisconnectNetwork(
306 const std::string& service_path, 301 const std::string& service_path,
307 const base::Closure& success_callback, 302 const base::Closure& success_callback,
308 const network_handler::ErrorCallback& error_callback) { 303 const network_handler::ErrorCallback& error_callback) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 CheckAllPendingRequests(); 339 CheckAllPendingRequests();
345 } 340 }
346 341
347 void NetworkConnectionHandler::NetworkPropertiesUpdated( 342 void NetworkConnectionHandler::NetworkPropertiesUpdated(
348 const NetworkState* network) { 343 const NetworkState* network) {
349 if (HasConnectingNetwork(network->path())) 344 if (HasConnectingNetwork(network->path()))
350 CheckPendingRequest(network->path()); 345 CheckPendingRequest(network->path());
351 } 346 }
352 347
353 NetworkConnectionHandler::ConnectRequest* 348 NetworkConnectionHandler::ConnectRequest*
354 NetworkConnectionHandler::pending_request( 349 NetworkConnectionHandler::GetPendingRequest(const std::string& service_path) {
355 const std::string& service_path) {
356 std::map<std::string, ConnectRequest>::iterator iter = 350 std::map<std::string, ConnectRequest>::iterator iter =
357 pending_requests_.find(service_path); 351 pending_requests_.find(service_path);
358 return iter != pending_requests_.end() ? &(iter->second) : NULL; 352 return iter != pending_requests_.end() ? &(iter->second) : NULL;
359 } 353 }
360 354
361 // ConnectToNetwork implementation 355 // ConnectToNetwork implementation
362 356
363 void NetworkConnectionHandler::VerifyConfiguredAndConnect( 357 void NetworkConnectionHandler::VerifyConfiguredAndConnect(
364 bool check_error_state, 358 bool check_error_state,
365 const std::string& service_path, 359 const std::string& service_path,
366 const base::DictionaryValue& service_properties) { 360 const base::DictionaryValue& service_properties) {
367 NET_LOG_EVENT("VerifyConfiguredAndConnect", service_path); 361 NET_LOG_EVENT("VerifyConfiguredAndConnect", service_path);
368 362
369 // If 'passphrase_required' is still true, then the 'Passphrase' property 363 // If 'passphrase_required' is still true, then the 'Passphrase' property
370 // has not been set to a minimum length value. 364 // has not been set to a minimum length value.
371 bool passphrase_required = false; 365 bool passphrase_required = false;
372 service_properties.GetBooleanWithoutPathExpansion( 366 service_properties.GetBooleanWithoutPathExpansion(
373 flimflam::kPassphraseRequiredProperty, &passphrase_required); 367 flimflam::kPassphraseRequiredProperty, &passphrase_required);
374 if (passphrase_required) { 368 if (passphrase_required) {
375 ErrorCallbackForPendingRequest(service_path, kErrorPassphraseRequired); 369 ErrorCallbackForPendingRequest(service_path, kErrorPassphraseRequired);
376 return; 370 return;
377 } 371 }
378 372
379 std::string type; 373 std::string type, security;
380 service_properties.GetStringWithoutPathExpansion( 374 service_properties.GetStringWithoutPathExpansion(
381 flimflam::kTypeProperty, &type); 375 flimflam::kTypeProperty, &type);
376 service_properties.GetStringWithoutPathExpansion(
377 flimflam::kSecurityProperty, &security);
378 bool connectable = false;
379 service_properties.GetBooleanWithoutPathExpansion(
380 flimflam::kConnectableProperty, &connectable);
381
382 // In case NetworkState was not available in ConnectToNetwork (e.g. it had
383 // been recently configured), we need to check Connectable again.
384 if (connectable && type != flimflam::kTypeVPN) {
385 // TODO(stevenjb): Shill needs to properly set Connectable for VPN.
386 CallShillConnect(service_path);
387 return;
388 }
382 389
383 // Get VPN provider type and host (required for configuration) and ensure 390 // Get VPN provider type and host (required for configuration) and ensure
384 // that required VPN non-cert properties are set. 391 // that required VPN non-cert properties are set.
385 std::string vpn_provider_type, vpn_provider_host; 392 std::string vpn_provider_type, vpn_provider_host;
386 if (type == flimflam::kTypeVPN) { 393 if (type == flimflam::kTypeVPN) {
387 // VPN Provider values are read from the "Provider" dictionary, not the 394 // VPN Provider values are read from the "Provider" dictionary, not the
388 // "Provider.Type", etc keys (which are used only to set the values). 395 // "Provider.Type", etc keys (which are used only to set the values).
389 const base::DictionaryValue* provider_properties; 396 const base::DictionaryValue* provider_properties;
390 if (service_properties.GetDictionaryWithoutPathExpansion( 397 if (service_properties.GetDictionaryWithoutPathExpansion(
391 flimflam::kProviderProperty, &provider_properties)) { 398 flimflam::kProviderProperty, &provider_properties)) {
(...skipping 10 matching lines...) Expand all
402 if (!VPNIsConfigured( 409 if (!VPNIsConfigured(
403 service_path, vpn_provider_type, *provider_properties)) { 410 service_path, vpn_provider_type, *provider_properties)) {
404 NET_LOG_ERROR("VPN Not Configured", service_path); 411 NET_LOG_ERROR("VPN Not Configured", service_path);
405 ErrorCallbackForPendingRequest(service_path, kErrorConfigurationRequired); 412 ErrorCallbackForPendingRequest(service_path, kErrorConfigurationRequired);
406 return; 413 return;
407 } 414 }
408 } 415 }
409 416
410 client_cert::ConfigType client_cert_type = client_cert::CONFIG_TYPE_NONE; 417 client_cert::ConfigType client_cert_type = client_cert::CONFIG_TYPE_NONE;
411 if (type == flimflam::kTypeVPN) { 418 if (type == flimflam::kTypeVPN) {
412 if (vpn_provider_type == flimflam::kProviderOpenVpn) 419 if (vpn_provider_type == flimflam::kProviderOpenVpn)
413 client_cert_type = client_cert::CONFIG_TYPE_OPENVPN; 420 client_cert_type = client_cert::CONFIG_TYPE_OPENVPN;
414 else 421 else
415 client_cert_type = client_cert::CONFIG_TYPE_IPSEC; 422 client_cert_type = client_cert::CONFIG_TYPE_IPSEC;
416 } else if (type == flimflam::kTypeWifi) { 423 } else if (type == flimflam::kTypeWifi &&
424 security == flimflam::kSecurity8021x) {
417 client_cert_type = client_cert::CONFIG_TYPE_EAP; 425 client_cert_type = client_cert::CONFIG_TYPE_EAP;
418 } 426 }
419 427
420 base::DictionaryValue config_properties; 428 base::DictionaryValue config_properties;
421 if (client_cert_type != client_cert::CONFIG_TYPE_NONE) { 429 if (client_cert_type != client_cert::CONFIG_TYPE_NONE) {
422 // If the client certificate must be configured, this will be set to a 430 // If the client certificate must be configured, this will be set to a
423 // non-empty string. 431 // non-empty string.
424 std::string pkcs11_id; 432 std::string pkcs11_id;
425 433
426 // Check certificate properties in kUIDataProperty if configured. 434 // Check certificate properties in kUIDataProperty if configured.
427 // Note: Wifi/VPNConfigView set these properties explicitly, in which case 435 // Note: Wifi/VPNConfigView set these properties explicitly, in which case
428 // only the TPM must be configured. 436 // only the TPM must be configured.
429 scoped_ptr<NetworkUIData> ui_data = 437 scoped_ptr<NetworkUIData> ui_data =
430 ManagedNetworkConfigurationHandler::GetUIData(service_properties); 438 ManagedNetworkConfigurationHandler::GetUIData(service_properties);
431 if (ui_data && ui_data->certificate_type() == CLIENT_CERT_TYPE_PATTERN) { 439 if (ui_data && ui_data->certificate_type() == CLIENT_CERT_TYPE_PATTERN) {
432 // User must be logged in to connect to a network requiring a certificate. 440 // User must be logged in to connect to a network requiring a certificate.
433 if (!logged_in_ || !cert_loader_) { 441 if (!logged_in_ || !cert_loader_) {
434 ErrorCallbackForPendingRequest(service_path, kErrorCertificateRequired); 442 ErrorCallbackForPendingRequest(service_path, kErrorCertificateRequired);
435 return; 443 return;
436 } 444 }
437 445
438 // If certificates have not been loaded yet, queue the connect request. 446 // If certificates have not been loaded yet, queue the connect request.
439 if (!certificates_loaded_) { 447 if (!certificates_loaded_) {
440 ConnectRequest* request = pending_request(service_path); 448 ConnectRequest* request = GetPendingRequest(service_path);
441 DCHECK(request); 449 if (!request) {
450 NET_LOG_ERROR("No pending request to queue", service_path);
451 return;
452 }
442 NET_LOG_EVENT("Connect Request Queued", service_path); 453 NET_LOG_EVENT("Connect Request Queued", service_path);
443 queued_connect_.reset(new ConnectRequest( 454 queued_connect_.reset(new ConnectRequest(
444 service_path, request->success_callback, request->error_callback)); 455 service_path, request->success_callback, request->error_callback));
445 pending_requests_.erase(service_path); 456 pending_requests_.erase(service_path);
446 return; 457 return;
447 } 458 }
448 459
449 pkcs11_id = CertificateIsConfigured(ui_data.get()); 460 pkcs11_id = CertificateIsConfigured(ui_data.get());
450 // Ensure the certificate is available and configured. 461 // Ensure the certificate is available and configured.
451 if (!cert_loader_->IsHardwareBacked() || pkcs11_id.empty()) { 462 if (!cert_loader_->IsHardwareBacked() || pkcs11_id.empty()) {
(...skipping 24 matching lines...) Expand all
476 CopyStringFromDictionary(service_properties, flimflam::kNameProperty, 487 CopyStringFromDictionary(service_properties, flimflam::kNameProperty,
477 &config_properties); 488 &config_properties);
478 CopyStringFromDictionary(service_properties, flimflam::kGuidProperty, 489 CopyStringFromDictionary(service_properties, flimflam::kGuidProperty,
479 &config_properties); 490 &config_properties);
480 if (type == flimflam::kTypeVPN) { 491 if (type == flimflam::kTypeVPN) {
481 config_properties.SetStringWithoutPathExpansion( 492 config_properties.SetStringWithoutPathExpansion(
482 flimflam::kProviderTypeProperty, vpn_provider_type); 493 flimflam::kProviderTypeProperty, vpn_provider_type);
483 config_properties.SetStringWithoutPathExpansion( 494 config_properties.SetStringWithoutPathExpansion(
484 flimflam::kProviderHostProperty, vpn_provider_host); 495 flimflam::kProviderHostProperty, vpn_provider_host);
485 } else if (type == flimflam::kTypeWifi) { 496 } else if (type == flimflam::kTypeWifi) {
486 CopyStringFromDictionary(service_properties, flimflam::kSecurityProperty, 497 config_properties.SetStringWithoutPathExpansion(
487 &config_properties); 498 flimflam::kSecurityProperty, security);
488 } 499 }
489 500
490 network_configuration_handler_->SetProperties( 501 network_configuration_handler_->SetProperties(
491 service_path, 502 service_path,
492 config_properties, 503 config_properties,
493 base::Bind(&NetworkConnectionHandler::CallShillConnect, 504 base::Bind(&NetworkConnectionHandler::CallShillConnect,
494 AsWeakPtr(), service_path), 505 AsWeakPtr(), service_path),
495 base::Bind(&NetworkConnectionHandler::HandleConfigurationFailure, 506 base::Bind(&NetworkConnectionHandler::HandleConfigurationFailure,
496 AsWeakPtr(), service_path)); 507 AsWeakPtr(), service_path));
497 return; 508 return;
(...skipping 17 matching lines...) Expand all
515 base::Bind(&NetworkConnectionHandler::HandleShillConnectSuccess, 526 base::Bind(&NetworkConnectionHandler::HandleShillConnectSuccess,
516 AsWeakPtr(), service_path), 527 AsWeakPtr(), service_path),
517 base::Bind(&NetworkConnectionHandler::HandleShillConnectFailure, 528 base::Bind(&NetworkConnectionHandler::HandleShillConnectFailure,
518 AsWeakPtr(), service_path)); 529 AsWeakPtr(), service_path));
519 } 530 }
520 531
521 void NetworkConnectionHandler::HandleConfigurationFailure( 532 void NetworkConnectionHandler::HandleConfigurationFailure(
522 const std::string& service_path, 533 const std::string& service_path,
523 const std::string& error_name, 534 const std::string& error_name,
524 scoped_ptr<base::DictionaryValue> error_data) { 535 scoped_ptr<base::DictionaryValue> error_data) {
525 ConnectRequest* request = pending_request(service_path); 536 ConnectRequest* request = GetPendingRequest(service_path);
526 DCHECK(request); 537 if (!request) {
538 NET_LOG_ERROR("HandleConfigurationFailure called with no pending request.",
539 service_path);
540 return;
541 }
527 network_handler::ErrorCallback error_callback = request->error_callback; 542 network_handler::ErrorCallback error_callback = request->error_callback;
528 pending_requests_.erase(service_path); 543 pending_requests_.erase(service_path);
529 if (!error_callback.is_null()) 544 if (!error_callback.is_null())
530 error_callback.Run(kErrorConfigureFailed, error_data.Pass()); 545 error_callback.Run(kErrorConfigureFailed, error_data.Pass());
531 } 546 }
532 547
533 void NetworkConnectionHandler::HandleShillConnectSuccess( 548 void NetworkConnectionHandler::HandleShillConnectSuccess(
534 const std::string& service_path) { 549 const std::string& service_path) {
535 ConnectRequest* request = pending_request(service_path); 550 ConnectRequest* request = GetPendingRequest(service_path);
536 DCHECK(request); 551 if (!request) {
552 NET_LOG_ERROR("HandleShillConnectSuccess called with no pending request.",
553 service_path);
554 return;
555 }
537 request->connect_state = ConnectRequest::CONNECT_STARTED; 556 request->connect_state = ConnectRequest::CONNECT_STARTED;
538 NET_LOG_EVENT("Connect Request Acknowledged", service_path); 557 NET_LOG_EVENT("Connect Request Acknowledged", service_path);
539 // Do not call success_callback here, wait for one of the following 558 // Do not call success_callback here, wait for one of the following
540 // conditions: 559 // conditions:
541 // * State transitions to a non connecting state indicating succes or failure 560 // * State transitions to a non connecting state indicating succes or failure
542 // * Network is no longer in the visible list, indicating failure 561 // * Network is no longer in the visible list, indicating failure
543 CheckPendingRequest(service_path); 562 CheckPendingRequest(service_path);
544 } 563 }
545 564
546 void NetworkConnectionHandler::HandleShillConnectFailure( 565 void NetworkConnectionHandler::HandleShillConnectFailure(
547 const std::string& service_path, 566 const std::string& service_path,
548 const std::string& dbus_error_name, 567 const std::string& dbus_error_name,
549 const std::string& dbus_error_message) { 568 const std::string& dbus_error_message) {
550 ConnectRequest* request = pending_request(service_path); 569 ConnectRequest* request = GetPendingRequest(service_path);
551 DCHECK(request); 570 if (!request) {
571 NET_LOG_ERROR("HandleShillConnectFailure called with no pending request.",
572 service_path);
573 return;
574 }
552 network_handler::ErrorCallback error_callback = request->error_callback; 575 network_handler::ErrorCallback error_callback = request->error_callback;
553 pending_requests_.erase(service_path); 576 pending_requests_.erase(service_path);
554 network_handler::ShillErrorCallbackFunction( 577 network_handler::ShillErrorCallbackFunction(
555 kErrorConnectFailed, service_path, error_callback, 578 kErrorConnectFailed, service_path, error_callback,
556 dbus_error_name, dbus_error_message); 579 dbus_error_name, dbus_error_message);
557 } 580 }
558 581
559 void NetworkConnectionHandler::CheckPendingRequest( 582 void NetworkConnectionHandler::CheckPendingRequest(
560 const std::string service_path) { 583 const std::string service_path) {
561 ConnectRequest* request = pending_request(service_path); 584 ConnectRequest* request = GetPendingRequest(service_path);
562 DCHECK(request); 585 DCHECK(request);
563 if (request->connect_state == ConnectRequest::CONNECT_REQUESTED) 586 if (request->connect_state == ConnectRequest::CONNECT_REQUESTED)
564 return; // Request has not started, ignore update 587 return; // Request has not started, ignore update
565 const NetworkState* network = 588 const NetworkState* network =
566 network_state_handler_->GetNetworkState(service_path); 589 network_state_handler_->GetNetworkState(service_path);
567 if (!network) { 590 if (!network)
568 ErrorCallbackForPendingRequest(service_path, kErrorNotFound); 591 return; // NetworkState may not be be updated yet.
569 return; 592
570 }
571 if (network->IsConnectingState()) { 593 if (network->IsConnectingState()) {
572 request->connect_state = ConnectRequest::CONNECT_CONNECTING; 594 request->connect_state = ConnectRequest::CONNECT_CONNECTING;
573 return; 595 return;
574 } 596 }
575 if (network->IsConnectedState()) { 597 if (network->IsConnectedState()) {
576 NET_LOG_EVENT("Connect Request Succeeded", service_path); 598 NET_LOG_EVENT("Connect Request Succeeded", service_path);
577 if (!request->success_callback.is_null()) 599 if (!request->success_callback.is_null())
578 request->success_callback.Run(); 600 request->success_callback.Run();
579 pending_requests_.erase(service_path); 601 pending_requests_.erase(service_path);
580 return; 602 return;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 scoped_refptr<net::X509Certificate> matching_cert = 651 scoped_refptr<net::X509Certificate> matching_cert =
630 client_cert::GetCertificateMatch(ui_data->certificate_pattern()); 652 client_cert::GetCertificateMatch(ui_data->certificate_pattern());
631 if (!matching_cert.get()) 653 if (!matching_cert.get())
632 return std::string(); 654 return std::string();
633 return CertLoader::GetPkcs11IdForCert(*matching_cert.get()); 655 return CertLoader::GetPkcs11IdForCert(*matching_cert.get());
634 } 656 }
635 657
636 void NetworkConnectionHandler::ErrorCallbackForPendingRequest( 658 void NetworkConnectionHandler::ErrorCallbackForPendingRequest(
637 const std::string& service_path, 659 const std::string& service_path,
638 const std::string& error_name) { 660 const std::string& error_name) {
639 ConnectRequest* request = pending_request(service_path); 661 ConnectRequest* request = GetPendingRequest(service_path);
640 DCHECK(request); 662 if (!request) {
663 NET_LOG_ERROR("ErrorCallbackForPendingRequest with no pending request.",
664 service_path);
665 return;
666 }
641 // Remove the entry before invoking the callback in case it triggers a retry. 667 // Remove the entry before invoking the callback in case it triggers a retry.
642 network_handler::ErrorCallback error_callback = request->error_callback; 668 network_handler::ErrorCallback error_callback = request->error_callback;
643 pending_requests_.erase(service_path); 669 pending_requests_.erase(service_path);
644 InvokeErrorCallback(service_path, error_callback, error_name); 670 InvokeErrorCallback(service_path, error_callback, error_name);
645 } 671 }
646 672
647 // Disconnect 673 // Disconnect
648 674
649 void NetworkConnectionHandler::CallShillDisconnect( 675 void NetworkConnectionHandler::CallShillDisconnect(
650 const std::string& service_path, 676 const std::string& service_path,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 712
687 void NetworkConnectionHandler::HandleShillActivateSuccess( 713 void NetworkConnectionHandler::HandleShillActivateSuccess(
688 const std::string& service_path, 714 const std::string& service_path,
689 const base::Closure& success_callback) { 715 const base::Closure& success_callback) {
690 NET_LOG_EVENT("Activate Request Sent", service_path); 716 NET_LOG_EVENT("Activate Request Sent", service_path);
691 if (!success_callback.is_null()) 717 if (!success_callback.is_null())
692 success_callback.Run(); 718 success_callback.Run();
693 } 719 }
694 720
695 } // namespace chromeos 721 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_connection_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698