Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1164)

Side by Side Diff: android_webview/browser/aw_http_auth_handler.cc

Issue 2863233002: [WebView] Move files from native to browser (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/aw_http_auth_handler.h"
6 6
7 #include "android_webview/browser/aw_contents.h"
7 #include "android_webview/browser/aw_login_delegate.h" 8 #include "android_webview/browser/aw_login_delegate.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"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/web_contents.h"
12 #include "jni/AwHttpAuthHandler_jni.h" 13 #include "jni/AwHttpAuthHandler_jni.h"
13 #include "net/base/auth.h" 14 #include "net/base/auth.h"
14 #include "content/public/browser/web_contents.h"
15 15
16 using base::android::ConvertJavaStringToUTF16; 16 using base::android::ConvertJavaStringToUTF16;
17 using base::android::JavaParamRef; 17 using base::android::JavaParamRef;
18 using content::BrowserThread; 18 using content::BrowserThread;
19 19
20 namespace android_webview { 20 namespace android_webview {
21 21
22 AwHttpAuthHandler::AwHttpAuthHandler(AwLoginDelegate* login_delegate, 22 AwHttpAuthHandler::AwHttpAuthHandler(AwLoginDelegate* login_delegate,
23 net::AuthChallengeInfo* auth_info, 23 net::AuthChallengeInfo* auth_info,
24 bool first_auth_attempt) 24 bool first_auth_attempt)
25 : login_delegate_(login_delegate), 25 : login_delegate_(login_delegate),
26 host_(auth_info->challenger.host()), 26 host_(auth_info->challenger.host()),
27 realm_(auth_info->realm) { 27 realm_(auth_info->realm) {
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(Java_AwHttpAuthHandler_create(
31 Java_AwHttpAuthHandler_create( 31 env, reinterpret_cast<intptr_t>(this), first_auth_attempt));
32 env, reinterpret_cast<intptr_t>(this), first_auth_attempt));
33 } 32 }
34 33
35 AwHttpAuthHandler:: ~AwHttpAuthHandler() { 34 AwHttpAuthHandler::~AwHttpAuthHandler() {
36 DCHECK_CURRENTLY_ON(BrowserThread::UI); 35 DCHECK_CURRENTLY_ON(BrowserThread::UI);
37 Java_AwHttpAuthHandler_handlerDestroyed(base::android::AttachCurrentThread(), 36 Java_AwHttpAuthHandler_handlerDestroyed(base::android::AttachCurrentThread(),
38 http_auth_handler_); 37 http_auth_handler_);
39 } 38 }
40 39
41 void AwHttpAuthHandler::Proceed(JNIEnv* env, 40 void AwHttpAuthHandler::Proceed(JNIEnv* env,
42 const JavaParamRef<jobject>& obj, 41 const JavaParamRef<jobject>& obj,
43 const JavaParamRef<jstring>& user, 42 const JavaParamRef<jstring>& user,
44 const JavaParamRef<jstring>& password) { 43 const JavaParamRef<jstring>& password) {
45 DCHECK_CURRENTLY_ON(BrowserThread::UI); 44 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 27 matching lines...) Expand all
73 net::AuthChallengeInfo* auth_info, 72 net::AuthChallengeInfo* auth_info,
74 bool first_auth_attempt) { 73 bool first_auth_attempt) {
75 return new AwHttpAuthHandler(login_delegate, auth_info, first_auth_attempt); 74 return new AwHttpAuthHandler(login_delegate, auth_info, first_auth_attempt);
76 } 75 }
77 76
78 bool RegisterAwHttpAuthHandler(JNIEnv* env) { 77 bool RegisterAwHttpAuthHandler(JNIEnv* env) {
79 return RegisterNativesImpl(env); 78 return RegisterNativesImpl(env);
80 } 79 }
81 80
82 } // namespace android_webview 81 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698