diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-13 13:31:17 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-13 13:31:17 +0000 |
commit | 547fc79ddbed132ba12797c4f0e0aeecd3b63b8f (patch) | |
tree | 618e14cd18540b93815df91ffd01bd245d3691b4 /net/http/http_auth_controller.cc | |
parent | 1597bafcf13b29051d16debae1d561b385550572 (diff) | |
download | chromium_src-547fc79ddbed132ba12797c4f0e0aeecd3b63b8f.zip chromium_src-547fc79ddbed132ba12797c4f0e0aeecd3b63b8f.tar.gz chromium_src-547fc79ddbed132ba12797c4f0e0aeecd3b63b8f.tar.bz2 |
Cleanup: Use AUTH_SCHEME enum instead of a string.
BUG=None
TEST=trybots
Review URL: http://codereview.chromium.org/6191001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71318 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_auth_controller.cc')
-rw-r--r-- | net/http/http_auth_controller.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc index ddd0bdb..f438ea4 100644 --- a/net/http/http_auth_controller.cc +++ b/net/http/http_auth_controller.cc @@ -96,8 +96,8 @@ void HistogramAuthEvent(HttpAuthHandler* handler, AuthEvent auth_event) { DCHECK_EQ(first_thread, base::PlatformThread::CurrentId()); #endif - HttpAuthHandler::AuthScheme auth_scheme = handler->auth_scheme(); - DCHECK(auth_scheme >= 0 && auth_scheme < HttpAuthHandler::AUTH_SCHEME_MAX); + HttpAuth::Scheme auth_scheme = handler->auth_scheme(); + DCHECK(auth_scheme >= 0 && auth_scheme < HttpAuth::AUTH_SCHEME_MAX); // Record start and rejection events for authentication. // @@ -111,7 +111,7 @@ void HistogramAuthEvent(HttpAuthHandler* handler, AuthEvent auth_event) { // Negotiate Start: 6 // Negotiate Reject: 7 static const int kEventBucketsEnd = - HttpAuthHandler::AUTH_SCHEME_MAX * AUTH_EVENT_MAX; + HttpAuth::AUTH_SCHEME_MAX * AUTH_EVENT_MAX; int event_bucket = auth_scheme * AUTH_EVENT_MAX + auth_event; DCHECK(event_bucket >= 0 && event_bucket < kEventBucketsEnd); UMA_HISTOGRAM_ENUMERATION("Net.HttpAuthCount", event_bucket, @@ -139,7 +139,7 @@ void HistogramAuthEvent(HttpAuthHandler* handler, AuthEvent auth_event) { if (auth_event != AUTH_EVENT_START) return; static const int kTargetBucketsEnd = - HttpAuthHandler::AUTH_SCHEME_MAX * AUTH_TARGET_MAX; + HttpAuth::AUTH_SCHEME_MAX * AUTH_TARGET_MAX; AuthTarget auth_target = DetermineAuthTarget(handler); int target_bucket = auth_scheme * AUTH_TARGET_MAX + auth_target; DCHECK(target_bucket >= 0 && target_bucket < kTargetBucketsEnd); @@ -282,7 +282,7 @@ int HttpAuthController::HandleAuthChallenge( case HttpAuth::AUTHORIZATION_RESULT_STALE: if (http_auth_cache_->UpdateStaleChallenge(auth_origin_, handler_->realm(), - handler_->scheme(), + handler_->auth_scheme(), challenge_used)) { handler_.reset(); identity_ = HttpAuth::Identity(); @@ -388,7 +388,7 @@ void HttpAuthController::ResetAuth(const string16& username, break; default: http_auth_cache_->Add(auth_origin_, handler_->realm(), - handler_->scheme(), handler_->challenge(), + handler_->auth_scheme(), handler_->challenge(), identity_.username, identity_.password, auth_path_); break; @@ -426,7 +426,7 @@ void HttpAuthController::InvalidateRejectedAuthFromCache() { // Note: we require the username/password to match before invalidating // since the entry in the cache may be newer than what we used last time. http_auth_cache_->Remove(auth_origin_, handler_->realm(), - handler_->scheme(), identity_.username, + handler_->auth_scheme(), identity_.username, identity_.password); } @@ -453,7 +453,7 @@ bool HttpAuthController::SelectNextAuthIdentityToTry() { // Check the auth cache for a realm entry. HttpAuthCache::Entry* entry = http_auth_cache_->Lookup(auth_origin_, handler_->realm(), - handler_->scheme()); + handler_->auth_scheme()); if (entry) { identity_.source = HttpAuth::IDENT_SRC_REALM_LOOKUP; @@ -487,7 +487,8 @@ void HttpAuthController::PopulateAuthChallenge() { auth_info_ = new AuthChallengeInfo; auth_info_->is_proxy = target_ == HttpAuth::AUTH_PROXY; auth_info_->host_and_port = ASCIIToWide(GetHostAndPort(auth_origin_)); - auth_info_->scheme = ASCIIToWide(handler_->scheme()); + auth_info_->scheme = ASCIIToWide( + HttpAuth::SchemeToString(handler_->auth_scheme())); // TODO(eroman): decode realm according to RFC 2047. auth_info_->realm = ASCIIToWide(handler_->realm()); } @@ -497,7 +498,7 @@ void HttpAuthController::OnIOComplete(int result) { // This error occurs with GSSAPI, if the user has not already logged in. // In that case, disable the current scheme as it cannot succeed. if (result == ERR_MISSING_AUTH_CREDENTIALS) { - DisableAuthScheme(handler_->scheme()); + DisableAuthScheme(handler_->auth_scheme()); auth_token_.clear(); result = OK; } @@ -513,12 +514,12 @@ scoped_refptr<AuthChallengeInfo> HttpAuthController::auth_info() { return auth_info_; } -bool HttpAuthController::IsAuthSchemeDisabled(const std::string& scheme) const { +bool HttpAuthController::IsAuthSchemeDisabled(HttpAuth::Scheme scheme) const { DCHECK(CalledOnValidThread()); return disabled_schemes_.find(scheme) != disabled_schemes_.end(); } -void HttpAuthController::DisableAuthScheme(const std::string& scheme) { +void HttpAuthController::DisableAuthScheme(HttpAuth::Scheme scheme) { DCHECK(CalledOnValidThread()); disabled_schemes_.insert(scheme); } |