This source file includes following definitions.
- create
- cancel
- proceed
- getMessageTitle
- getMessageBody
- getUsernameLabelText
- getPasswordLabelText
- getOkButtonText
- getCancelButtonText
- onAutofillDataAvailable
- setAutofillObserver
- onAutofillDataAvailable
- nativeSetAuth
- nativeCancelAuth
- nativeGetCancelButtonText
- nativeGetMessageTitle
- nativeGetMessageBody
- nativeGetPasswordLabelText
- nativeGetOkButtonText
- nativeGetUsernameLabelText
package org.chromium.chrome.browser;
import org.chromium.base.CalledByNative;
public class ChromeHttpAuthHandler {
private final long mNativeChromeHttpAuthHandler;
private AutofillObserver mAutofillObserver;
private String mAutofillUsername;
private String mAutofillPassword;
private ChromeHttpAuthHandler(long nativeChromeHttpAuthHandler) {
assert nativeChromeHttpAuthHandler != 0;
mNativeChromeHttpAuthHandler = nativeChromeHttpAuthHandler;
}
@CalledByNative
private static ChromeHttpAuthHandler create(long nativeChromeHttpAuthHandler) {
return new ChromeHttpAuthHandler(nativeChromeHttpAuthHandler);
}
public void cancel() {
nativeCancelAuth(mNativeChromeHttpAuthHandler);
}
public void proceed(String username, String password) {
nativeSetAuth(mNativeChromeHttpAuthHandler, username, password);
}
public String getMessageTitle() {
return nativeGetMessageTitle(mNativeChromeHttpAuthHandler);
}
public String getMessageBody() {
return nativeGetMessageBody(mNativeChromeHttpAuthHandler);
}
public String getUsernameLabelText() {
return nativeGetUsernameLabelText(mNativeChromeHttpAuthHandler);
}
public String getPasswordLabelText() {
return nativeGetPasswordLabelText(mNativeChromeHttpAuthHandler);
}
public String getOkButtonText() {
return nativeGetOkButtonText(mNativeChromeHttpAuthHandler);
}
public String getCancelButtonText() {
return nativeGetCancelButtonText(mNativeChromeHttpAuthHandler);
}
public static interface AutofillObserver {
public void onAutofillDataAvailable(String username, String password);
}
public void setAutofillObserver(AutofillObserver observer) {
mAutofillObserver = observer;
if (mAutofillUsername != null && mAutofillPassword != null) {
mAutofillObserver.onAutofillDataAvailable(mAutofillUsername, mAutofillPassword);
}
}
@CalledByNative
private void onAutofillDataAvailable(String username, String password) {
mAutofillUsername = username;
mAutofillPassword = password;
if (mAutofillObserver != null) {
mAutofillObserver.onAutofillDataAvailable(username, password);
}
}
private native void nativeSetAuth(long nativeChromeHttpAuthHandler,
String username, String password);
private native void nativeCancelAuth(long nativeChromeHttpAuthHandler);
private native String nativeGetCancelButtonText(long nativeChromeHttpAuthHandler);
private native String nativeGetMessageTitle(long nativeChromeHttpAuthHandler);
private native String nativeGetMessageBody(long nativeChromeHttpAuthHandler);
private native String nativeGetPasswordLabelText(long nativeChromeHttpAuthHandler);
private native String nativeGetOkButtonText(long nativeChromeHttpAuthHandler);
private native String nativeGetUsernameLabelText(long nativeChromeHttpAuthHandler);
}