| 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 "net/http/http_auth_controller.h" | 5 #include "net/http/http_auth_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 return handler_.get() && !identity_.invalid; | 428 return handler_.get() && !identity_.invalid; |
| 429 } | 429 } |
| 430 | 430 |
| 431 void HttpAuthController::InvalidateCurrentHandler( | 431 void HttpAuthController::InvalidateCurrentHandler( |
| 432 InvalidateHandlerAction action) { | 432 InvalidateHandlerAction action) { |
| 433 DCHECK(CalledOnValidThread()); | 433 DCHECK(CalledOnValidThread()); |
| 434 DCHECK(handler_.get()); | 434 DCHECK(handler_.get()); |
| 435 | 435 |
| 436 if (action == INVALIDATE_HANDLER_AND_CACHED_CREDENTIALS) | 436 if (action == INVALIDATE_HANDLER_AND_CACHED_CREDENTIALS) |
| 437 InvalidateRejectedAuthFromCache(); | 437 InvalidateRejectedAuthFromCache(); |
| 438 if (action == INVALIDATE_HANDLER_AND_DISABLE_SCHEME) | 438 if (action == INVALIDATE_HANDLER_AND_DISABLE_SCHEME) { |
| 439 DisableAuthScheme(handler_->auth_scheme()); | 439 DisableAuthScheme(handler_->auth_scheme()); |
| 440 // This scheme might have been tried with the default credentials, but |
| 441 // the *next* one is still allowed to try them. |
| 442 default_credentials_used_ = false; |
| 443 } |
| 440 handler_.reset(); | 444 handler_.reset(); |
| 441 identity_ = HttpAuth::Identity(); | 445 identity_ = HttpAuth::Identity(); |
| 442 } | 446 } |
| 443 | 447 |
| 444 void HttpAuthController::InvalidateRejectedAuthFromCache() { | 448 void HttpAuthController::InvalidateRejectedAuthFromCache() { |
| 445 DCHECK(CalledOnValidThread()); | 449 DCHECK(CalledOnValidThread()); |
| 446 DCHECK(HaveAuth()); | 450 DCHECK(HaveAuth()); |
| 447 | 451 |
| 448 // Clear the cache entry for the identity we just failed on. | 452 // Clear the cache entry for the identity we just failed on. |
| 449 // Note: we require the credentials to match before invalidating | 453 // Note: we require the credentials to match before invalidating |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 DCHECK(CalledOnValidThread()); | 573 DCHECK(CalledOnValidThread()); |
| 570 disabled_schemes_.insert(scheme); | 574 disabled_schemes_.insert(scheme); |
| 571 } | 575 } |
| 572 | 576 |
| 573 void HttpAuthController::DisableEmbeddedIdentity() { | 577 void HttpAuthController::DisableEmbeddedIdentity() { |
| 574 DCHECK(CalledOnValidThread()); | 578 DCHECK(CalledOnValidThread()); |
| 575 embedded_identity_used_ = true; | 579 embedded_identity_used_ = true; |
| 576 } | 580 } |
| 577 | 581 |
| 578 } // namespace net | 582 } // namespace net |
| OLD | NEW |