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/native/aw_http_auth_handler.h" | 5 #include "android_webview/native/aw_http_auth_handler.h" |
6 | 6 |
7 #include "android_webview/browser/aw_login_delegate.h" | 7 #include "android_webview/browser/aw_login_delegate.h" |
8 #include "android_webview/native/aw_contents.h" | 8 #include "android_webview/native/aw_contents.h" |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 28 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
29 JNIEnv* env = base::android::AttachCurrentThread(); | 29 JNIEnv* env = base::android::AttachCurrentThread(); |
30 http_auth_handler_.Reset( | 30 http_auth_handler_.Reset( |
31 Java_AwHttpAuthHandler_create( | 31 Java_AwHttpAuthHandler_create( |
32 env, reinterpret_cast<intptr_t>(this), first_auth_attempt)); | 32 env, reinterpret_cast<intptr_t>(this), first_auth_attempt)); |
33 } | 33 } |
34 | 34 |
35 AwHttpAuthHandler:: ~AwHttpAuthHandler() { | 35 AwHttpAuthHandler:: ~AwHttpAuthHandler() { |
36 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 36 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
37 Java_AwHttpAuthHandler_handlerDestroyed(base::android::AttachCurrentThread(), | 37 Java_AwHttpAuthHandler_handlerDestroyed(base::android::AttachCurrentThread(), |
38 http_auth_handler_.obj()); | 38 http_auth_handler_); |
39 } | 39 } |
40 | 40 |
41 void AwHttpAuthHandler::Proceed(JNIEnv* env, | 41 void AwHttpAuthHandler::Proceed(JNIEnv* env, |
42 const JavaParamRef<jobject>& obj, | 42 const JavaParamRef<jobject>& obj, |
43 const JavaParamRef<jstring>& user, | 43 const JavaParamRef<jstring>& user, |
44 const JavaParamRef<jstring>& password) { | 44 const JavaParamRef<jstring>& password) { |
45 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 45 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
46 if (login_delegate_.get()) { | 46 if (login_delegate_.get()) { |
47 login_delegate_->Proceed(ConvertJavaStringToUTF16(env, user), | 47 login_delegate_->Proceed(ConvertJavaStringToUTF16(env, user), |
48 ConvertJavaStringToUTF16(env, password)); | 48 ConvertJavaStringToUTF16(env, password)); |
(...skipping 24 matching lines...) Expand all Loading... |
73 net::AuthChallengeInfo* auth_info, | 73 net::AuthChallengeInfo* auth_info, |
74 bool first_auth_attempt) { | 74 bool first_auth_attempt) { |
75 return new AwHttpAuthHandler(login_delegate, auth_info, first_auth_attempt); | 75 return new AwHttpAuthHandler(login_delegate, auth_info, first_auth_attempt); |
76 } | 76 } |
77 | 77 |
78 bool RegisterAwHttpAuthHandler(JNIEnv* env) { | 78 bool RegisterAwHttpAuthHandler(JNIEnv* env) { |
79 return RegisterNativesImpl(env); | 79 return RegisterNativesImpl(env); |
80 } | 80 } |
81 | 81 |
82 } // namespace android_webview | 82 } // namespace android_webview |
OLD | NEW |