| 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_handler.h" | 5 #include "net/http/http_auth_handler.h" |
| 6 | 6 |
| 7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 case HttpAuth::AUTH_SERVER: | 69 case HttpAuth::AUTH_SERVER: |
| 70 return NetLog::TYPE_AUTH_SERVER; | 70 return NetLog::TYPE_AUTH_SERVER; |
| 71 default: | 71 default: |
| 72 NOTREACHED(); | 72 NOTREACHED(); |
| 73 return NetLog::TYPE_CANCELLED; | 73 return NetLog::TYPE_CANCELLED; |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace | 77 } // namespace |
| 78 | 78 |
| 79 int HttpAuthHandler::GenerateAuthToken(const std::wstring* username, | 79 int HttpAuthHandler::GenerateAuthToken(const string16* username, |
| 80 const std::wstring* password, | 80 const string16* password, |
| 81 const HttpRequestInfo* request, | 81 const HttpRequestInfo* request, |
| 82 CompletionCallback* callback, | 82 CompletionCallback* callback, |
| 83 std::string* auth_token) { | 83 std::string* auth_token) { |
| 84 // TODO(cbentzel): Enforce non-NULL callback after cleaning up SocketStream. | 84 // TODO(cbentzel): Enforce non-NULL callback after cleaning up SocketStream. |
| 85 DCHECK(request); | 85 DCHECK(request); |
| 86 DCHECK((username == NULL) == (password == NULL)); | 86 DCHECK((username == NULL) == (password == NULL)); |
| 87 DCHECK(username != NULL || AllowsDefaultCredentials()); | 87 DCHECK(username != NULL || AllowsDefaultCredentials()); |
| 88 DCHECK(auth_token != NULL); | 88 DCHECK(auth_token != NULL); |
| 89 DCHECK(original_callback_ == NULL); | 89 DCHECK(original_callback_ == NULL); |
| 90 DCHECK(histogram_.get()); | 90 DCHECK(histogram_.get()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 109 // TOOD(cbentzel): Should this be done in OK case only? | 109 // TOOD(cbentzel): Should this be done in OK case only? |
| 110 DCHECK(histogram_.get()); | 110 DCHECK(histogram_.get()); |
| 111 base::TimeDelta generate_auth_token_duration = | 111 base::TimeDelta generate_auth_token_duration = |
| 112 base::TimeTicks::Now() - generate_auth_token_start_; | 112 base::TimeTicks::Now() - generate_auth_token_start_; |
| 113 histogram_->AddTime(generate_auth_token_duration); | 113 histogram_->AddTime(generate_auth_token_duration); |
| 114 net_log_.EndEvent(EventTypeFromAuthTarget(target_), NULL); | 114 net_log_.EndEvent(EventTypeFromAuthTarget(target_), NULL); |
| 115 original_callback_ = NULL; | 115 original_callback_ = NULL; |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace net | 118 } // namespace net |
| OLD | NEW |