| Index: net/http/http_auth_controller.cc
|
| diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc
|
| index 9cc57de35aadec7396d8c383bc6584f93bc1fb90..1353ce5ddd5c942dcdcf0a3dcfef1d078d7c594b 100644
|
| --- a/net/http/http_auth_controller.cc
|
| +++ b/net/http/http_auth_controller.cc
|
| @@ -116,8 +116,8 @@ void HistogramAuthEvent(HttpAuthHandler* handler, AuthEvent auth_event) {
|
| 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,
|
| - kEventBucketsEnd);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Net.HttpAuthCount", event_bucket, kEventBucketsEnd);
|
|
|
| // Record the target of the authentication.
|
| //
|
| @@ -145,8 +145,8 @@ void HistogramAuthEvent(HttpAuthHandler* handler, AuthEvent auth_event) {
|
| AuthTarget auth_target = DetermineAuthTarget(handler);
|
| int target_bucket = auth_scheme * AUTH_TARGET_MAX + auth_target;
|
| DCHECK(target_bucket >= 0 && target_bucket < kTargetBucketsEnd);
|
| - UMA_HISTOGRAM_ENUMERATION("Net.HttpAuthTarget", target_bucket,
|
| - kTargetBucketsEnd);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Net.HttpAuthTarget", target_bucket, kTargetBucketsEnd);
|
| }
|
|
|
| } // namespace
|
| @@ -171,7 +171,8 @@ HttpAuthController::~HttpAuthController() {
|
| }
|
|
|
| int HttpAuthController::MaybeGenerateAuthToken(
|
| - const HttpRequestInfo* request, const CompletionCallback& callback,
|
| + const HttpRequestInfo* request,
|
| + const CompletionCallback& callback,
|
| const BoundNetLog& net_log) {
|
| DCHECK(CalledOnValidThread());
|
| bool needs_auth = HaveAuth() || SelectPreemptiveAuth(net_log);
|
| @@ -183,7 +184,8 @@ int HttpAuthController::MaybeGenerateAuthToken(
|
| DCHECK(auth_token_.empty());
|
| DCHECK(callback_.is_null());
|
| int rv = handler_->GenerateAuthToken(
|
| - credentials, request,
|
| + credentials,
|
| + request,
|
| base::Bind(&HttpAuthController::OnIOComplete, base::Unretained(this)),
|
| &auth_token_);
|
| if (DisableOnAuthHandlerResult(rv))
|
| @@ -209,18 +211,21 @@ bool HttpAuthController::SelectPreemptiveAuth(const BoundNetLog& net_log) {
|
| // is expected to be fast. LookupByPath() is fast in the common case, since
|
| // the number of http auth cache entries is expected to be very small.
|
| // (For most users in fact, it will be 0.)
|
| - HttpAuthCache::Entry* entry = http_auth_cache_->LookupByPath(
|
| - auth_origin_, auth_path_);
|
| + HttpAuthCache::Entry* entry =
|
| + http_auth_cache_->LookupByPath(auth_origin_, auth_path_);
|
| if (!entry)
|
| return false;
|
|
|
| // Try to create a handler using the previous auth challenge.
|
| scoped_ptr<HttpAuthHandler> handler_preemptive;
|
| - int rv_create = http_auth_handler_factory_->
|
| - CreatePreemptiveAuthHandlerFromString(entry->auth_challenge(), target_,
|
| - auth_origin_,
|
| - entry->IncrementNonceCount(),
|
| - net_log, &handler_preemptive);
|
| + int rv_create =
|
| + http_auth_handler_factory_->CreatePreemptiveAuthHandlerFromString(
|
| + entry->auth_challenge(),
|
| + target_,
|
| + auth_origin_,
|
| + entry->IncrementNonceCount(),
|
| + net_log,
|
| + &handler_preemptive);
|
| if (rv_create != OK)
|
| return false;
|
|
|
| @@ -299,9 +304,9 @@ int HttpAuthController::HandleAuthChallenge(
|
| // authorization and requests credentials for a different
|
| // realm, we keep the cached credentials.
|
| InvalidateCurrentHandler(
|
| - (identity_.source == HttpAuth::IDENT_SRC_PATH_LOOKUP) ?
|
| - INVALIDATE_HANDLER :
|
| - INVALIDATE_HANDLER_AND_CACHED_CREDENTIALS);
|
| + (identity_.source == HttpAuth::IDENT_SRC_PATH_LOOKUP)
|
| + ? INVALIDATE_HANDLER
|
| + : INVALIDATE_HANDLER_AND_CACHED_CREDENTIALS);
|
| break;
|
| default:
|
| NOTREACHED();
|
| @@ -311,8 +316,8 @@ int HttpAuthController::HandleAuthChallenge(
|
|
|
| identity_.invalid = true;
|
|
|
| - bool can_send_auth = (target_ != HttpAuth::AUTH_SERVER ||
|
| - !do_not_send_server_auth);
|
| + bool can_send_auth =
|
| + (target_ != HttpAuth::AUTH_SERVER || !do_not_send_server_auth);
|
|
|
| do {
|
| if (!handler_.get() && can_send_auth) {
|
| @@ -377,7 +382,7 @@ int HttpAuthController::HandleAuthChallenge(
|
| // back and try again.
|
| // TODO(asanka): Instead we should create a priority list of
|
| // <handler,identity> and iterate through that.
|
| - } while(!handler_.get());
|
| + } while (!handler_.get());
|
| return OK;
|
| }
|
|
|
| @@ -413,9 +418,12 @@ void HttpAuthController::ResetAuth(const AuthCredentials& credentials) {
|
| case HttpAuth::IDENT_SRC_DEFAULT_CREDENTIALS:
|
| break;
|
| default:
|
| - http_auth_cache_->Add(auth_origin_, handler_->realm(),
|
| - handler_->auth_scheme(), handler_->challenge(),
|
| - identity_.credentials, auth_path_);
|
| + http_auth_cache_->Add(auth_origin_,
|
| + handler_->realm(),
|
| + handler_->auth_scheme(),
|
| + handler_->challenge(),
|
| + identity_.credentials,
|
| + auth_path_);
|
| break;
|
| }
|
| }
|
| @@ -448,8 +456,10 @@ void HttpAuthController::InvalidateRejectedAuthFromCache() {
|
| // Clear the cache entry for the identity we just failed on.
|
| // Note: we require the credentials 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_->auth_scheme(), identity_.credentials);
|
| + http_auth_cache_->Remove(auth_origin_,
|
| + handler_->realm(),
|
| + handler_->auth_scheme(),
|
| + identity_.credentials);
|
| }
|
|
|
| bool HttpAuthController::SelectNextAuthIdentityToTry() {
|
| @@ -475,9 +485,8 @@ bool HttpAuthController::SelectNextAuthIdentityToTry() {
|
| }
|
|
|
| // Check the auth cache for a realm entry.
|
| - HttpAuthCache::Entry* entry =
|
| - http_auth_cache_->Lookup(auth_origin_, handler_->realm(),
|
| - handler_->auth_scheme());
|
| + HttpAuthCache::Entry* entry = http_auth_cache_->Lookup(
|
| + auth_origin_, handler_->realm(), handler_->auth_scheme());
|
|
|
| if (entry) {
|
| identity_.source = HttpAuth::IDENT_SRC_REALM_LOOKUP;
|
|
|