Re-instate the link coloring on startup, but going via the browser
to read the bookmark history, and restricting it to 100 results. Link coloring - doing db lookup in new thread Whitespace, following review
This commit is contained in:
@ -106,6 +106,7 @@ class CallbackProxy extends Handler {
|
||||
private static final int GEOLOCATION_PERMISSIONS_SHOW_PROMPT = 130;
|
||||
private static final int GEOLOCATION_PERMISSIONS_HIDE_PROMPT = 131;
|
||||
private static final int RECEIVED_TOUCH_ICON_URL = 132;
|
||||
private static final int GET_VISITED_HISTORY = 133;
|
||||
|
||||
// Message triggered by the client to resume execution
|
||||
private static final int NOTIFY = 200;
|
||||
@ -655,6 +656,12 @@ class CallbackProxy extends Handler {
|
||||
int lineNumber = msg.getData().getInt("lineNumber");
|
||||
mWebChromeClient.addMessageToConsole(message, lineNumber, sourceID);
|
||||
break;
|
||||
|
||||
case GET_VISITED_HISTORY:
|
||||
if (mWebChromeClient != null) {
|
||||
mWebChromeClient.getVisitedHistory((ValueCallback<String[]>)msg.obj);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1329,4 +1336,16 @@ class CallbackProxy extends Handler {
|
||||
}
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide pending API council approval
|
||||
*/
|
||||
public void getVisitedHistory(ValueCallback<String[]> callback) {
|
||||
if (mWebChromeClient == null) {
|
||||
return;
|
||||
}
|
||||
Message msg = obtainMessage(GET_VISITED_HISTORY);
|
||||
msg.obj = callback;
|
||||
sendMessage(msg);
|
||||
}
|
||||
}
|
||||
|
@ -295,4 +295,11 @@ public class WebChromeClient {
|
||||
public View getVideoLoadingProgressView() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Obtains a list of all visited history items, used for link coloring
|
||||
* @hide pending API Council approval
|
||||
*/
|
||||
public void getVisitedHistory(ValueCallback<String[]> callback) {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -311,10 +311,13 @@ final class WebViewCore {
|
||||
});
|
||||
}
|
||||
|
||||
protected String[] populateVisitedLinks() {
|
||||
// FIXME: getVisitedHistory needs permission and host may not have.
|
||||
// return Browser.getVisitedHistory(mContext.getContentResolver());
|
||||
return new String[0];
|
||||
protected void populateVisitedLinks() {
|
||||
ValueCallback callback = new ValueCallback<String[]>() {
|
||||
public void onReceiveValue(String[] value) {
|
||||
sendMessage(EventHub.POPULATE_VISITED_LINKS, (Object)value);
|
||||
}
|
||||
};
|
||||
mCallbackProxy.getVisitedHistory(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -531,6 +534,11 @@ final class WebViewCore {
|
||||
*/
|
||||
private native void nativeGeolocationPermissionsProvide(String origin, boolean allow, boolean remember);
|
||||
|
||||
/**
|
||||
* Provide WebCore with the previously visted links from the history database
|
||||
*/
|
||||
private native void nativeProvideVisitedHistory(String[] history);
|
||||
|
||||
// EventHub for processing messages
|
||||
private final EventHub mEventHub;
|
||||
// WebCore thread handler
|
||||
@ -811,6 +819,8 @@ final class WebViewCore {
|
||||
// Geolocation
|
||||
static final int GEOLOCATION_PERMISSIONS_PROVIDE = 180;
|
||||
|
||||
static final int POPULATE_VISITED_LINKS = 181;
|
||||
|
||||
// private message ids
|
||||
private static final int DESTROY = 200;
|
||||
|
||||
@ -1234,6 +1244,10 @@ final class WebViewCore {
|
||||
((Message) msg.obj).sendToTarget();
|
||||
}
|
||||
break;
|
||||
|
||||
case POPULATE_VISITED_LINKS:
|
||||
nativeProvideVisitedHistory((String[])msg.obj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user