OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 break; | 327 break; |
328 default: | 328 default: |
329 http_auth_cache_->Add(auth_origin_, handler_->realm(), | 329 http_auth_cache_->Add(auth_origin_, handler_->realm(), |
330 handler_->scheme(), handler_->challenge(), | 330 handler_->scheme(), handler_->challenge(), |
331 identity_.username, identity_.password, | 331 identity_.username, identity_.password, |
332 auth_path_); | 332 auth_path_); |
333 break; | 333 break; |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
| 337 bool HttpAuthController::HaveAuthHandler() const { |
| 338 return handler_.get() != NULL; |
| 339 } |
| 340 |
| 341 bool HttpAuthController::HaveAuth() const { |
| 342 return handler_.get() && !identity_.invalid; |
| 343 } |
| 344 |
337 void HttpAuthController::InvalidateCurrentHandler() { | 345 void HttpAuthController::InvalidateCurrentHandler() { |
338 DCHECK(CalledOnValidThread()); | 346 DCHECK(CalledOnValidThread()); |
339 | 347 |
340 InvalidateRejectedAuthFromCache(); | 348 InvalidateRejectedAuthFromCache(); |
341 handler_.reset(); | 349 handler_.reset(); |
342 identity_ = HttpAuth::Identity(); | 350 identity_ = HttpAuth::Identity(); |
343 } | 351 } |
344 | 352 |
345 void HttpAuthController::InvalidateRejectedAuthFromCache() { | 353 void HttpAuthController::InvalidateRejectedAuthFromCache() { |
346 DCHECK(CalledOnValidThread()); | 354 DCHECK(CalledOnValidThread()); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 DCHECK(CalledOnValidThread()); | 456 DCHECK(CalledOnValidThread()); |
449 return disabled_schemes_.find(scheme) != disabled_schemes_.end(); | 457 return disabled_schemes_.find(scheme) != disabled_schemes_.end(); |
450 } | 458 } |
451 | 459 |
452 void HttpAuthController::DisableAuthScheme(const std::string& scheme) { | 460 void HttpAuthController::DisableAuthScheme(const std::string& scheme) { |
453 DCHECK(CalledOnValidThread()); | 461 DCHECK(CalledOnValidThread()); |
454 disabled_schemes_.insert(scheme); | 462 disabled_schemes_.insert(scheme); |
455 } | 463 } |
456 | 464 |
457 } // namespace net | 465 } // namespace net |
OLD | NEW |