Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / android_webview / native / aw_http_auth_handler.h
blob79b7406ec2c6e4521565214bb618320e4717037c
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 ANDROID_WEBVIEW_NATIVE_AW_HTTP_AUTH_HANDLER_H_
6 #define ANDROID_WEBVIEW_NATIVE_AW_HTTP_AUTH_HANDLER_H_
8 #include <jni.h>
9 #include <string>
11 #include "android_webview/browser/aw_login_delegate.h"
12 #include "android_webview/browser/aw_http_auth_handler_base.h"
13 #include "base/android/jni_android.h"
14 #include "base/android/scoped_java_ref.h"
15 #include "base/memory/ref_counted.h"
17 namespace content {
18 class WebContents;
21 namespace net {
22 class AuthChallengeInfo;
25 namespace android_webview {
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 AwLoginDelegate.
30 class AwHttpAuthHandler : public AwHttpAuthHandlerBase {
31 public:
32 AwHttpAuthHandler(AwLoginDelegate* login_delegate,
33 net::AuthChallengeInfo* auth_info,
34 bool first_auth_attempt);
35 ~AwHttpAuthHandler() override;
37 // from AwHttpAuthHandler
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);
43 private:
44 scoped_refptr<AwLoginDelegate> login_delegate_;
45 base::android::ScopedJavaGlobalRef<jobject> http_auth_handler_;
46 std::string host_;
47 std::string realm_;
50 bool RegisterAwHttpAuthHandler(JNIEnv* env);
52 } // namespace android_webview
54 #endif // ANDROID_WEBVIEW_NATIVE_AW_HTTP_AUTH_HANDLER_H_