| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "android_webview/browser/aw_login_delegate.h" | 5 #include "android_webview/browser/aw_login_delegate.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 render_frame_host); | 98 render_frame_host); |
| 99 AwBrowserContext* browser_context = | 99 AwBrowserContext* browser_context = |
| 100 AwBrowserContext::FromWebContents(web_contents); | 100 AwBrowserContext::FromWebContents(web_contents); |
| 101 DataReductionProxySettings* drp_settings = | 101 DataReductionProxySettings* drp_settings = |
| 102 browser_context->GetDataReductionProxySettings(); | 102 browser_context->GetDataReductionProxySettings(); |
| 103 if (drp_settings && drp_settings->IsDataReductionProxyEnabled()) { | 103 if (drp_settings && drp_settings->IsDataReductionProxyEnabled()) { |
| 104 // The data reduction proxy auth handler should only be reset on the first | 104 // The data reduction proxy auth handler should only be reset on the first |
| 105 // auth attempt, because it maintains internal state to cancel if there have | 105 // auth attempt, because it maintains internal state to cancel if there have |
| 106 // been too many attempts. | 106 // been too many attempts. |
| 107 if (!drp_auth_handler_.get()) { | 107 if (!drp_auth_handler_.get()) { |
| 108 drp_auth_handler_.reset(new DataReductionProxyAuthRequestHandler()); | 108 drp_auth_handler_.reset(new DataReductionProxyAuthRequestHandler( |
| 109 drp_settings)); |
| 109 } | 110 } |
| 110 DCHECK(drp_auth_handler_.get()); | 111 DCHECK(drp_auth_handler_.get()); |
| 111 base::string16 user, password; | 112 base::string16 user, password; |
| 112 DataReductionProxyAuthRequestHandler::TryHandleResult drp_result = | 113 DataReductionProxyAuthRequestHandler::TryHandleResult drp_result = |
| 113 drp_auth_handler_->TryHandleAuthentication( | 114 drp_auth_handler_->TryHandleAuthentication( |
| 114 auth_info_.get(), &user, &password); | 115 auth_info_.get(), &user, &password); |
| 115 if (drp_result == | 116 if (drp_result == |
| 116 DataReductionProxyAuthRequestHandler::TRY_HANDLE_RESULT_PROCEED) { | 117 DataReductionProxyAuthRequestHandler::TRY_HANDLE_RESULT_PROCEED) { |
| 117 Proceed(user, password); | 118 Proceed(user, password); |
| 118 return; | 119 return; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 void AwLoginDelegate::DeleteAuthHandlerSoon() { | 162 void AwLoginDelegate::DeleteAuthHandlerSoon() { |
| 162 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 163 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 163 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 164 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 164 base::Bind(&AwLoginDelegate::DeleteAuthHandlerSoon, this)); | 165 base::Bind(&AwLoginDelegate::DeleteAuthHandlerSoon, this)); |
| 165 return; | 166 return; |
| 166 } | 167 } |
| 167 aw_http_auth_handler_.reset(); | 168 aw_http_auth_handler_.reset(); |
| 168 } | 169 } |
| 169 | 170 |
| 170 } // namespace android_webview | 171 } // namespace android_webview |
| OLD | NEW |