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
3 // found in the LICENSE file.
5 #ifndef XWALK_RUNTIME_BROWSER_ANDROID_XWALK_HTTP_AUTH_HANDLER_H_
6 #define XWALK_RUNTIME_BROWSER_ANDROID_XWALK_HTTP_AUTH_HANDLER_H_
11 #include "base/android/jni_android.h"
12 #include "base/android/scoped_java_ref.h"
13 #include "base/memory/ref_counted.h"
14 #include "xwalk/runtime/browser/android/xwalk_login_delegate.h"
15 #include "xwalk/runtime/browser/android/xwalk_http_auth_handler_base.h"
22 class AuthChallengeInfo;
26 class XWalkLoginDelegate;
27 // Native class for Java class of same name and owns an instance
28 // of that Java object.
29 // One instance of this class is created per underlying XWalkLoginDelegate.
30 class XWalkHttpAuthHandler : public XWalkHttpAuthHandlerBase {
32 XWalkHttpAuthHandler(XWalkLoginDelegate* login_delegate,
33 net::AuthChallengeInfo* auth_info,
34 bool first_auth_attempt);
35 virtual ~XWalkHttpAuthHandler();
37 // from XWalkHttpAuthHandler
38 bool HandleOnUIThread(content::WebContents* web_contents) override;
40 void Proceed(JNIEnv* env, jobject obj, jstring username, jstring password);
41 void Cancel(JNIEnv* env, jobject obj);
44 scoped_refptr<XWalkLoginDelegate> login_delegate_;
45 base::android::ScopedJavaGlobalRef<jobject> http_auth_handler_;
50 bool RegisterXWalkHttpAuthHandler(JNIEnv* env);
54 #endif // XWALK_RUNTIME_BROWSER_ANDROID_XWALK_HTTP_AUTH_HANDLER_H_