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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 original_callback_ = callback; | 92 original_callback_ = callback; |
93 net_log_.BeginEvent(EventTypeFromAuthTarget(target_), NULL); | 93 net_log_.BeginEvent(EventTypeFromAuthTarget(target_), NULL); |
94 generate_auth_token_start_ = base::TimeTicks::Now(); | 94 generate_auth_token_start_ = base::TimeTicks::Now(); |
95 int rv = GenerateAuthTokenImpl(username, password, request, | 95 int rv = GenerateAuthTokenImpl(username, password, request, |
96 &wrapper_callback_, auth_token); | 96 &wrapper_callback_, auth_token); |
97 if (rv != ERR_IO_PENDING) | 97 if (rv != ERR_IO_PENDING) |
98 FinishGenerateAuthToken(); | 98 FinishGenerateAuthToken(); |
99 return rv; | 99 return rv; |
100 } | 100 } |
101 | 101 |
| 102 bool HttpAuthHandler::NeedsIdentity() { |
| 103 return true; |
| 104 } |
| 105 |
| 106 bool HttpAuthHandler::AllowsDefaultCredentials() { |
| 107 return false; |
| 108 } |
| 109 |
102 void HttpAuthHandler::OnGenerateAuthTokenComplete(int rv) { | 110 void HttpAuthHandler::OnGenerateAuthTokenComplete(int rv) { |
103 CompletionCallback* callback = original_callback_; | 111 CompletionCallback* callback = original_callback_; |
104 FinishGenerateAuthToken(); | 112 FinishGenerateAuthToken(); |
105 if (callback) | 113 if (callback) |
106 callback->Run(rv); | 114 callback->Run(rv); |
107 } | 115 } |
108 | 116 |
109 void HttpAuthHandler::FinishGenerateAuthToken() { | 117 void HttpAuthHandler::FinishGenerateAuthToken() { |
110 // TOOD(cbentzel): Should this be done in OK case only? | 118 // TOOD(cbentzel): Should this be done in OK case only? |
111 DCHECK(histogram_.get()); | 119 DCHECK(histogram_.get()); |
112 base::TimeDelta generate_auth_token_duration = | 120 base::TimeDelta generate_auth_token_duration = |
113 base::TimeTicks::Now() - generate_auth_token_start_; | 121 base::TimeTicks::Now() - generate_auth_token_start_; |
114 histogram_->AddTime(generate_auth_token_duration); | 122 histogram_->AddTime(generate_auth_token_duration); |
115 net_log_.EndEvent(EventTypeFromAuthTarget(target_), NULL); | 123 net_log_.EndEvent(EventTypeFromAuthTarget(target_), NULL); |
116 original_callback_ = NULL; | 124 original_callback_ = NULL; |
117 } | 125 } |
118 | 126 |
119 } // namespace net | 127 } // namespace net |
OLD | NEW |