| 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 "base/stringprintf.h" |
| 10 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 11 | 12 |
| 12 namespace net { | 13 namespace net { |
| 13 | 14 |
| 14 HttpAuthHandler::HttpAuthHandler() | 15 HttpAuthHandler::HttpAuthHandler() |
| 15 : score_(-1), | 16 : score_(-1), |
| 16 target_(HttpAuth::AUTH_NONE), | 17 target_(HttpAuth::AUTH_NONE), |
| 17 properties_(-1), | 18 properties_(-1), |
| 18 original_callback_(NULL), | 19 original_callback_(NULL), |
| 19 ALLOW_THIS_IN_INITIALIZER_LIST( | 20 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 20 wrapper_callback_( | 21 wrapper_callback_( |
| 21 this, &HttpAuthHandler::OnGenerateAuthTokenComplete)) { | 22 this, &HttpAuthHandler::OnGenerateAuthTokenComplete)) { |
| 22 } | 23 } |
| 23 | 24 |
| 24 HttpAuthHandler::~HttpAuthHandler() { | 25 HttpAuthHandler::~HttpAuthHandler() { |
| 25 } | 26 } |
| 26 | 27 |
| 27 //static | 28 //static |
| 28 std::string HttpAuthHandler::GenerateHistogramNameFromScheme( | 29 std::string HttpAuthHandler::GenerateHistogramNameFromScheme( |
| 29 const std::string& scheme) { | 30 const std::string& scheme) { |
| 30 return StringPrintf("Net.AuthGenerateToken_%s", scheme.c_str()); | 31 return base::StringPrintf("Net.AuthGenerateToken_%s", scheme.c_str()); |
| 31 } | 32 } |
| 32 | 33 |
| 33 bool HttpAuthHandler::InitFromChallenge( | 34 bool HttpAuthHandler::InitFromChallenge( |
| 34 HttpAuth::ChallengeTokenizer* challenge, | 35 HttpAuth::ChallengeTokenizer* challenge, |
| 35 HttpAuth::Target target, | 36 HttpAuth::Target target, |
| 36 const GURL& origin, | 37 const GURL& origin, |
| 37 const BoundNetLog& net_log) { | 38 const BoundNetLog& net_log) { |
| 38 origin_ = origin; | 39 origin_ = origin; |
| 39 target_ = target; | 40 target_ = target; |
| 40 score_ = -1; | 41 score_ = -1; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // TOOD(cbentzel): Should this be done in OK case only? | 110 // TOOD(cbentzel): Should this be done in OK case only? |
| 110 DCHECK(histogram_.get()); | 111 DCHECK(histogram_.get()); |
| 111 base::TimeDelta generate_auth_token_duration = | 112 base::TimeDelta generate_auth_token_duration = |
| 112 base::TimeTicks::Now() - generate_auth_token_start_; | 113 base::TimeTicks::Now() - generate_auth_token_start_; |
| 113 histogram_->AddTime(generate_auth_token_duration); | 114 histogram_->AddTime(generate_auth_token_duration); |
| 114 net_log_.EndEvent(EventTypeFromAuthTarget(target_), NULL); | 115 net_log_.EndEvent(EventTypeFromAuthTarget(target_), NULL); |
| 115 original_callback_ = NULL; | 116 original_callback_ = NULL; |
| 116 } | 117 } |
| 117 | 118 |
| 118 } // namespace net | 119 } // namespace net |
| OLD | NEW |