1 // Copyright 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 package org.chromium.android_webview;
7 import org.chromium.base.CalledByNative;
8 import org.chromium.base.JNINamespace;
10 @JNINamespace("android_webview")
11 public class AwHttpAuthHandler {
13 private long mNativeAwHttpAuthHandler;
14 private final boolean mFirstAttempt;
16 public void proceed(String username, String password) {
17 if (mNativeAwHttpAuthHandler != 0) {
18 nativeProceed(mNativeAwHttpAuthHandler, username, password);
19 mNativeAwHttpAuthHandler = 0;
23 public void cancel() {
24 if (mNativeAwHttpAuthHandler != 0) {
25 nativeCancel(mNativeAwHttpAuthHandler);
26 mNativeAwHttpAuthHandler = 0;
30 public boolean isFirstAttempt() {
35 public static AwHttpAuthHandler create(long nativeAwAuthHandler, boolean firstAttempt) {
36 return new AwHttpAuthHandler(nativeAwAuthHandler, firstAttempt);
39 private AwHttpAuthHandler(long nativeAwHttpAuthHandler, boolean firstAttempt) {
40 mNativeAwHttpAuthHandler = nativeAwHttpAuthHandler;
41 mFirstAttempt = firstAttempt;
45 void handlerDestroyed() {
46 mNativeAwHttpAuthHandler = 0;
49 private native void nativeProceed(long nativeAwHttpAuthHandler,
50 String username, String password);
51 private native void nativeCancel(long nativeAwHttpAuthHandler);