Methods Summary |
---|
public void | addJavascriptInterface(java.lang.Object obj, java.lang.String interfaceName)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
addJavascriptInterface(obj, interfaceName);
}
});
return;
}
Class<? extends Annotation> requiredAnnotation = null;
if (mAppTargetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
requiredAnnotation = JavascriptInterface.class;
}
mAwContents.addPossiblyUnsafeJavascriptInterface(obj, interfaceName, requiredAnnotation);
|
public boolean | canGoBack()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
Boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return canGoBack();
}
});
return ret;
}
return mAwContents.canGoBack();
|
public boolean | canGoBackOrForward(int steps)
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
Boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return canGoBackOrForward(steps);
}
});
return ret;
}
return mAwContents.canGoBackOrForward(steps);
|
public boolean | canGoForward()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
Boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return canGoForward();
}
});
return ret;
}
return mAwContents.canGoForward();
|
public boolean | canZoomIn()
if (checkNeedsPost()) {
return false;
}
return mAwContents.canZoomIn();
|
public boolean | canZoomOut()
if (checkNeedsPost()) {
return false;
}
return mAwContents.canZoomOut();
|
public android.graphics.Picture | capturePicture()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
Picture ret = runOnUiThreadBlocking(new Callable<Picture>() {
@Override
public Picture call() {
return capturePicture();
}
});
return ret;
}
return mAwContents.capturePicture();
|
private boolean | checkNeedsPost()
boolean needsPost = !mFactory.hasStarted() || !ThreadUtils.runningOnUiThread();
if (!needsPost && mAwContents == null) {
throw new IllegalStateException(
"AwContents must be created if we are not posting!");
}
return needsPost;
|
private void | checkThread()
if (!ThreadUtils.runningOnUiThread()) {
final RuntimeException threadViolation = createThreadException();
ThreadUtils.postOnUiThread(new Runnable() {
@Override
public void run() {
throw threadViolation;
}
});
throw createThreadException();
}
|
public void | clearCache(boolean includeDiskFiles)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
clearCache(includeDiskFiles);
}
});
return;
}
mAwContents.clearCache(includeDiskFiles);
|
public void | clearFormData()This is a poorly named method, but we keep it for historical reasons.
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
clearFormData();
}
});
return;
}
mAwContents.hideAutofillPopup();
|
public void | clearHistory()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
clearHistory();
}
});
return;
}
mAwContents.clearHistory();
|
public void | clearMatches()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
clearMatches();
}
});
return;
}
mAwContents.clearMatches();
|
public void | clearSslPreferences()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
clearSslPreferences();
}
});
return;
}
mAwContents.clearSslPreferences();
|
public void | clearView()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
clearView();
}
});
return;
}
mAwContents.clearView();
|
static void | completeWindowCreation(android.webkit.WebView parent, android.webkit.WebView child)
AwContents parentContents = ((WebViewChromium) parent.getWebViewProvider()).mAwContents;
AwContents childContents =
child == null ? null : ((WebViewChromium) child.getWebViewProvider()).mAwContents;
parentContents.supplyContentsForPopup(childContents);
|
public int | computeHorizontalScrollOffset()
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
int ret = runOnUiThreadBlocking(new Callable<Integer>() {
@Override
public Integer call() {
return computeHorizontalScrollOffset();
}
});
return ret;
}
return mAwContents.computeHorizontalScrollOffset();
|
public int | computeHorizontalScrollRange()
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
int ret = runOnUiThreadBlocking(new Callable<Integer>() {
@Override
public Integer call() {
return computeHorizontalScrollRange();
}
});
return ret;
}
return mAwContents.computeHorizontalScrollRange();
|
public void | computeScroll()
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
runVoidTaskOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
computeScroll();
}
});
return;
}
mAwContents.computeScroll();
|
public int | computeVerticalScrollExtent()
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
int ret = runOnUiThreadBlocking(new Callable<Integer>() {
@Override
public Integer call() {
return computeVerticalScrollExtent();
}
});
return ret;
}
return mAwContents.computeVerticalScrollExtent();
|
public int | computeVerticalScrollOffset()
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
int ret = runOnUiThreadBlocking(new Callable<Integer>() {
@Override
public Integer call() {
return computeVerticalScrollOffset();
}
});
return ret;
}
return mAwContents.computeVerticalScrollOffset();
|
public int | computeVerticalScrollRange()
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
int ret = runOnUiThreadBlocking(new Callable<Integer>() {
@Override
public Integer call() {
return computeVerticalScrollRange();
}
});
return ret;
}
return mAwContents.computeVerticalScrollRange();
|
public android.webkit.WebBackForwardList | copyBackForwardList()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
WebBackForwardList ret = runOnUiThreadBlocking(new Callable<WebBackForwardList>() {
@Override
public WebBackForwardList call() {
return copyBackForwardList();
}
});
return ret;
}
return new WebBackForwardListChromium(
mAwContents.getNavigationHistory());
|
public android.print.PrintDocumentAdapter | createPrintDocumentAdapter()
return createPrintDocumentAdapter("default");
|
public android.print.PrintDocumentAdapter | createPrintDocumentAdapter(java.lang.String documentName)
checkThread();
return new AwPrintDocumentAdapter(mAwContents.getPdfExporter(), documentName);
|
private java.lang.RuntimeException | createThreadException()
return new IllegalStateException(
"Calling View methods on another thread than the UI thread.");
|
public void | destroy()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
destroy();
}
});
return;
}
mAwContents.destroy();
if (mGLfunctor != null) {
mGLfunctor.destroy();
mGLfunctor = null;
}
|
public boolean | dispatchKeyEvent(android.view.KeyEvent event)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return dispatchKeyEvent(event);
}
});
return ret;
}
return mAwContents.dispatchKeyEvent(event);
|
public void | documentHasImages(android.os.Message response)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
documentHasImages(response);
}
});
return;
}
mAwContents.documentHasImages(response);
|
private boolean | doesSupportFullscreen(android.webkit.WebChromeClient client)Returns true if the supplied {@link WebChromeClient} supports fullscreen.
For fullscreen support, implementations of {@link WebChromeClient#onShowCustomView}
and {@link WebChromeClient#onHideCustomView()} are required.
if (client == null) {
return false;
}
Class<?> clientClass = client.getClass();
boolean foundShowMethod = false;
boolean foundHideMethod = false;
while (clientClass != WebChromeClient.class && (!foundShowMethod || !foundHideMethod)) {
if (!foundShowMethod) {
try {
clientClass.getDeclaredMethod("onShowCustomView", View.class,
CustomViewCallback.class);
foundShowMethod = true;
} catch (NoSuchMethodException e) { }
}
if (!foundHideMethod) {
try {
clientClass.getDeclaredMethod("onHideCustomView");
foundHideMethod = true;
} catch (NoSuchMethodException e) { }
}
clientClass = clientClass.getSuperclass();
}
return foundShowMethod && foundHideMethod;
|
public void | dumpViewHierarchyWithProperties(java.io.BufferedWriter out, int level)
// Intentional no-op
|
static void | enableSlowWholeDocumentDraw()
sRecordWholeDocumentEnabledByApi = true;
|
public void | evaluateJavaScript(java.lang.String script, android.webkit.ValueCallback resultCallback)
checkThread();
mAwContents.evaluateJavaScript(script, resultCallback);
|
public void | extractSmartClipData(int x, int y, int width, int height)
checkThread();
mAwContents.extractSmartClipData(x, y, width, height);
|
public int | findAll(java.lang.String searchString)
findAllAsync(searchString);
return 0;
|
public void | findAllAsync(java.lang.String searchString)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
findAllAsync(searchString);
}
});
return;
}
mAwContents.findAllAsync(searchString);
|
public android.view.View | findHierarchyView(java.lang.String className, int hashCode)
// Intentional no-op
return null;
|
public void | findNext(boolean forwards)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
findNext(forwards);
}
});
return;
}
mAwContents.findNext(forwards);
|
private static java.lang.String | fixupBase(java.lang.String url)
return TextUtils.isEmpty(url) ? "about:blank" : url;
|
private static java.lang.String | fixupData(java.lang.String data)
return TextUtils.isEmpty(data) ? "" : data;
|
private static java.lang.String | fixupHistory(java.lang.String url)
return TextUtils.isEmpty(url) ? "about:blank" : url;
|
private static java.lang.String | fixupMimeType(java.lang.String mimeType)
return TextUtils.isEmpty(mimeType) ? "text/html" : mimeType;
|
public void | flingScroll(int vx, int vy)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
flingScroll(vx, vy);
}
});
return;
}
mAwContents.flingScroll(vx, vy);
|
public void | freeMemory()
// Intentional no-op. Memory is managed automatically by Chromium.
|
public android.view.accessibility.AccessibilityNodeProvider | getAccessibilityNodeProvider()
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
AccessibilityNodeProvider ret = runOnUiThreadBlocking(
new Callable<AccessibilityNodeProvider>() {
@Override
public AccessibilityNodeProvider call() {
return getAccessibilityNodeProvider();
}
});
return ret;
}
return mAwContents.getAccessibilityNodeProvider();
|
public android.net.http.SslCertificate | getCertificate()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
SslCertificate ret = runOnUiThreadBlocking(new Callable<SslCertificate>() {
@Override
public SslCertificate call() {
return getCertificate();
}
});
return ret;
}
return mAwContents.getCertificate();
|
public int | getContentHeight()
if (mAwContents == null) return 0;
// No checkThread() as it is mostly thread safe (workaround for b/10594869).
return mAwContents.getContentHeightCss();
|
public int | getContentWidth()
if (mAwContents == null) return 0;
// No checkThread() as it is mostly thread safe (workaround for b/10594869).
return mAwContents.getContentWidthCss();
|
public android.graphics.Bitmap | getFavicon()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
Bitmap ret = runOnUiThreadBlocking(new Callable<Bitmap>() {
@Override
public Bitmap call() {
return getFavicon();
}
});
return ret;
}
return mAwContents.getFavicon();
|
public WebView.HitTestResult | getHitTestResult()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
WebView.HitTestResult ret = runOnUiThreadBlocking(
new Callable<WebView.HitTestResult>() {
@Override
public WebView.HitTestResult call() {
return getHitTestResult();
}
});
return ret;
}
AwContents.HitTestData data = mAwContents.getLastHitTestResult();
mHitTestResult.setType(data.hitTestResultType);
mHitTestResult.setExtra(data.hitTestResultExtraData);
return mHitTestResult;
|
public java.lang.String[] | getHttpAuthUsernamePassword(java.lang.String host, java.lang.String realm)
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
String[] ret = runOnUiThreadBlocking(new Callable<String[]>() {
@Override
public String[] call() {
return getHttpAuthUsernamePassword(host, realm);
}
});
return ret;
}
return mAwContents.getHttpAuthUsernamePassword(host, realm);
|
public java.lang.String | getOriginalUrl()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
String ret = runOnUiThreadBlocking(new Callable<String>() {
@Override
public String call() {
return getOriginalUrl();
}
});
return ret;
}
String url = mAwContents.getOriginalUrl();
if (url == null || url.trim().isEmpty()) return null;
return url;
|
public int | getProgress()
if (mAwContents == null) return 100;
// No checkThread() because the value is cached java side (workaround for b/10533304).
return mAwContents.getMostRecentProgress();
|
public float | getScale()
// No checkThread() as it is mostly thread safe (workaround for b/10652991).
mFactory.startYourEngines(true);
return mAwContents.getScale();
|
public WebViewProvider.ScrollDelegate | getScrollDelegate()
return this;
|
public android.webkit.WebSettings | getSettings()
return mWebSettings;
|
public java.lang.String | getTitle()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
String ret = runOnUiThreadBlocking(new Callable<String>() {
@Override
public String call() {
return getTitle();
}
});
return ret;
}
return mAwContents.getTitle();
|
public java.lang.String | getTouchIconUrl()
// Intentional no-op: hidden method on WebView.
return null;
|
public java.lang.String | getUrl()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
String ret = runOnUiThreadBlocking(new Callable<String>() {
@Override
public String call() {
return getUrl();
}
});
return ret;
}
String url = mAwContents.getUrl();
if (url == null || url.trim().isEmpty()) return null;
return url;
|
public WebViewProvider.ViewDelegate | getViewDelegate()
return this;
|
public int | getVisibleTitleHeight()
// This is deprecated in WebView and should always return 0.
return 0;
|
public android.view.View | getZoomControls()
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
return null;
}
// This was deprecated in 2009 and hidden in JB MR1, so just provide the minimum needed
// to stop very out-dated applications from crashing.
Log.w(TAG, "WebView doesn't support getZoomControls");
return mAwContents.getSettings().supportZoom() ? new View(mWebView.getContext()) : null;
|
public void | goBack()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
goBack();
}
});
return;
}
mAwContents.goBack();
|
public void | goBackOrForward(int steps)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
goBackOrForward(steps);
}
});
return;
}
mAwContents.goBackOrForward(steps);
|
public void | goForward()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
goForward();
}
});
return;
}
mAwContents.goForward();
|
public void | init(java.util.Map javaScriptInterfaces, boolean privateBrowsing)
if (privateBrowsing) {
mFactory.startYourEngines(true);
final String msg = "Private browsing is not supported in WebView.";
if (mAppTargetSdkVersion >= Build.VERSION_CODES.KITKAT) {
throw new IllegalArgumentException(msg);
} else {
Log.w(TAG, msg);
TextView warningLabel = new TextView(mWebView.getContext());
warningLabel.setText(mWebView.getContext().getString(
R.string.webviewchromium_private_browsing_warning));
mWebView.addView(warningLabel);
}
}
// We will defer real initialization until we know which thread to do it on, unless:
// - we are on the main thread already (common case),
// - the app is targeting >= JB MR2, in which case checkThread enforces that all usage
// comes from a single thread. (Note in JB MR2 this exception was in WebView.java).
if (mAppTargetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
mFactory.startYourEngines(false);
checkThread();
} else if (!mFactory.hasStarted()) {
if (Looper.myLooper() == Looper.getMainLooper()) {
mFactory.startYourEngines(true);
}
}
final boolean isAccessFromFileURLsGrantedByDefault =
mAppTargetSdkVersion < Build.VERSION_CODES.JELLY_BEAN;
final boolean areLegacyQuirksEnabled =
mAppTargetSdkVersion < Build.VERSION_CODES.KITKAT;
mContentsClientAdapter = new WebViewContentsClientAdapter(
mWebView, mFactory.getWebViewDelegate());
mWebSettings = new ContentSettingsAdapter(new AwSettings(
mWebView.getContext(), isAccessFromFileURLsGrantedByDefault,
areLegacyQuirksEnabled));
if (mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP) {
// Prior to Lollipop we always allowed third party cookies and mixed content.
mWebSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
mWebSettings.setAcceptThirdPartyCookies(true);
mWebSettings.getAwSettings().setZeroLayoutHeightDisablesViewportQuirk(true);
}
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
initForReal();
if (privateBrowsing) {
// Intentionally irreversibly disable the webview instance, so that private
// user data cannot leak through misuse of a non-privateBrowing WebView
// instance. Can't just null out mAwContents as we never null-check it
// before use.
destroy();
}
}
});
|
private void | initForReal()
Context ctx = resourcesContextWrapper(mWebView.getContext());
mAwContents = new AwContents(mFactory.getBrowserContext(), mWebView, ctx,
new InternalAccessAdapter(), new WebViewNativeGLDelegate(),
mContentsClientAdapter, mWebSettings.getAwSettings());
if (mAppTargetSdkVersion >= Build.VERSION_CODES.KITKAT) {
// On KK and above, favicons are automatically downloaded as the method
// old apps use to enable that behavior is deprecated.
AwContents.setShouldDownloadFavicons();
}
AwContentsStatics.setRecordFullDocument(sRecordWholeDocumentEnabledByApi ||
mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP);
if (mAppTargetSdkVersion < Build.VERSION_CODES.LOLLIPOP) {
// Prior to Lollipop, JavaScript objects injected via addJavascriptInterface
// were not inspectable.
mAwContents.disableJavascriptInterfacesInspection();
}
// TODO: This assumes AwContents ignores second Paint param.
mAwContents.setLayerType(mWebView.getLayerType(), null);
|
public void | invokeZoomPicker()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
invokeZoomPicker();
}
});
return;
}
mAwContents.invokeZoomPicker();
|
private static boolean | isBase64Encoded(java.lang.String encoding)
return "base64".equals(encoding);
|
public boolean | isPaused()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
Boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return isPaused();
}
});
return ret;
}
return mAwContents.isPaused();
|
public boolean | isPrivateBrowsingEnabled()
// Not supported in this WebView implementation.
return false;
|
public void | loadData(java.lang.String data, java.lang.String mimeType, java.lang.String encoding)
loadUrlOnUiThread(LoadUrlParams.createLoadDataParams(
fixupData(data), fixupMimeType(mimeType), isBase64Encoded(encoding)));
|
public void | loadDataWithBaseURL(java.lang.String baseUrl, java.lang.String data, java.lang.String mimeType, java.lang.String encoding, java.lang.String historyUrl)
data = fixupData(data);
mimeType = fixupMimeType(mimeType);
LoadUrlParams loadUrlParams;
baseUrl = fixupBase(baseUrl);
historyUrl = fixupHistory(historyUrl);
if (baseUrl.startsWith("data:")) {
// For backwards compatibility with WebViewClassic, we use the value of |encoding|
// as the charset, as long as it's not "base64".
boolean isBase64 = isBase64Encoded(encoding);
loadUrlParams = LoadUrlParams.createLoadDataParamsWithBaseUrl(
data, mimeType, isBase64, baseUrl, historyUrl, isBase64 ? null : encoding);
} else {
// When loading data with a non-data: base URL, the classic WebView would effectively
// "dump" that string of data into the WebView without going through regular URL
// loading steps such as decoding URL-encoded entities. We achieve this same behavior by
// base64 encoding the data that is passed here and then loading that as a data: URL.
try {
loadUrlParams = LoadUrlParams.createLoadDataParamsWithBaseUrl(
Base64.encodeToString(data.getBytes("utf-8"), Base64.DEFAULT), mimeType,
true, baseUrl, historyUrl, "utf-8");
} catch (java.io.UnsupportedEncodingException e) {
Log.wtf(TAG, "Unable to load data string " + data, e);
return;
}
}
loadUrlOnUiThread(loadUrlParams);
|
public void | loadUrl(java.lang.String url, java.util.Map additionalHttpHeaders)
// TODO: We may actually want to do some sanity checks here (like filter about://chrome).
// For backwards compatibility, apps targeting less than K will have JS URLs evaluated
// directly and any result of the evaluation will not replace the current page content.
// Matching Chrome behavior more closely; apps targetting >= K that load a JS URL will
// have the result of that URL replace the content of the current page.
final String JAVASCRIPT_SCHEME = "javascript:";
if (mAppTargetSdkVersion < Build.VERSION_CODES.KITKAT &&
url != null && url.startsWith(JAVASCRIPT_SCHEME)) {
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
mAwContents.evaluateJavaScriptEvenIfNotYetNavigated(
url.substring(JAVASCRIPT_SCHEME.length()));
}
});
} else {
mAwContents.evaluateJavaScriptEvenIfNotYetNavigated(
url.substring(JAVASCRIPT_SCHEME.length()));
}
return;
}
LoadUrlParams params = new LoadUrlParams(url);
if (additionalHttpHeaders != null) params.setExtraHeaders(additionalHttpHeaders);
loadUrlOnUiThread(params);
|
public void | loadUrl(java.lang.String url)
// Early out to match old WebView implementation
if (url == null) {
return;
}
loadUrl(url, null);
|
private void | loadUrlOnUiThread(org.chromium.content_public.browser.LoadUrlParams loadUrlParams)
// This is the last point that we can delay starting the Chromium backend up
// and if the app has not caused us to bind the Chromium UI thread to a background thread
// we now bind Chromium's notion of the UI thread to the app main thread.
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
// Disallowed in WebView API for apps targetting a new SDK
assert mAppTargetSdkVersion < Build.VERSION_CODES.JELLY_BEAN_MR2;
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
mAwContents.loadUrl(loadUrlParams);
}
});
return;
}
mAwContents.loadUrl(loadUrlParams);
|
public void | notifyFindDialogDismissed()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
notifyFindDialogDismissed();
}
});
return;
}
clearMatches();
|
public void | onAttachedToWindow()
// This API is our strongest signal from the View system that this
// WebView is going to be bound to a View hierarchy and so at this
// point we must bind Chromium's UI thread to the current thread.
mFactory.startYourEngines(false);
checkThread();
mAwContents.onAttachedToWindow();
|
public void | onConfigurationChanged(android.content.res.Configuration newConfig)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
onConfigurationChanged(newConfig);
}
});
return;
}
mAwContents.onConfigurationChanged(newConfig);
|
public android.view.inputmethod.InputConnection | onCreateInputConnection(android.view.inputmethod.EditorInfo outAttrs)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
return null;
}
return mAwContents.onCreateInputConnection(outAttrs);
|
public void | onDetachedFromWindow()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
onDetachedFromWindow();
}
});
return;
}
mAwContents.onDetachedFromWindow();
|
public void | onDraw(android.graphics.Canvas canvas)
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
runVoidTaskOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
onDraw(canvas);
}
});
return;
}
mAwContents.onDraw(canvas);
|
public void | onDrawVerticalScrollBar(android.graphics.Canvas canvas, android.graphics.drawable.Drawable scrollBar, int l, int t, int r, int b)
// WebViewClassic was overriding this method to handle rubberband over-scroll. Since
// WebViewChromium doesn't support that the vanilla implementation of this method can be
// used.
mWebViewPrivate.super_onDrawVerticalScrollBar(canvas, scrollBar, l, t, r, b);
|
public void | onFinishTemporaryDetach()
mAwContents.onFinishTemporaryDetach();
|
public void | onFocusChanged(boolean focused, int direction, android.graphics.Rect previouslyFocusedRect)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
onFocusChanged(focused, direction, previouslyFocusedRect);
}
});
return;
}
mAwContents.onFocusChanged(focused, direction, previouslyFocusedRect);
|
public boolean | onGenericMotionEvent(android.view.MotionEvent event)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return onGenericMotionEvent(event);
}
});
return ret;
}
return mAwContents.onGenericMotionEvent(event);
|
public boolean | onHoverEvent(android.view.MotionEvent event)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return onHoverEvent(event);
}
});
return ret;
}
return mAwContents.onHoverEvent(event);
|
public void | onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
runVoidTaskOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
onInitializeAccessibilityEvent(event);
}
});
return;
}
mAwContents.onInitializeAccessibilityEvent(event);
|
public void | onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo info)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
runVoidTaskOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
onInitializeAccessibilityNodeInfo(info);
}
});
return;
}
mAwContents.onInitializeAccessibilityNodeInfo(info);
|
public boolean | onKeyDown(int keyCode, android.view.KeyEvent event)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return onKeyDown(keyCode, event);
}
});
return ret;
}
UnimplementedWebViewApi.invoke();
return false;
|
public boolean | onKeyMultiple(int keyCode, int repeatCount, android.view.KeyEvent event)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return onKeyMultiple(keyCode, repeatCount, event);
}
});
return ret;
}
UnimplementedWebViewApi.invoke();
return false;
|
public boolean | onKeyUp(int keyCode, android.view.KeyEvent event)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return onKeyUp(keyCode, event);
}
});
return ret;
}
return mAwContents.onKeyUp(keyCode, event);
|
public void | onMeasure(int widthMeasureSpec, int heightMeasureSpec)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
runVoidTaskOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
onMeasure(widthMeasureSpec, heightMeasureSpec);
}
});
return;
}
mAwContents.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
public void | onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
onOverScrolled(scrollX, scrollY, clampedX, clampedY);
}
});
return;
}
mAwContents.onContainerViewOverScrolled(scrollX, scrollY, clampedX, clampedY);
|
public void | onPause()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
onPause();
}
});
return;
}
mAwContents.onPause();
|
public void | onResume()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
onResume();
}
});
return;
}
mAwContents.onResume();
|
public void | onScrollChanged(int l, int t, int oldl, int oldt)
|
public void | onSizeChanged(int w, int h, int ow, int oh)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
onSizeChanged(w, h, ow, oh);
}
});
return;
}
mAwContents.onSizeChanged(w, h, ow, oh);
|
public void | onStartTemporaryDetach()
mAwContents.onStartTemporaryDetach();
|
public boolean | onTouchEvent(android.view.MotionEvent ev)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return onTouchEvent(ev);
}
});
return ret;
}
return mAwContents.onTouchEvent(ev);
|
public boolean | onTrackballEvent(android.view.MotionEvent ev)
// Trackball event not handled, which eventually gets converted to DPAD keyevents
return false;
|
public void | onVisibilityChanged(android.view.View changedView, int visibility)
// The AwContents will find out the container view visibility before the first draw so we
// can safely ignore onVisibilityChanged callbacks that happen before init().
if (mAwContents == null) return;
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
onVisibilityChanged(changedView, visibility);
}
});
return;
}
mAwContents.onVisibilityChanged(changedView, visibility);
|
public void | onWindowFocusChanged(boolean hasWindowFocus)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
onWindowFocusChanged(hasWindowFocus);
}
});
return;
}
mAwContents.onWindowFocusChanged(hasWindowFocus);
|
public void | onWindowVisibilityChanged(int visibility)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
onWindowVisibilityChanged(visibility);
}
});
return;
}
mAwContents.onWindowVisibilityChanged(visibility);
|
public boolean | overlayHorizontalScrollbar()
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return overlayHorizontalScrollbar();
}
});
return ret;
}
return mAwContents.overlayHorizontalScrollbar();
|
public boolean | overlayVerticalScrollbar()
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return overlayVerticalScrollbar();
}
});
return ret;
}
return mAwContents.overlayVerticalScrollbar();
|
public boolean | pageDown(boolean bottom)
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
Boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return pageDown(bottom);
}
});
return ret;
}
return mAwContents.pageDown(bottom);
|
public boolean | pageUp(boolean top)
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
Boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return pageUp(top);
}
});
return ret;
}
return mAwContents.pageUp(top);
|
public void | pauseTimers()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
pauseTimers();
}
});
return;
}
mAwContents.pauseTimers();
|
public boolean | performAccessibilityAction(int action, android.os.Bundle arguments)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return performAccessibilityAction(action, arguments);
}
});
return ret;
}
if (mAwContents.supportsAccessibilityAction(action)) {
return mAwContents.performAccessibilityAction(action, arguments);
}
return mWebViewPrivate.super_performAccessibilityAction(action, arguments);
|
public boolean | performLongClick()
// Return false unless the WebView is attached to a View with a parent
return mWebView.getParent() != null ? mWebViewPrivate.super_performLongClick() : false;
|
public void | postUrl(java.lang.String url, byte[] postData)
LoadUrlParams params = LoadUrlParams.createLoadHttpPostParams(url, postData);
Map<String,String> headers = new HashMap<String,String>();
headers.put("Content-Type", "application/x-www-form-urlencoded");
params.setExtraHeaders(headers);
loadUrlOnUiThread(params);
|
public void | preDispatchDraw(android.graphics.Canvas canvas)
// TODO(leandrogracia): remove this method from WebViewProvider if we think
// we won't need it again.
|
public void | reload()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
reload();
}
});
return;
}
mAwContents.reload();
|
public void | removeJavascriptInterface(java.lang.String interfaceName)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
removeJavascriptInterface(interfaceName);
}
});
return;
}
mAwContents.removeJavascriptInterface(interfaceName);
|
public boolean | requestChildRectangleOnScreen(android.view.View child, android.graphics.Rect rect, boolean immediate)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return requestChildRectangleOnScreen(child, rect, immediate);
}
});
return ret;
}
return mAwContents.requestChildRectangleOnScreen(child, rect, immediate);
|
public boolean | requestFocus(int direction, android.graphics.Rect previouslyFocusedRect)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return requestFocus(direction, previouslyFocusedRect);
}
});
return ret;
}
mAwContents.requestFocus();
return mWebViewPrivate.super_requestFocus(direction, previouslyFocusedRect);
|
public void | requestFocusNodeHref(android.os.Message hrefMsg)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
requestFocusNodeHref(hrefMsg);
}
});
return;
}
mAwContents.requestFocusNodeHref(hrefMsg);
|
public void | requestImageRef(android.os.Message msg)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
requestImageRef(msg);
}
});
return;
}
mAwContents.requestImageRef(msg);
|
private static android.content.Context | resourcesContextWrapper(android.content.Context ctx)
return new ContextWrapper(ctx) {
@Override
public ClassLoader getClassLoader() {
final ClassLoader appCl = getBaseContext().getClassLoader();
final ClassLoader webViewCl = this.getClass().getClassLoader();
return new ClassLoader() {
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
// First look in the WebViewProvider class loader.
try {
return webViewCl.loadClass(name);
} catch (ClassNotFoundException e) {
// Look in the app class loader; allowing it to throw ClassNotFoundException.
return appCl.loadClass(name);
}
}
};
}
@Override
public Object getSystemService(String name) {
if (name.equals(Context.LAYOUT_INFLATER_SERVICE)) {
LayoutInflater i = (LayoutInflater) getBaseContext().getSystemService(name);
return i.cloneInContext(this);
} else {
return getBaseContext().getSystemService(name);
}
}
};
|
public boolean | restorePicture(android.os.Bundle b, java.io.File src)
// Intentional no-op: hidden method on WebView.
return false;
|
public android.webkit.WebBackForwardList | restoreState(android.os.Bundle inState)
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
WebBackForwardList ret = runOnUiThreadBlocking(new Callable<WebBackForwardList>() {
@Override
public WebBackForwardList call() {
return restoreState(inState);
}
});
return ret;
}
if (inState == null) return null;
if (!mAwContents.restoreState(inState)) return null;
return copyBackForwardList();
|
public void | resumeTimers()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
resumeTimers();
}
});
return;
}
mAwContents.resumeTimers();
|
private T | runBlockingFuture(java.util.concurrent.FutureTask task)
if (!mFactory.hasStarted()) throw new RuntimeException("Must be started before we block!");
if (ThreadUtils.runningOnUiThread()) {
throw new IllegalStateException("This method should only be called off the UI thread");
}
mRunQueue.addTask(task);
try {
return task.get(4, TimeUnit.SECONDS);
} catch (java.util.concurrent.TimeoutException e) {
throw new RuntimeException("Probable deadlock detected due to WebView API being called "
+ "on incorrect thread while the UI thread is blocked.", e);
} catch (Exception e) {
throw new RuntimeException(e);
}
|
private T | runOnUiThreadBlocking(java.util.concurrent.Callable c)
return runBlockingFuture(new FutureTask<T>(c));
|
private void | runVoidTaskOnUiThreadBlocking(java.lang.Runnable r)
FutureTask<Void> task = new FutureTask<Void>(r, null);
runBlockingFuture(task);
|
public void | savePassword(java.lang.String host, java.lang.String username, java.lang.String password)
// This is a deprecated API: intentional no-op.
|
public boolean | savePicture(android.os.Bundle b, java.io.File dest)
// Intentional no-op: hidden method on WebView.
return false;
|
public android.webkit.WebBackForwardList | saveState(android.os.Bundle outState)
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
WebBackForwardList ret = runOnUiThreadBlocking(new Callable<WebBackForwardList>() {
@Override
public WebBackForwardList call() {
return saveState(outState);
}
});
return ret;
}
if (outState == null) return null;
if (!mAwContents.saveState(outState)) return null;
return copyBackForwardList();
|
public void | saveWebArchive(java.lang.String filename)
saveWebArchive(filename, false, null);
|
public void | saveWebArchive(java.lang.String basename, boolean autoname, android.webkit.ValueCallback callback)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
saveWebArchive(basename, autoname, callback);
}
});
return;
}
mAwContents.saveWebArchive(basename, autoname, callback);
|
public void | setBackgroundColor(int color)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
ThreadUtils.postOnUiThread(new Runnable() {
@Override
public void run() {
setBackgroundColor(color);
}
});
return;
}
mAwContents.setBackgroundColor(color);
|
public void | setCertificate(android.net.http.SslCertificate certificate)
// intentional no-op
|
public void | setDownloadListener(android.webkit.DownloadListener listener)
mContentsClientAdapter.setDownloadListener(listener);
|
public void | setFindListener(WebView.FindListener listener)
mContentsClientAdapter.setFindListener(listener);
|
public boolean | setFrame(int left, int top, int right, int bottom)
return mWebViewPrivate.super_setFrame(left, top, right, bottom);
|
public void | setHorizontalScrollbarOverlay(boolean overlay)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
setHorizontalScrollbarOverlay(overlay);
}
});
return;
}
mAwContents.setHorizontalScrollbarOverlay(overlay);
|
public void | setHttpAuthUsernamePassword(java.lang.String host, java.lang.String realm, java.lang.String username, java.lang.String password)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
setHttpAuthUsernamePassword(host, realm, username, password);
}
});
return;
}
mAwContents.setHttpAuthUsernamePassword(host, realm, username, password);
|
public void | setInitialScale(int scaleInPercent)
// No checkThread() as it is thread safe
mWebSettings.getAwSettings().setInitialPageScale(scaleInPercent);
|
public void | setLayerType(int layerType, android.graphics.Paint paint)
// This can be called from WebView constructor in which case mAwContents
// is still null. We set the layer type in initForReal in that case.
if (mAwContents == null) return;
if (checkNeedsPost()) {
ThreadUtils.postOnUiThread(new Runnable() {
@Override
public void run() {
setLayerType(layerType, paint);
}
});
return;
}
mAwContents.setLayerType(layerType, paint);
|
public void | setLayoutParams(ViewGroup.LayoutParams layoutParams)
// This API is our strongest signal from the View system that this
// WebView is going to be bound to a View hierarchy and so at this
// point we must bind Chromium's UI thread to the current thread.
mFactory.startYourEngines(false);
checkThread();
mWebViewPrivate.super_setLayoutParams(layoutParams);
|
public void | setMapTrackballToArrowKeys(boolean setMap)
// This is a deprecated API: intentional no-op.
|
public void | setNetworkAvailable(boolean networkUp)
// Note that this purely toggles the JS navigator.online property.
// It does not in affect chromium or network stack state in any way.
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
setNetworkAvailable(networkUp);
}
});
return;
}
mAwContents.setNetworkAvailable(networkUp);
|
public void | setOverScrollMode(int mode)
// This gets called from the android.view.View c'tor that WebView inherits from. This
// causes the method to be called when mAwContents == null.
// It's safe to ignore these calls however since AwContents will read the current value of
// this setting when it's created.
if (mAwContents == null) return;
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
setOverScrollMode(mode);
}
});
return;
}
mAwContents.setOverScrollMode(mode);
|
public void | setPictureListener(WebView.PictureListener listener)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
setPictureListener(listener);
}
});
return;
}
mContentsClientAdapter.setPictureListener(listener);
mAwContents.enableOnNewPicture(listener != null,
mAppTargetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2);
|
public void | setScrollBarStyle(int style)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
setScrollBarStyle(style);
}
});
return;
}
mAwContents.setScrollBarStyle(style);
|
public void | setSmartClipResultHandler(android.os.Handler resultHandler)
checkThread();
mAwContents.setSmartClipResultHandler(resultHandler);
|
public void | setVerticalScrollbarOverlay(boolean overlay)
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
setVerticalScrollbarOverlay(overlay);
}
});
return;
}
mAwContents.setVerticalScrollbarOverlay(overlay);
|
public void | setWebChromeClient(android.webkit.WebChromeClient client)
mWebSettings.getAwSettings().setFullscreenSupported(doesSupportFullscreen(client));
mContentsClientAdapter.setWebChromeClient(client);
|
public void | setWebViewClient(android.webkit.WebViewClient client)
mContentsClientAdapter.setWebViewClient(client);
|
public boolean | shouldDelayChildPressedState()
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return shouldDelayChildPressedState();
}
});
return ret;
}
return true;
|
public boolean | showFindDialog(java.lang.String text, boolean showIme)
mFactory.startYourEngines(false);
if (checkNeedsPost()) {
return false;
}
if (mWebView.getParent() == null) {
return false;
}
FindActionModeCallback findAction = new FindActionModeCallback(mWebView.getContext());
if (findAction == null) {
return false;
}
mWebView.startActionMode(findAction);
findAction.setWebView(mWebView);
if (showIme) {
findAction.showSoftInput();
}
if (text != null) {
findAction.setText(text);
findAction.findAll();
}
return true;
|
void | startYourEngine()
mRunQueue.drainQueue();
|
public void | stopLoading()
if (checkNeedsPost()) {
mRunQueue.addTask(new Runnable() {
@Override
public void run() {
stopLoading();
}
});
return;
}
mAwContents.stopLoading();
|
public boolean | zoomBy(float factor)
mFactory.startYourEngines(true);
// This is an L API and therefore we can enforce stricter threading constraints.
checkThread();
return mAwContents.zoomBy(factor);
|
public boolean | zoomIn()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return zoomIn();
}
});
return ret;
}
return mAwContents.zoomIn();
|
public boolean | zoomOut()
mFactory.startYourEngines(true);
if (checkNeedsPost()) {
boolean ret = runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() {
return zoomOut();
}
});
return ret;
}
return mAwContents.zoomOut();
|