Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2823)

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 1022993002: Add debug logging for calls into AwContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwSettings.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.android_webview; 5 package org.chromium.android_webview;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.app.Activity; 8 import android.app.Activity;
9 import android.content.ComponentCallbacks2; 9 import android.content.ComponentCallbacks2;
10 import android.content.Context; 10 import android.content.Context;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 * and Browser components that are required to implement Android WebView API. Th is is the 82 * and Browser components that are required to implement Android WebView API. Th is is the
83 * primary entry point for the WebViewProvider implementation; it holds a 1:1 ob ject 83 * primary entry point for the WebViewProvider implementation; it holds a 1:1 ob ject
84 * relationship with application WebView instances. 84 * relationship with application WebView instances.
85 * (We define this class independent of the hidden WebViewProvider interfaces, t o allow 85 * (We define this class independent of the hidden WebViewProvider interfaces, t o allow
86 * continuous build & test in the open source SDK-based tree). 86 * continuous build & test in the open source SDK-based tree).
87 */ 87 */
88 @JNINamespace("android_webview") 88 @JNINamespace("android_webview")
89 public class AwContents implements SmartClipProvider, 89 public class AwContents implements SmartClipProvider,
90 PostMessageSender.PostMessageSenderDelegate { 90 PostMessageSender.PostMessageSenderDelegate {
91 private static final String TAG = "AwContents"; 91 private static final String TAG = "AwContents";
92 private static final boolean TRACE = false;
92 93
93 private static final String WEB_ARCHIVE_EXTENSION = ".mht"; 94 private static final String WEB_ARCHIVE_EXTENSION = ".mht";
94 95
95 // Used to avoid enabling zooming in / out if resulting zooming will 96 // Used to avoid enabling zooming in / out if resulting zooming will
96 // produce little visible difference. 97 // produce little visible difference.
97 private static final float ZOOM_CONTROLS_EPSILON = 0.007f; 98 private static final float ZOOM_CONTROLS_EPSILON = 0.007f;
98 99
99 /** 100 /**
100 * WebKit hit test related data structure. These are used to implement 101 * WebKit hit test related data structure. These are used to implement
101 * getHitTestResult, requestFocusNodeHref, requestImageRef methods in WebVie w. 102 * getHitTestResult, requestFocusNodeHref, requestImageRef methods in WebVie w.
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 entry.getValue().first, 963 entry.getValue().first,
963 entry.getKey(), 964 entry.getKey(),
964 requiredAnnotation); 965 requiredAnnotation);
965 } 966 }
966 } 967 }
967 968
968 /** 969 /**
969 * Destroys this object and deletes its native counterpart. 970 * Destroys this object and deletes its native counterpart.
970 */ 971 */
971 public void destroy() { 972 public void destroy() {
973 if (TRACE) Log.d(TAG, "destroy");
972 if (isDestroyed()) return; 974 if (isDestroyed()) return;
973 975
974 if (mPostMessageSender != null) { 976 if (mPostMessageSender != null) {
975 mBrowserContext.getMessagePortService().removeObserver(mPostMessageS ender); 977 mBrowserContext.getMessagePortService().removeObserver(mPostMessageS ender);
976 mPostMessageSender = null; 978 mPostMessageSender = null;
977 } 979 }
978 980
979 // If we are attached, we have to call native detach to clean up 981 // If we are attached, we have to call native detach to clean up
980 // hardware resources. 982 // hardware resources.
981 if (mIsAttachedToWindow) { 983 if (mIsAttachedToWindow) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 1131
1130 public int getContentHeightCss() { 1132 public int getContentHeightCss() {
1131 return (int) Math.ceil(mContentHeightDip); 1133 return (int) Math.ceil(mContentHeightDip);
1132 } 1134 }
1133 1135
1134 public int getContentWidthCss() { 1136 public int getContentWidthCss() {
1135 return (int) Math.ceil(mContentWidthDip); 1137 return (int) Math.ceil(mContentWidthDip);
1136 } 1138 }
1137 1139
1138 public Picture capturePicture() { 1140 public Picture capturePicture() {
1141 if (TRACE) Log.d(TAG, "capturePicture");
1139 if (isDestroyed()) return null; 1142 if (isDestroyed()) return null;
1140 return new AwPicture(nativeCapturePicture(mNativeAwContents, 1143 return new AwPicture(nativeCapturePicture(mNativeAwContents,
1141 mScrollOffsetManager.computeHorizontalScrollRange(), 1144 mScrollOffsetManager.computeHorizontalScrollRange(),
1142 mScrollOffsetManager.computeVerticalScrollRange())); 1145 mScrollOffsetManager.computeVerticalScrollRange()));
1143 } 1146 }
1144 1147
1145 public void clearView() { 1148 public void clearView() {
1149 if (TRACE) Log.d(TAG, "clearView");
1146 if (!isDestroyed()) nativeClearView(mNativeAwContents); 1150 if (!isDestroyed()) nativeClearView(mNativeAwContents);
1147 } 1151 }
1148 1152
1149 /** 1153 /**
1150 * Enable the onNewPicture callback. 1154 * Enable the onNewPicture callback.
1151 * @param enabled Flag to enable the callback. 1155 * @param enabled Flag to enable the callback.
1152 * @param invalidationOnly Flag to call back only on invalidation without pr oviding a picture. 1156 * @param invalidationOnly Flag to call back only on invalidation without pr oviding a picture.
1153 */ 1157 */
1154 public void enableOnNewPicture(boolean enabled, boolean invalidationOnly) { 1158 public void enableOnNewPicture(boolean enabled, boolean invalidationOnly) {
1159 if (TRACE) Log.d(TAG, "enableOnNewPicture=" + enabled);
1155 if (isDestroyed()) return; 1160 if (isDestroyed()) return;
1156 if (invalidationOnly) { 1161 if (invalidationOnly) {
1157 mPictureListenerContentProvider = null; 1162 mPictureListenerContentProvider = null;
1158 } else if (enabled && mPictureListenerContentProvider == null) { 1163 } else if (enabled && mPictureListenerContentProvider == null) {
1159 mPictureListenerContentProvider = new Callable<Picture>() { 1164 mPictureListenerContentProvider = new Callable<Picture>() {
1160 @Override 1165 @Override
1161 public Picture call() { 1166 public Picture call() {
1162 return capturePicture(); 1167 return capturePicture();
1163 } 1168 }
1164 }; 1169 };
1165 } 1170 }
1166 nativeEnableOnNewPicture(mNativeAwContents, enabled); 1171 nativeEnableOnNewPicture(mNativeAwContents, enabled);
1167 } 1172 }
1168 1173
1169 public void findAllAsync(String searchString) { 1174 public void findAllAsync(String searchString) {
1175 if (TRACE) Log.d(TAG, "findAllAsync");
1170 if (!isDestroyed()) nativeFindAllAsync(mNativeAwContents, searchString); 1176 if (!isDestroyed()) nativeFindAllAsync(mNativeAwContents, searchString);
1171 } 1177 }
1172 1178
1173 public void findNext(boolean forward) { 1179 public void findNext(boolean forward) {
1180 if (TRACE) Log.d(TAG, "findNext");
1174 if (!isDestroyed()) nativeFindNext(mNativeAwContents, forward); 1181 if (!isDestroyed()) nativeFindNext(mNativeAwContents, forward);
1175 } 1182 }
1176 1183
1177 public void clearMatches() { 1184 public void clearMatches() {
1185 if (TRACE) Log.d(TAG, "clearMatches");
1178 if (!isDestroyed()) nativeClearMatches(mNativeAwContents); 1186 if (!isDestroyed()) nativeClearMatches(mNativeAwContents);
1179 } 1187 }
1180 1188
1181 /** 1189 /**
1182 * @return load progress of the WebContents. 1190 * @return load progress of the WebContents.
1183 */ 1191 */
1184 public int getMostRecentProgress() { 1192 public int getMostRecentProgress() {
1185 // WebContentsDelegateAndroid conveniently caches the most recent notifi ed value for us. 1193 // WebContentsDelegateAndroid conveniently caches the most recent notifi ed value for us.
1186 return mWebContentsDelegate.getMostRecentProgress(); 1194 return mWebContentsDelegate.getMostRecentProgress();
1187 } 1195 }
(...skipping 14 matching lines...) Expand all
1202 }); 1210 });
1203 } 1211 }
1204 }; 1212 };
1205 mContentsClient.getVisitedHistory(callback); 1213 mContentsClient.getVisitedHistory(callback);
1206 } 1214 }
1207 1215
1208 /** 1216 /**
1209 * WebView.loadUrl. 1217 * WebView.loadUrl.
1210 */ 1218 */
1211 public void loadUrl(String url, Map<String, String> additionalHttpHeaders) { 1219 public void loadUrl(String url, Map<String, String> additionalHttpHeaders) {
1220 if (TRACE) Log.d(TAG, "loadUrl(extra headers)=" + url);
1212 // TODO: We may actually want to do some sanity checks here (like filter about://chrome). 1221 // TODO: We may actually want to do some sanity checks here (like filter about://chrome).
1213 1222
1214 // For backwards compatibility, apps targeting less than K will have JS URLs evaluated 1223 // For backwards compatibility, apps targeting less than K will have JS URLs evaluated
1215 // directly and any result of the evaluation will not replace the curren t page content. 1224 // directly and any result of the evaluation will not replace the curren t page content.
1216 // Matching Chrome behavior more closely; apps targetting >= K that load a JS URL will 1225 // Matching Chrome behavior more closely; apps targetting >= K that load a JS URL will
1217 // have the result of that URL replace the content of the current page. 1226 // have the result of that URL replace the content of the current page.
1218 final String javaScriptScheme = "javascript:"; 1227 final String javaScriptScheme = "javascript:";
1219 if (mAppTargetSdkVersion < Build.VERSION_CODES.KITKAT && url != null 1228 if (mAppTargetSdkVersion < Build.VERSION_CODES.KITKAT && url != null
1220 && url.startsWith(javaScriptScheme)) { 1229 && url.startsWith(javaScriptScheme)) {
1221 evaluateJavaScript(url.substring(javaScriptScheme.length()), null); 1230 evaluateJavaScript(url.substring(javaScriptScheme.length()), null);
1222 return; 1231 return;
1223 } 1232 }
1224 1233
1225 LoadUrlParams params = new LoadUrlParams(url); 1234 LoadUrlParams params = new LoadUrlParams(url);
1226 if (additionalHttpHeaders != null) params.setExtraHeaders(additionalHttp Headers); 1235 if (additionalHttpHeaders != null) params.setExtraHeaders(additionalHttp Headers);
1227 loadUrl(params); 1236 loadUrl(params);
1228 } 1237 }
1229 1238
1230 /** 1239 /**
1231 * WebView.loadUrl. 1240 * WebView.loadUrl.
1232 */ 1241 */
1233 public void loadUrl(String url) { 1242 public void loadUrl(String url) {
1243 if (TRACE) Log.d(TAG, "loadUrl=" + url);
1234 // Early out to match old WebView implementation 1244 // Early out to match old WebView implementation
1235 if (url == null) { 1245 if (url == null) {
1236 return; 1246 return;
1237 } 1247 }
1238 loadUrl(url, null); 1248 LoadUrlParams params = new LoadUrlParams(url);
1249 loadUrl(params);
1239 } 1250 }
1240 1251
1241 /** 1252 /**
1242 * WebView.postUrl. 1253 * WebView.postUrl.
1243 */ 1254 */
1244 public void postUrl(String url, byte[] postData) { 1255 public void postUrl(String url, byte[] postData) {
1256 if (TRACE) Log.d(TAG, "postUrl=" + url);
1245 LoadUrlParams params = LoadUrlParams.createLoadHttpPostParams(url, postD ata); 1257 LoadUrlParams params = LoadUrlParams.createLoadHttpPostParams(url, postD ata);
1246 Map<String, String> headers = new HashMap<String, String>(); 1258 Map<String, String> headers = new HashMap<String, String>();
1247 headers.put("Content-Type", "application/x-www-form-urlencoded"); 1259 headers.put("Content-Type", "application/x-www-form-urlencoded");
1248 params.setExtraHeaders(headers); 1260 params.setExtraHeaders(headers);
1249 loadUrl(params); 1261 loadUrl(params);
1250 } 1262 }
1251 1263
1252 private static String fixupMimeType(String mimeType) { 1264 private static String fixupMimeType(String mimeType) {
1253 return TextUtils.isEmpty(mimeType) ? "text/html" : mimeType; 1265 return TextUtils.isEmpty(mimeType) ? "text/html" : mimeType;
1254 } 1266 }
(...skipping 11 matching lines...) Expand all
1266 } 1278 }
1267 1279
1268 private static boolean isBase64Encoded(String encoding) { 1280 private static boolean isBase64Encoded(String encoding) {
1269 return "base64".equals(encoding); 1281 return "base64".equals(encoding);
1270 } 1282 }
1271 1283
1272 /** 1284 /**
1273 * WebView.loadData. 1285 * WebView.loadData.
1274 */ 1286 */
1275 public void loadData(String data, String mimeType, String encoding) { 1287 public void loadData(String data, String mimeType, String encoding) {
1288 if (TRACE) Log.d(TAG, "loadData");
1276 loadUrl(LoadUrlParams.createLoadDataParams( 1289 loadUrl(LoadUrlParams.createLoadDataParams(
1277 fixupData(data), fixupMimeType(mimeType), isBase64Encoded(encodi ng))); 1290 fixupData(data), fixupMimeType(mimeType), isBase64Encoded(encodi ng)));
1278 } 1291 }
1279 1292
1280 /** 1293 /**
1281 * WebView.loadDataWithBaseURL. 1294 * WebView.loadDataWithBaseURL.
1282 */ 1295 */
1283 public void loadDataWithBaseURL( 1296 public void loadDataWithBaseURL(
1284 String baseUrl, String data, String mimeType, String encoding, Strin g historyUrl) { 1297 String baseUrl, String data, String mimeType, String encoding, Strin g historyUrl) {
1298 if (TRACE) Log.d(TAG, "loadDataWithBaseURL=" + baseUrl);
1285 data = fixupData(data); 1299 data = fixupData(data);
1286 mimeType = fixupMimeType(mimeType); 1300 mimeType = fixupMimeType(mimeType);
1287 LoadUrlParams loadUrlParams; 1301 LoadUrlParams loadUrlParams;
1288 baseUrl = fixupBase(baseUrl); 1302 baseUrl = fixupBase(baseUrl);
1289 historyUrl = fixupHistory(historyUrl); 1303 historyUrl = fixupHistory(historyUrl);
1290 1304
1291 if (baseUrl.startsWith("data:")) { 1305 if (baseUrl.startsWith("data:")) {
1292 // For backwards compatibility with WebViewClassic, we use the value of |encoding| 1306 // For backwards compatibility with WebViewClassic, we use the value of |encoding|
1293 // as the charset, as long as it's not "base64". 1307 // as the charset, as long as it's not "base64".
1294 boolean isBase64 = isBase64Encoded(encoding); 1308 boolean isBase64 = isBase64Encoded(encoding);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 mOverlayHorizontalScrollbar = mOverlayVerticalScrollbar = true; 1480 mOverlayHorizontalScrollbar = mOverlayVerticalScrollbar = true;
1467 } else { 1481 } else {
1468 mOverlayHorizontalScrollbar = mOverlayVerticalScrollbar = false; 1482 mOverlayHorizontalScrollbar = mOverlayVerticalScrollbar = false;
1469 } 1483 }
1470 } 1484 }
1471 1485
1472 /** 1486 /**
1473 * @see View#setHorizontalScrollbarOverlay(boolean) 1487 * @see View#setHorizontalScrollbarOverlay(boolean)
1474 */ 1488 */
1475 public void setHorizontalScrollbarOverlay(boolean overlay) { 1489 public void setHorizontalScrollbarOverlay(boolean overlay) {
1490 if (TRACE) Log.d(TAG, "setHorizontalScrollbarOverlay=" + overlay);
1476 mOverlayHorizontalScrollbar = overlay; 1491 mOverlayHorizontalScrollbar = overlay;
1477 } 1492 }
1478 1493
1479 /** 1494 /**
1480 * @see View#setVerticalScrollbarOverlay(boolean) 1495 * @see View#setVerticalScrollbarOverlay(boolean)
1481 */ 1496 */
1482 public void setVerticalScrollbarOverlay(boolean overlay) { 1497 public void setVerticalScrollbarOverlay(boolean overlay) {
1498 if (TRACE) Log.d(TAG, "setVerticalScrollbarOverlay=" + overlay);
1483 mOverlayVerticalScrollbar = overlay; 1499 mOverlayVerticalScrollbar = overlay;
1484 } 1500 }
1485 1501
1486 /** 1502 /**
1487 * @see View#overlayHorizontalScrollbar() 1503 * @see View#overlayHorizontalScrollbar()
1488 */ 1504 */
1489 public boolean overlayHorizontalScrollbar() { 1505 public boolean overlayHorizontalScrollbar() {
1490 return mOverlayHorizontalScrollbar; 1506 return mOverlayHorizontalScrollbar;
1491 } 1507 }
1492 1508
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 * @see View.computeScroll() 1578 * @see View.computeScroll()
1563 */ 1579 */
1564 public void computeScroll() { 1580 public void computeScroll() {
1565 mAwViewMethods.computeScroll(); 1581 mAwViewMethods.computeScroll();
1566 } 1582 }
1567 1583
1568 /** 1584 /**
1569 * @see android.webkit.WebView#stopLoading() 1585 * @see android.webkit.WebView#stopLoading()
1570 */ 1586 */
1571 public void stopLoading() { 1587 public void stopLoading() {
1588 if (TRACE) Log.d(TAG, "stopLoading");
1572 if (!isDestroyed()) mWebContents.stop(); 1589 if (!isDestroyed()) mWebContents.stop();
1573 } 1590 }
1574 1591
1575 /** 1592 /**
1576 * @see android.webkit.WebView#reload() 1593 * @see android.webkit.WebView#reload()
1577 */ 1594 */
1578 public void reload() { 1595 public void reload() {
1596 if (TRACE) Log.d(TAG, "reload");
1579 if (!isDestroyed()) mNavigationController.reload(true); 1597 if (!isDestroyed()) mNavigationController.reload(true);
1580 } 1598 }
1581 1599
1582 /** 1600 /**
1583 * @see android.webkit.WebView#canGoBack() 1601 * @see android.webkit.WebView#canGoBack()
1584 */ 1602 */
1585 public boolean canGoBack() { 1603 public boolean canGoBack() {
1586 return isDestroyed() ? false : mNavigationController.canGoBack(); 1604 return isDestroyed() ? false : mNavigationController.canGoBack();
1587 } 1605 }
1588 1606
1589 /** 1607 /**
1590 * @see android.webkit.WebView#goBack() 1608 * @see android.webkit.WebView#goBack()
1591 */ 1609 */
1592 public void goBack() { 1610 public void goBack() {
1611 if (TRACE) Log.d(TAG, "goBack");
1593 if (!isDestroyed()) mNavigationController.goBack(); 1612 if (!isDestroyed()) mNavigationController.goBack();
1594 } 1613 }
1595 1614
1596 /** 1615 /**
1597 * @see android.webkit.WebView#canGoForward() 1616 * @see android.webkit.WebView#canGoForward()
1598 */ 1617 */
1599 public boolean canGoForward() { 1618 public boolean canGoForward() {
1600 return isDestroyed() ? false : mNavigationController.canGoForward(); 1619 return isDestroyed() ? false : mNavigationController.canGoForward();
1601 } 1620 }
1602 1621
1603 /** 1622 /**
1604 * @see android.webkit.WebView#goForward() 1623 * @see android.webkit.WebView#goForward()
1605 */ 1624 */
1606 public void goForward() { 1625 public void goForward() {
1626 if (TRACE) Log.d(TAG, "goForward");
1607 if (!isDestroyed()) mNavigationController.goForward(); 1627 if (!isDestroyed()) mNavigationController.goForward();
1608 } 1628 }
1609 1629
1610 /** 1630 /**
1611 * @see android.webkit.WebView#canGoBackOrForward(int) 1631 * @see android.webkit.WebView#canGoBackOrForward(int)
1612 */ 1632 */
1613 public boolean canGoBackOrForward(int steps) { 1633 public boolean canGoBackOrForward(int steps) {
1614 return isDestroyed() ? false : mNavigationController.canGoToOffset(steps ); 1634 return isDestroyed() ? false : mNavigationController.canGoToOffset(steps );
1615 } 1635 }
1616 1636
1617 /** 1637 /**
1618 * @see android.webkit.WebView#goBackOrForward(int) 1638 * @see android.webkit.WebView#goBackOrForward(int)
1619 */ 1639 */
1620 public void goBackOrForward(int steps) { 1640 public void goBackOrForward(int steps) {
1641 if (TRACE) Log.d(TAG, "goBackOrForwad=" + steps);
1621 if (!isDestroyed()) mNavigationController.goToOffset(steps); 1642 if (!isDestroyed()) mNavigationController.goToOffset(steps);
1622 } 1643 }
1623 1644
1624 /** 1645 /**
1625 * @see android.webkit.WebView#pauseTimers() 1646 * @see android.webkit.WebView#pauseTimers()
1626 */ 1647 */
1627 public void pauseTimers() { 1648 public void pauseTimers() {
1649 if (TRACE) Log.d(TAG, "pauseTimers");
1628 if (!isDestroyed()) ContentViewStatics.setWebKitSharedTimersSuspended(tr ue); 1650 if (!isDestroyed()) ContentViewStatics.setWebKitSharedTimersSuspended(tr ue);
1629 } 1651 }
1630 1652
1631 /** 1653 /**
1632 * @see android.webkit.WebView#resumeTimers() 1654 * @see android.webkit.WebView#resumeTimers()
1633 */ 1655 */
1634 public void resumeTimers() { 1656 public void resumeTimers() {
1657 if (TRACE) Log.d(TAG, "resumeTimers");
1635 if (!isDestroyed()) ContentViewStatics.setWebKitSharedTimersSuspended(fa lse); 1658 if (!isDestroyed()) ContentViewStatics.setWebKitSharedTimersSuspended(fa lse);
1636 } 1659 }
1637 1660
1638 /** 1661 /**
1639 * @see android.webkit.WebView#onPause() 1662 * @see android.webkit.WebView#onPause()
1640 */ 1663 */
1641 public void onPause() { 1664 public void onPause() {
1665 if (TRACE) Log.d(TAG, "onPause");
1642 if (mIsPaused || isDestroyed()) return; 1666 if (mIsPaused || isDestroyed()) return;
1643 mIsPaused = true; 1667 mIsPaused = true;
1644 nativeSetIsPaused(mNativeAwContents, mIsPaused); 1668 nativeSetIsPaused(mNativeAwContents, mIsPaused);
1645 mContentViewCore.onHide(); 1669 mContentViewCore.onHide();
1646 } 1670 }
1647 1671
1648 /** 1672 /**
1649 * @see android.webkit.WebView#onResume() 1673 * @see android.webkit.WebView#onResume()
1650 */ 1674 */
1651 public void onResume() { 1675 public void onResume() {
1676 if (TRACE) Log.d(TAG, "onResume");
1652 if (!mIsPaused || isDestroyed()) return; 1677 if (!mIsPaused || isDestroyed()) return;
1653 mIsPaused = false; 1678 mIsPaused = false;
1654 nativeSetIsPaused(mNativeAwContents, mIsPaused); 1679 nativeSetIsPaused(mNativeAwContents, mIsPaused);
1655 mContentViewCore.onShow(); 1680 mContentViewCore.onShow();
1656 } 1681 }
1657 1682
1658 /** 1683 /**
1659 * @see android.webkit.WebView#isPaused() 1684 * @see android.webkit.WebView#isPaused()
1660 */ 1685 */
1661 public boolean isPaused() { 1686 public boolean isPaused() {
(...skipping 21 matching lines...) Expand all
1683 return mAwViewMethods.dispatchKeyEvent(event); 1708 return mAwViewMethods.dispatchKeyEvent(event);
1684 } 1709 }
1685 1710
1686 /** 1711 /**
1687 * Clears the resource cache. Note that the cache is per-application, so thi s will clear the 1712 * Clears the resource cache. Note that the cache is per-application, so thi s will clear the
1688 * cache for all WebViews used. 1713 * cache for all WebViews used.
1689 * 1714 *
1690 * @param includeDiskFiles if false, only the RAM cache is cleared 1715 * @param includeDiskFiles if false, only the RAM cache is cleared
1691 */ 1716 */
1692 public void clearCache(boolean includeDiskFiles) { 1717 public void clearCache(boolean includeDiskFiles) {
1718 if (TRACE) Log.d(TAG, "clearCache");
1693 if (!isDestroyed()) nativeClearCache(mNativeAwContents, includeDiskFiles ); 1719 if (!isDestroyed()) nativeClearCache(mNativeAwContents, includeDiskFiles );
1694 } 1720 }
1695 1721
1696 public void documentHasImages(Message message) { 1722 public void documentHasImages(Message message) {
1697 if (!isDestroyed()) nativeDocumentHasImages(mNativeAwContents, message); 1723 if (!isDestroyed()) nativeDocumentHasImages(mNativeAwContents, message);
1698 } 1724 }
1699 1725
1700 public void saveWebArchive( 1726 public void saveWebArchive(
1701 final String basename, boolean autoname, final ValueCallback<String> callback) { 1727 final String basename, boolean autoname, final ValueCallback<String> callback) {
1728 if (TRACE) Log.d(TAG, "saveWebArchive=" + basename);
1702 if (!autoname) { 1729 if (!autoname) {
1703 saveWebArchiveInternal(basename, callback); 1730 saveWebArchiveInternal(basename, callback);
1704 return; 1731 return;
1705 } 1732 }
1706 // If auto-generating the file name, handle the name generation on a bac kground thread 1733 // If auto-generating the file name, handle the name generation on a bac kground thread
1707 // as it will require I/O access for checking whether previous files exi sted. 1734 // as it will require I/O access for checking whether previous files exi sted.
1708 new AsyncTask<Void, Void, String>() { 1735 new AsyncTask<Void, Void, String>() {
1709 @Override 1736 @Override
1710 protected String doInBackground(Void... params) { 1737 protected String doInBackground(Void... params) {
1711 return generateArchiveAutoNamePath(getOriginalUrl(), basename); 1738 return generateArchiveAutoNamePath(getOriginalUrl(), basename);
(...skipping 27 matching lines...) Expand all
1739 * @see android.webkit.WebView#getTitle() 1766 * @see android.webkit.WebView#getTitle()
1740 */ 1767 */
1741 public String getTitle() { 1768 public String getTitle() {
1742 return isDestroyed() ? null : mWebContents.getTitle(); 1769 return isDestroyed() ? null : mWebContents.getTitle();
1743 } 1770 }
1744 1771
1745 /** 1772 /**
1746 * @see android.webkit.WebView#clearHistory() 1773 * @see android.webkit.WebView#clearHistory()
1747 */ 1774 */
1748 public void clearHistory() { 1775 public void clearHistory() {
1776 if (TRACE) Log.d(TAG, "clearHistory");
1749 if (!isDestroyed()) mNavigationController.clearHistory(); 1777 if (!isDestroyed()) mNavigationController.clearHistory();
1750 } 1778 }
1751 1779
1752 public String[] getHttpAuthUsernamePassword(String host, String realm) { 1780 public String[] getHttpAuthUsernamePassword(String host, String realm) {
1753 return mBrowserContext.getHttpAuthDatabase(mContext) 1781 return mBrowserContext.getHttpAuthDatabase(mContext)
1754 .getHttpAuthUsernamePassword(host, realm); 1782 .getHttpAuthUsernamePassword(host, realm);
1755 } 1783 }
1756 1784
1757 public void setHttpAuthUsernamePassword(String host, String realm, String us ername, 1785 public void setHttpAuthUsernamePassword(String host, String realm, String us ername,
1758 String password) { 1786 String password) {
1787 if (TRACE) Log.d(TAG, "setHttpAuthUsernamePassword=" + host);
1759 mBrowserContext.getHttpAuthDatabase(mContext) 1788 mBrowserContext.getHttpAuthDatabase(mContext)
1760 .setHttpAuthUsernamePassword(host, realm, username, password); 1789 .setHttpAuthUsernamePassword(host, realm, username, password);
1761 } 1790 }
1762 1791
1763 /** 1792 /**
1764 * @see android.webkit.WebView#getCertificate() 1793 * @see android.webkit.WebView#getCertificate()
1765 */ 1794 */
1766 public SslCertificate getCertificate() { 1795 public SslCertificate getCertificate() {
1767 return isDestroyed() ? null 1796 return isDestroyed() ? null
1768 : SslUtil.getCertificateFromDerBytes(nativeGetCertificate(mNativ eAwContents)); 1797 : SslUtil.getCertificateFromDerBytes(nativeGetCertificate(mNativ eAwContents));
1769 } 1798 }
1770 1799
1771 /** 1800 /**
1772 * @see android.webkit.WebView#clearSslPreferences() 1801 * @see android.webkit.WebView#clearSslPreferences()
1773 */ 1802 */
1774 public void clearSslPreferences() { 1803 public void clearSslPreferences() {
1804 if (TRACE) Log.d(TAG, "clearSslPreferences");
1775 if (!isDestroyed()) mNavigationController.clearSslPreferences(); 1805 if (!isDestroyed()) mNavigationController.clearSslPreferences();
1776 } 1806 }
1777 1807
1778 /** 1808 /**
1779 * Method to return all hit test values relevant to public WebView API. 1809 * Method to return all hit test values relevant to public WebView API.
1780 * Note that this expose more data than needed for WebView.getHitTestResult. 1810 * Note that this expose more data than needed for WebView.getHitTestResult.
1781 * Unsafely returning reference to mutable internal object to avoid excessiv e 1811 * Unsafely returning reference to mutable internal object to avoid excessiv e
1782 * garbage allocation on repeated calls. 1812 * garbage allocation on repeated calls.
1783 */ 1813 */
1784 public HitTestData getLastHitTestResult() { 1814 public HitTestData getLastHitTestResult() {
1815 if (TRACE) Log.d(TAG, "getLastHitTestResult");
1785 if (isDestroyed()) return null; 1816 if (isDestroyed()) return null;
1786 nativeUpdateLastHitTestData(mNativeAwContents); 1817 nativeUpdateLastHitTestData(mNativeAwContents);
1787 return mPossiblyStaleHitTestData; 1818 return mPossiblyStaleHitTestData;
1788 } 1819 }
1789 1820
1790 /** 1821 /**
1791 * @see android.webkit.WebView#requestFocusNodeHref() 1822 * @see android.webkit.WebView#requestFocusNodeHref()
1792 */ 1823 */
1793 public void requestFocusNodeHref(Message msg) { 1824 public void requestFocusNodeHref(Message msg) {
1825 if (TRACE) Log.d(TAG, "requestFocusNodeHref");
1794 if (msg == null || isDestroyed()) return; 1826 if (msg == null || isDestroyed()) return;
1795 1827
1796 nativeUpdateLastHitTestData(mNativeAwContents); 1828 nativeUpdateLastHitTestData(mNativeAwContents);
1797 Bundle data = msg.getData(); 1829 Bundle data = msg.getData();
1798 1830
1799 // In order to maintain compatibility with the old WebView's implementat ion, 1831 // In order to maintain compatibility with the old WebView's implementat ion,
1800 // the absolute (full) url is passed in the |url| field, not only the hr ef attribute. 1832 // the absolute (full) url is passed in the |url| field, not only the hr ef attribute.
1801 // Note: HitTestData could be cleaned up at this point. See http://crbug .com/290992. 1833 // Note: HitTestData could be cleaned up at this point. See http://crbug .com/290992.
1802 data.putString("url", mPossiblyStaleHitTestData.href); 1834 data.putString("url", mPossiblyStaleHitTestData.href);
1803 data.putString("title", mPossiblyStaleHitTestData.anchorText); 1835 data.putString("title", mPossiblyStaleHitTestData.anchorText);
1804 data.putString("src", mPossiblyStaleHitTestData.imgSrc); 1836 data.putString("src", mPossiblyStaleHitTestData.imgSrc);
1805 msg.setData(data); 1837 msg.setData(data);
1806 msg.sendToTarget(); 1838 msg.sendToTarget();
1807 } 1839 }
1808 1840
1809 /** 1841 /**
1810 * @see android.webkit.WebView#requestImageRef() 1842 * @see android.webkit.WebView#requestImageRef()
1811 */ 1843 */
1812 public void requestImageRef(Message msg) { 1844 public void requestImageRef(Message msg) {
1845 if (TRACE) Log.d(TAG, "requestImageRef");
1813 if (msg == null || isDestroyed()) return; 1846 if (msg == null || isDestroyed()) return;
1814 1847
1815 nativeUpdateLastHitTestData(mNativeAwContents); 1848 nativeUpdateLastHitTestData(mNativeAwContents);
1816 Bundle data = msg.getData(); 1849 Bundle data = msg.getData();
1817 data.putString("url", mPossiblyStaleHitTestData.imgSrc); 1850 data.putString("url", mPossiblyStaleHitTestData.imgSrc);
1818 msg.setData(data); 1851 msg.setData(data);
1819 msg.sendToTarget(); 1852 msg.sendToTarget();
1820 } 1853 }
1821 1854
1822 @VisibleForTesting 1855 @VisibleForTesting
1823 public float getPageScaleFactor() { 1856 public float getPageScaleFactor() {
1824 return mPageScaleFactor; 1857 return mPageScaleFactor;
1825 } 1858 }
1826 1859
1827 /** 1860 /**
1828 * @see android.webkit.WebView#getScale() 1861 * @see android.webkit.WebView#getScale()
1829 * 1862 *
1830 * Please note that the scale returned is the page scale multiplied by 1863 * Please note that the scale returned is the page scale multiplied by
1831 * the screen density factor. See CTS WebViewTest.testSetInitialScale. 1864 * the screen density factor. See CTS WebViewTest.testSetInitialScale.
1832 */ 1865 */
1833 public float getScale() { 1866 public float getScale() {
1834 return (float) (mPageScaleFactor * mDIPScale); 1867 return (float) (mPageScaleFactor * mDIPScale);
1835 } 1868 }
1836 1869
1837 /** 1870 /**
1838 * @see android.webkit.WebView#flingScroll(int, int) 1871 * @see android.webkit.WebView#flingScroll(int, int)
1839 */ 1872 */
1840 public void flingScroll(int velocityX, int velocityY) { 1873 public void flingScroll(int velocityX, int velocityY) {
1874 if (TRACE) Log.d(TAG, "flingScroll");
1841 mScrollOffsetManager.flingScroll(velocityX, velocityY); 1875 mScrollOffsetManager.flingScroll(velocityX, velocityY);
1842 } 1876 }
1843 1877
1844 /** 1878 /**
1845 * @see android.webkit.WebView#pageUp(boolean) 1879 * @see android.webkit.WebView#pageUp(boolean)
1846 */ 1880 */
1847 public boolean pageUp(boolean top) { 1881 public boolean pageUp(boolean top) {
1882 if (TRACE) Log.d(TAG, "pageUp");
1848 return mScrollOffsetManager.pageUp(top); 1883 return mScrollOffsetManager.pageUp(top);
1849 } 1884 }
1850 1885
1851 /** 1886 /**
1852 * @see android.webkit.WebView#pageDown(boolean) 1887 * @see android.webkit.WebView#pageDown(boolean)
1853 */ 1888 */
1854 public boolean pageDown(boolean bottom) { 1889 public boolean pageDown(boolean bottom) {
1890 if (TRACE) Log.d(TAG, "pageDown");
1855 return mScrollOffsetManager.pageDown(bottom); 1891 return mScrollOffsetManager.pageDown(bottom);
1856 } 1892 }
1857 1893
1858 /** 1894 /**
1859 * @see android.webkit.WebView#canZoomIn() 1895 * @see android.webkit.WebView#canZoomIn()
1860 */ 1896 */
1861 // This method uses the term 'zoom' for legacy reasons, but relates 1897 // This method uses the term 'zoom' for legacy reasons, but relates
1862 // to what chrome calls the 'page scale factor'. 1898 // to what chrome calls the 'page scale factor'.
1863 public boolean canZoomIn() { 1899 public boolean canZoomIn() {
1864 final float zoomInExtent = mMaxPageScaleFactor - mPageScaleFactor; 1900 final float zoomInExtent = mMaxPageScaleFactor - mPageScaleFactor;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 if (delta < 0.01f || delta > 100.0f) { 1947 if (delta < 0.01f || delta > 100.0f) {
1912 throw new IllegalStateException("zoom delta value outside [0.01, 100 ] range."); 1948 throw new IllegalStateException("zoom delta value outside [0.01, 100 ] range.");
1913 } 1949 }
1914 mContentViewCore.pinchByDelta(delta); 1950 mContentViewCore.pinchByDelta(delta);
1915 } 1951 }
1916 1952
1917 /** 1953 /**
1918 * @see android.webkit.WebView#invokeZoomPicker() 1954 * @see android.webkit.WebView#invokeZoomPicker()
1919 */ 1955 */
1920 public void invokeZoomPicker() { 1956 public void invokeZoomPicker() {
1957 if (TRACE) Log.d(TAG, "invokeZoomPicker");
1921 if (!isDestroyed()) mContentViewCore.invokeZoomPicker(); 1958 if (!isDestroyed()) mContentViewCore.invokeZoomPicker();
1922 } 1959 }
1923 1960
1924 /** 1961 /**
1925 * @see android.webkit.WebView#preauthorizePermission(Uri, long) 1962 * @see android.webkit.WebView#preauthorizePermission(Uri, long)
1926 */ 1963 */
1927 public void preauthorizePermission(Uri origin, long resources) { 1964 public void preauthorizePermission(Uri origin, long resources) {
1928 if (isDestroyed()) return; 1965 if (isDestroyed()) return;
1929 nativePreauthorizePermission(mNativeAwContents, origin.toString(), resou rces); 1966 nativePreauthorizePermission(mNativeAwContents, origin.toString(), resou rces);
1930 } 1967 }
1931 1968
1932 /** 1969 /**
1933 * @see ContentViewCore.evaluateJavaScript(String, JavaScriptCallback) 1970 * @see ContentViewCore.evaluateJavaScript(String, JavaScriptCallback)
1934 */ 1971 */
1935 public void evaluateJavaScript(String script, final ValueCallback<String> ca llback) { 1972 public void evaluateJavaScript(String script, final ValueCallback<String> ca llback) {
1973 if (TRACE) Log.d(TAG, "evaluateJavascript=" + script);
1936 if (isDestroyed()) return; 1974 if (isDestroyed()) return;
1937 JavaScriptCallback jsCallback = null; 1975 JavaScriptCallback jsCallback = null;
1938 if (callback != null) { 1976 if (callback != null) {
1939 jsCallback = new JavaScriptCallback() { 1977 jsCallback = new JavaScriptCallback() {
1940 @Override 1978 @Override
1941 public void handleJavaScriptResult(String jsonResult) { 1979 public void handleJavaScriptResult(String jsonResult) {
1942 callback.onReceiveValue(jsonResult); 1980 callback.onReceiveValue(jsonResult);
1943 } 1981 }
1944 }; 1982 };
1945 } 1983 }
(...skipping 30 matching lines...) Expand all
1976 } 2014 }
1977 2015
1978 // Implements PostMessageSender.PostMessageSenderDelegate interface method. 2016 // Implements PostMessageSender.PostMessageSenderDelegate interface method.
1979 @Override 2017 @Override
1980 public void onPostMessageQueueEmpty() { } 2018 public void onPostMessageQueueEmpty() { }
1981 2019
1982 // Implements PostMessageSender.PostMessageSenderDelegate interface method. 2020 // Implements PostMessageSender.PostMessageSenderDelegate interface method.
1983 @Override 2021 @Override
1984 public void postMessageToWeb(String frameName, String message, String target Origin, 2022 public void postMessageToWeb(String frameName, String message, String target Origin,
1985 int[] sentPortIds) { 2023 int[] sentPortIds) {
2024 if (TRACE) Log.d(TAG, "postMessageToWeb. TargetOrigin=" + targetOrigin);
1986 if (isDestroyed()) return; 2025 if (isDestroyed()) return;
1987 nativePostMessageToFrame(mNativeAwContents, frameName, message, targetOr igin, 2026 nativePostMessageToFrame(mNativeAwContents, frameName, message, targetOr igin,
1988 sentPortIds); 2027 sentPortIds);
1989 } 2028 }
1990 2029
1991 /** 2030 /**
1992 * Creates a message channel and returns the ports for each end of the chann el. 2031 * Creates a message channel and returns the ports for each end of the chann el.
1993 */ 2032 */
1994 public MessagePort[] createMessageChannel() { 2033 public MessagePort[] createMessageChannel() {
2034 if (TRACE) Log.d(TAG, "createMessageChannel");
1995 if (isDestroyed()) return null; 2035 if (isDestroyed()) return null;
1996 MessagePort[] ports = mBrowserContext.getMessagePortService().createMess ageChannel(); 2036 MessagePort[] ports = mBrowserContext.getMessagePortService().createMess ageChannel();
1997 nativeCreateMessageChannel(mNativeAwContents, ports); 2037 nativeCreateMessageChannel(mNativeAwContents, ports);
1998 return ports; 2038 return ports;
1999 } 2039 }
2000 2040
2001 public boolean hasAccessedInitialDocument() { 2041 public boolean hasAccessedInitialDocument() {
2002 if (isDestroyed()) return false; 2042 if (isDestroyed()) return false;
2003 return mWebContents.hasAccessedInitialDocument(); 2043 return mWebContents.hasAccessedInitialDocument();
2004 } 2044 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2115 /** 2155 /**
2116 * Key for opaque state in bundle. Note this is only public for tests. 2156 * Key for opaque state in bundle. Note this is only public for tests.
2117 */ 2157 */
2118 public static final String SAVE_RESTORE_STATE_KEY = "WEBVIEW_CHROMIUM_STATE" ; 2158 public static final String SAVE_RESTORE_STATE_KEY = "WEBVIEW_CHROMIUM_STATE" ;
2119 2159
2120 /** 2160 /**
2121 * Save the state of this AwContents into provided Bundle. 2161 * Save the state of this AwContents into provided Bundle.
2122 * @return False if saving state failed. 2162 * @return False if saving state failed.
2123 */ 2163 */
2124 public boolean saveState(Bundle outState) { 2164 public boolean saveState(Bundle outState) {
2165 if (TRACE) Log.d(TAG, "saveState");
2125 if (isDestroyed() || outState == null) return false; 2166 if (isDestroyed() || outState == null) return false;
2126 2167
2127 byte[] state = nativeGetOpaqueState(mNativeAwContents); 2168 byte[] state = nativeGetOpaqueState(mNativeAwContents);
2128 if (state == null) return false; 2169 if (state == null) return false;
2129 2170
2130 outState.putByteArray(SAVE_RESTORE_STATE_KEY, state); 2171 outState.putByteArray(SAVE_RESTORE_STATE_KEY, state);
2131 return true; 2172 return true;
2132 } 2173 }
2133 2174
2134 /** 2175 /**
2135 * Restore the state of this AwContents into provided Bundle. 2176 * Restore the state of this AwContents into provided Bundle.
2136 * @param inState Must be a bundle returned by saveState. 2177 * @param inState Must be a bundle returned by saveState.
2137 * @return False if restoring state failed. 2178 * @return False if restoring state failed.
2138 */ 2179 */
2139 public boolean restoreState(Bundle inState) { 2180 public boolean restoreState(Bundle inState) {
2181 if (TRACE) Log.d(TAG, "restoreState");
2140 if (isDestroyed() || inState == null) return false; 2182 if (isDestroyed() || inState == null) return false;
2141 2183
2142 byte[] state = inState.getByteArray(SAVE_RESTORE_STATE_KEY); 2184 byte[] state = inState.getByteArray(SAVE_RESTORE_STATE_KEY);
2143 if (state == null) return false; 2185 if (state == null) return false;
2144 2186
2145 boolean result = nativeRestoreFromOpaqueState(mNativeAwContents, state); 2187 boolean result = nativeRestoreFromOpaqueState(mNativeAwContents, state);
2146 2188
2147 // The onUpdateTitle callback normally happens when a page is loaded, 2189 // The onUpdateTitle callback normally happens when a page is loaded,
2148 // but is optimized out in the restoreState case because the title is 2190 // but is optimized out in the restoreState case because the title is
2149 // already restored. See WebContentsImpl::UpdateTitleForEntry. So we 2191 // already restored. See WebContentsImpl::UpdateTitleForEntry. So we
2150 // call the callback explicitly here. 2192 // call the callback explicitly here.
2151 if (result) mContentsClient.onReceivedTitle(mWebContents.getTitle()); 2193 if (result) mContentsClient.onReceivedTitle(mWebContents.getTitle());
2152 2194
2153 return result; 2195 return result;
2154 } 2196 }
2155 2197
2156 /** 2198 /**
2157 * @see ContentViewCore#addPossiblyUnsafeJavascriptInterface(Object, String, Class) 2199 * @see ContentViewCore#addPossiblyUnsafeJavascriptInterface(Object, String, Class)
2158 */ 2200 */
2159 @SuppressLint("NewApi") // JavascriptInterface requires API level 17. 2201 @SuppressLint("NewApi") // JavascriptInterface requires API level 17.
2160 public void addJavascriptInterface(Object object, String name) { 2202 public void addJavascriptInterface(Object object, String name) {
2203 if (TRACE) Log.d(TAG, "addJavascriptInterface=" + name);
2161 if (isDestroyed()) return; 2204 if (isDestroyed()) return;
2162 Class<? extends Annotation> requiredAnnotation = null; 2205 Class<? extends Annotation> requiredAnnotation = null;
2163 if (mAppTargetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR1) { 2206 if (mAppTargetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
2164 requiredAnnotation = JavascriptInterface.class; 2207 requiredAnnotation = JavascriptInterface.class;
2165 } 2208 }
2166 mContentViewCore.addPossiblyUnsafeJavascriptInterface(object, name, requ iredAnnotation); 2209 mContentViewCore.addPossiblyUnsafeJavascriptInterface(object, name, requ iredAnnotation);
2167 } 2210 }
2168 2211
2169 /** 2212 /**
2170 * @see android.webkit.WebView#removeJavascriptInterface(String) 2213 * @see android.webkit.WebView#removeJavascriptInterface(String)
2171 */ 2214 */
2172 public void removeJavascriptInterface(String interfaceName) { 2215 public void removeJavascriptInterface(String interfaceName) {
2216 if (TRACE) Log.d(TAG, "removeJavascriptInterface=" + interfaceName);
2173 if (!isDestroyed()) mContentViewCore.removeJavascriptInterface(interface Name); 2217 if (!isDestroyed()) mContentViewCore.removeJavascriptInterface(interface Name);
2174 } 2218 }
2175 2219
2176 /** 2220 /**
2177 * If native accessibility (not script injection) is enabled, and if this is 2221 * If native accessibility (not script injection) is enabled, and if this is
2178 * running on JellyBean or later, returns an AccessibilityNodeProvider that 2222 * running on JellyBean or later, returns an AccessibilityNodeProvider that
2179 * implements native accessibility for this view. Returns null otherwise. 2223 * implements native accessibility for this view. Returns null otherwise.
2180 * @return The AccessibilityNodeProvider, if available, or null otherwise. 2224 * @return The AccessibilityNodeProvider, if available, or null otherwise.
2181 */ 2225 */
2182 public AccessibilityNodeProvider getAccessibilityNodeProvider() { 2226 public AccessibilityNodeProvider getAccessibilityNodeProvider() {
(...skipping 23 matching lines...) Expand all
2206 */ 2250 */
2207 public boolean performAccessibilityAction(int action, Bundle arguments) { 2251 public boolean performAccessibilityAction(int action, Bundle arguments) {
2208 return isDestroyed() ? false 2252 return isDestroyed() ? false
2209 : mContentViewCore.performAccessibilityAction(action, arguments) ; 2253 : mContentViewCore.performAccessibilityAction(action, arguments) ;
2210 } 2254 }
2211 2255
2212 /** 2256 /**
2213 * @see android.webkit.WebView#clearFormData() 2257 * @see android.webkit.WebView#clearFormData()
2214 */ 2258 */
2215 public void hideAutofillPopup() { 2259 public void hideAutofillPopup() {
2260 if (TRACE) Log.d(TAG, "hideAutofillPopup");
2216 if (mAwAutofillClient != null) { 2261 if (mAwAutofillClient != null) {
2217 mAwAutofillClient.hideAutofillPopup(); 2262 mAwAutofillClient.hideAutofillPopup();
2218 } 2263 }
2219 } 2264 }
2220 2265
2221 public void setNetworkAvailable(boolean networkUp) { 2266 public void setNetworkAvailable(boolean networkUp) {
2267 if (TRACE) Log.d(TAG, "setNetworkAvailable=" + networkUp);
2222 if (!isDestroyed()) nativeSetJsOnlineProperty(mNativeAwContents, network Up); 2268 if (!isDestroyed()) nativeSetJsOnlineProperty(mNativeAwContents, network Up);
2223 } 2269 }
2224 2270
2225 /** 2271 /**
2226 * Inserts a {@link VisualStateCallback}. 2272 * Inserts a {@link VisualStateCallback}.
2227 * 2273 *
2228 * The {@link VisualStateCallback} will be inserted in Blink and will be inv oked when the 2274 * The {@link VisualStateCallback} will be inserted in Blink and will be inv oked when the
2229 * contents of the DOM tree at the moment that the callback was inserted (or later) are drawn 2275 * contents of the DOM tree at the moment that the callback was inserted (or later) are drawn
2230 * into the screen. In other words, the following events need to happen befo re the callback is 2276 * into the screen. In other words, the following events need to happen befo re the callback is
2231 * invoked: 2277 * invoked:
2232 * 1. The DOM tree is committed becoming the pending tree - see ThreadProxy: :BeginMainFrame 2278 * 1. The DOM tree is committed becoming the pending tree - see ThreadProxy: :BeginMainFrame
2233 * 2. The pending tree is activated becoming the active tree 2279 * 2. The pending tree is activated becoming the active tree
2234 * 3. A frame swap happens that draws the active tree into the screen 2280 * 3. A frame swap happens that draws the active tree into the screen
2235 * 2281 *
2236 * @param requestId an id that will be returned from the callback invocation to allow 2282 * @param requestId an id that will be returned from the callback invocation to allow
2237 * callers to match requests with callbacks. 2283 * callers to match requests with callbacks.
2238 * @param callback the callback to be inserted 2284 * @param callback the callback to be inserted
2239 * @throw IllegalStateException if this method is invoked after {@link #dest roy()} has been 2285 * @throw IllegalStateException if this method is invoked after {@link #dest roy()} has been
2240 * called. 2286 * called.
2241 */ 2287 */
2242 public void insertVisualStateCallback(long requestId, VisualStateCallback ca llback) { 2288 public void insertVisualStateCallback(long requestId, VisualStateCallback ca llback) {
2289 if (TRACE) Log.d(TAG, "insertVisualStateCallback");
2243 if (isDestroyed()) throw new IllegalStateException( 2290 if (isDestroyed()) throw new IllegalStateException(
2244 "insertVisualStateCallback cannot be called after the WebView ha s been destroyed"); 2291 "insertVisualStateCallback cannot be called after the WebView ha s been destroyed");
2245 nativeInsertVisualStateCallback(mNativeAwContents, requestId, callback); 2292 nativeInsertVisualStateCallback(mNativeAwContents, requestId, callback);
2246 } 2293 }
2247 2294
2248 public boolean getDidAttemptLoad() { 2295 public boolean getDidAttemptLoad() {
2249 if (mDidAttemptLoad) return mDidAttemptLoad; 2296 if (mDidAttemptLoad) return mDidAttemptLoad;
2250 mDidAttemptLoad = mWebContentsObserver.hasStartedAnyProvisionalLoad(); 2297 mDidAttemptLoad = mWebContentsObserver.hasStartedAnyProvisionalLoad();
2251 return mDidAttemptLoad; 2298 return mDidAttemptLoad;
2252 } 2299 }
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
2946 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo rter awPdfExporter); 2993 private native void nativeCreatePdfExporter(long nativeAwContents, AwPdfExpo rter awPdfExporter);
2947 2994
2948 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin, 2995 private native void nativePreauthorizePermission(long nativeAwContents, Stri ng origin,
2949 long resources); 2996 long resources);
2950 2997
2951 private native void nativePostMessageToFrame(long nativeAwContents, String f rameId, 2998 private native void nativePostMessageToFrame(long nativeAwContents, String f rameId,
2952 String message, String targetOrigin, int[] msgPorts); 2999 String message, String targetOrigin, int[] msgPorts);
2953 3000
2954 private native void nativeCreateMessageChannel(long nativeAwContents, Messag ePort[] ports); 3001 private native void nativeCreateMessageChannel(long nativeAwContents, Messag ePort[] ports);
2955 } 3002 }
OLDNEW
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwSettings.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698