This source file includes following definitions.
- getUrl
- getUserName
- createSavedPasswordEntry
- passwordListAvailable
- passwordExceptionListAvailable
- passwordListAvailable
- passwordExceptionListAvailable
- addObserver
- removeObserver
- updatePasswordLists
- getSavedPasswordEntry
- getSavedPasswordException
- removeSavedPasswordEntry
- removeSavedPasswordException
- destroy
- nativeInit
- nativeUpdatePasswordLists
- nativeGetSavedPasswordEntry
- nativeGetSavedPasswordException
- nativeHandleRemoveSavedPasswordEntry
- nativeHandleRemoveSavedPasswordException
- nativeDestroy
package org.chromium.chrome.browser;
import org.chromium.base.CalledByNative;
import org.chromium.base.ObserverList;
public final class PasswordUIView {
public static final class SavedPasswordEntry {
private final String mUrl;
private final String mName;
private SavedPasswordEntry(String url, String name) {
mUrl = url;
mName = name;
}
public String getUrl() {
return mUrl;
}
public String getUserName() {
return mName;
}
}
@CalledByNative
private static SavedPasswordEntry createSavedPasswordEntry(String url, String name) {
return new SavedPasswordEntry(url, name);
}
public interface PasswordListObserver {
void passwordListAvailable(int count);
void passwordExceptionListAvailable(int count);
}
private ObserverList<PasswordListObserver> mObservers =
new ObserverList<PasswordListObserver>();
private long mNativePasswordUIViewAndroid;
public PasswordUIView() {
mNativePasswordUIViewAndroid = nativeInit();
}
@CalledByNative
private void passwordListAvailable(int count) {
for (PasswordListObserver observer : mObservers) {
observer.passwordListAvailable(count);
}
}
@CalledByNative
private void passwordExceptionListAvailable(int count) {
for (PasswordListObserver observer : mObservers) {
observer.passwordExceptionListAvailable(count);
}
}
public void addObserver(PasswordListObserver observer) {
mObservers.addObserver(observer);
}
public void removeObserver(PasswordListObserver observer) {
mObservers.removeObserver(observer);
}
public void updatePasswordLists() {
nativeUpdatePasswordLists(mNativePasswordUIViewAndroid);
}
public SavedPasswordEntry getSavedPasswordEntry(int index) {
return nativeGetSavedPasswordEntry(mNativePasswordUIViewAndroid, index);
}
public String getSavedPasswordException(int index) {
return nativeGetSavedPasswordException(mNativePasswordUIViewAndroid, index);
}
public void removeSavedPasswordEntry(int index) {
nativeHandleRemoveSavedPasswordEntry(mNativePasswordUIViewAndroid, index);
}
public void removeSavedPasswordException(int index) {
nativeHandleRemoveSavedPasswordException(mNativePasswordUIViewAndroid, index);
}
public void destroy() {
if (mNativePasswordUIViewAndroid != 0) {
nativeDestroy(mNativePasswordUIViewAndroid);
mNativePasswordUIViewAndroid = 0;
}
mObservers.clear();
}
private native long nativeInit();
private native void nativeUpdatePasswordLists(long nativePasswordUIViewAndroid);
private native SavedPasswordEntry nativeGetSavedPasswordEntry(
long nativePasswordUIViewAndroid,
int index);
private native String nativeGetSavedPasswordException(long nativePasswordUIViewAndroid,
int index);
private native void nativeHandleRemoveSavedPasswordEntry(
long nativePasswordUIViewAndroid,
int index);
private native void nativeHandleRemoveSavedPasswordException(
long nativePasswordUIViewAndroid,
int index);
private native void nativeDestroy(long nativePasswordUIViewAndroid);
}