| 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/threading/platform_thread.h" |
| 9 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 10 #include "net/base/auth.h" | 11 #include "net/base/auth.h" |
| 11 #include "net/base/host_resolver.h" | 12 #include "net/base/host_resolver.h" |
| 12 #include "net/base/net_util.h" | 13 #include "net/base/net_util.h" |
| 13 #include "net/http/http_auth_handler.h" | 14 #include "net/http/http_auth_handler.h" |
| 14 #include "net/http/http_auth_handler_factory.h" | 15 #include "net/http/http_auth_handler_factory.h" |
| 15 #include "net/http/http_network_session.h" | 16 #include "net/http/http_network_session.h" |
| 16 #include "net/http/http_request_headers.h" | 17 #include "net/http/http_request_headers.h" |
| 17 #include "net/http/http_request_info.h" | 18 #include "net/http/http_request_info.h" |
| 18 #include "net/http/http_response_headers.h" | 19 #include "net/http/http_response_headers.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 84 } |
| 84 | 85 |
| 85 // Records the number of authentication events per authentication scheme. | 86 // Records the number of authentication events per authentication scheme. |
| 86 void HistogramAuthEvent(HttpAuthHandler* handler, AuthEvent auth_event) { | 87 void HistogramAuthEvent(HttpAuthHandler* handler, AuthEvent auth_event) { |
| 87 #if !defined(NDEBUG) | 88 #if !defined(NDEBUG) |
| 88 // Note: The on-same-thread check is intentionally not using a lock | 89 // Note: The on-same-thread check is intentionally not using a lock |
| 89 // to protect access to first_thread. This method is meant to be only | 90 // to protect access to first_thread. This method is meant to be only |
| 90 // used on the same thread, in which case there are no race conditions. If | 91 // used on the same thread, in which case there are no race conditions. If |
| 91 // there are race conditions (say, a read completes during a partial write), | 92 // there are race conditions (say, a read completes during a partial write), |
| 92 // the DCHECK will correctly fail. | 93 // the DCHECK will correctly fail. |
| 93 static PlatformThreadId first_thread = PlatformThread::CurrentId(); | 94 static base::PlatformThreadId first_thread = base::PlatformThread::CurrentId()
; |
| 94 DCHECK_EQ(first_thread, PlatformThread::CurrentId()); | 95 DCHECK_EQ(first_thread, base::PlatformThread::CurrentId()); |
| 95 #endif | 96 #endif |
| 96 | 97 |
| 97 HttpAuthHandler::AuthScheme auth_scheme = handler->auth_scheme(); | 98 HttpAuthHandler::AuthScheme auth_scheme = handler->auth_scheme(); |
| 98 DCHECK(auth_scheme >= 0 && auth_scheme < HttpAuthHandler::AUTH_SCHEME_MAX); | 99 DCHECK(auth_scheme >= 0 && auth_scheme < HttpAuthHandler::AUTH_SCHEME_MAX); |
| 99 | 100 |
| 100 // Record start and rejection events for authentication. | 101 // Record start and rejection events for authentication. |
| 101 // | 102 // |
| 102 // The results map to: | 103 // The results map to: |
| 103 // Basic Start: 0 | 104 // Basic Start: 0 |
| 104 // Basic Reject: 1 | 105 // Basic Reject: 1 |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 DCHECK(CalledOnValidThread()); | 516 DCHECK(CalledOnValidThread()); |
| 516 return disabled_schemes_.find(scheme) != disabled_schemes_.end(); | 517 return disabled_schemes_.find(scheme) != disabled_schemes_.end(); |
| 517 } | 518 } |
| 518 | 519 |
| 519 void HttpAuthController::DisableAuthScheme(const std::string& scheme) { | 520 void HttpAuthController::DisableAuthScheme(const std::string& scheme) { |
| 520 DCHECK(CalledOnValidThread()); | 521 DCHECK(CalledOnValidThread()); |
| 521 disabled_schemes_.insert(scheme); | 522 disabled_schemes_.insert(scheme); |
| 522 } | 523 } |
| 523 | 524 |
| 524 } // namespace net | 525 } // namespace net |
| OLD | NEW |