Loading core/java/android/webkit/CallbackProxy.java +43 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,9 @@ class CallbackProxy extends Handler { private final WebBackForwardList mBackForwardList; // Used to call startActivity during url override. private final Context mContext; // Stores the URL being loaded and the viewing mode to switch into when // the URL finishes loading. private ChangeViewModeOnFinishedLoad mChange; // Message Ids private static final int PAGE_STARTED = 100; Loading Loading @@ -176,6 +179,37 @@ class CallbackProxy extends Handler { return mBackForwardList; } /** * Tell the host application that the WebView has changed viewing modes. * @param toZoomedOut If true, the WebView has zoomed out so that the page * fits the screen. If false, it is zoomed to the setting * specified by the user. */ /* package */ void uiOnChangeViewingMode(boolean toZoomOverview) { if (mWebChromeClient != null) { mWebChromeClient.onChangeViewingMode(toZoomOverview); } } private static class ChangeViewModeOnFinishedLoad { boolean mToZoomOverView; String mOriginalUrl; ChangeViewModeOnFinishedLoad(boolean toZoomOverview, String originalUrl) { mToZoomOverView = toZoomOverview; mOriginalUrl = originalUrl; } } /** * Keep track of the url and the viewing mode to change into. If/when that * url finishes loading, this will change the viewing mode. */ /* package */ void uiChangeViewingModeOnFinishedLoad( boolean toZoomOverview, String originalUrl) { if (mWebChromeClient == null) return; mChange = new ChangeViewModeOnFinishedLoad(toZoomOverview, originalUrl); } /** * Called by the UI side. Calling overrideUrlLoading from the WebCore * side will post a message to call this method. Loading Loading @@ -237,6 +271,15 @@ class CallbackProxy extends Handler { if (mWebViewClient != null) { mWebViewClient.onPageFinished(mWebView, (String) msg.obj); } if (mChange != null) { if (mWebView.getOriginalUrl().equals(mChange.mOriginalUrl)) { uiOnChangeViewingMode(mChange.mToZoomOverView); } else { // The user has gone to a different page, so there is // no need to hang on to the old object. mChange = null; } } break; case RECEIVED_ICON: Loading core/java/android/webkit/WebChromeClient.java +9 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,15 @@ import android.view.View; public class WebChromeClient { /** * Tell the host application that the WebView has changed viewing modes. * @param toZoomedOut If true, the WebView has zoomed out so that the page * fits the screen. If false, it is zoomed to the setting * specified by the user. * @hide */ public void onChangeViewingMode(boolean toZoomedOut) {} /** * Tell the host application the current progress of loading a page. * @param view The WebView that initiated the callback. Loading core/java/android/webkit/WebView.java +10 −0 Original line number Diff line number Diff line Loading @@ -521,6 +521,7 @@ public class WebView extends AbsoluteLayout // follow the links. Double tap will toggle between zoom overview mode and // the last zoom scale. boolean mInZoomOverview = false; // ideally mZoomOverviewWidth should be mContentWidth. But sites like espn, // engadget always have wider mContentWidth no matter what viewport size is. int mZoomOverviewWidth = WebViewCore.DEFAULT_VIEWPORT_WIDTH; Loading Loading @@ -4687,6 +4688,7 @@ public class WebView extends AbsoluteLayout mZoomCenterX = mLastTouchX; mZoomCenterY = mLastTouchY; mInZoomOverview = !mInZoomOverview; mCallbackProxy.uiOnChangeViewingMode(mInZoomOverview); if (mInZoomOverview) { if (getSettings().getBuiltInZoomControls()) { if (mZoomButtonsController.isVisible()) { Loading Loading @@ -5034,6 +5036,14 @@ public class WebView extends AbsoluteLayout mInZoomOverview = ENABLE_DOUBLETAP_ZOOM && settings.getLoadWithOverviewMode(); } mCallbackProxy.uiOnChangeViewingMode(true); if (!mInZoomOverview) { // We are going to start zoomed in. However, we // truly want to show the title bar, and then hide // it once the page has loaded mCallbackProxy.uiChangeViewingModeOnFinishedLoad( false, getOriginalUrl()); } setNewZoomScale(mLastScale, false); setContentScrollTo(restoreState.mScrollX, restoreState.mScrollY); Loading Loading
core/java/android/webkit/CallbackProxy.java +43 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,9 @@ class CallbackProxy extends Handler { private final WebBackForwardList mBackForwardList; // Used to call startActivity during url override. private final Context mContext; // Stores the URL being loaded and the viewing mode to switch into when // the URL finishes loading. private ChangeViewModeOnFinishedLoad mChange; // Message Ids private static final int PAGE_STARTED = 100; Loading Loading @@ -176,6 +179,37 @@ class CallbackProxy extends Handler { return mBackForwardList; } /** * Tell the host application that the WebView has changed viewing modes. * @param toZoomedOut If true, the WebView has zoomed out so that the page * fits the screen. If false, it is zoomed to the setting * specified by the user. */ /* package */ void uiOnChangeViewingMode(boolean toZoomOverview) { if (mWebChromeClient != null) { mWebChromeClient.onChangeViewingMode(toZoomOverview); } } private static class ChangeViewModeOnFinishedLoad { boolean mToZoomOverView; String mOriginalUrl; ChangeViewModeOnFinishedLoad(boolean toZoomOverview, String originalUrl) { mToZoomOverView = toZoomOverview; mOriginalUrl = originalUrl; } } /** * Keep track of the url and the viewing mode to change into. If/when that * url finishes loading, this will change the viewing mode. */ /* package */ void uiChangeViewingModeOnFinishedLoad( boolean toZoomOverview, String originalUrl) { if (mWebChromeClient == null) return; mChange = new ChangeViewModeOnFinishedLoad(toZoomOverview, originalUrl); } /** * Called by the UI side. Calling overrideUrlLoading from the WebCore * side will post a message to call this method. Loading Loading @@ -237,6 +271,15 @@ class CallbackProxy extends Handler { if (mWebViewClient != null) { mWebViewClient.onPageFinished(mWebView, (String) msg.obj); } if (mChange != null) { if (mWebView.getOriginalUrl().equals(mChange.mOriginalUrl)) { uiOnChangeViewingMode(mChange.mToZoomOverView); } else { // The user has gone to a different page, so there is // no need to hang on to the old object. mChange = null; } } break; case RECEIVED_ICON: Loading
core/java/android/webkit/WebChromeClient.java +9 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,15 @@ import android.view.View; public class WebChromeClient { /** * Tell the host application that the WebView has changed viewing modes. * @param toZoomedOut If true, the WebView has zoomed out so that the page * fits the screen. If false, it is zoomed to the setting * specified by the user. * @hide */ public void onChangeViewingMode(boolean toZoomedOut) {} /** * Tell the host application the current progress of loading a page. * @param view The WebView that initiated the callback. Loading
core/java/android/webkit/WebView.java +10 −0 Original line number Diff line number Diff line Loading @@ -521,6 +521,7 @@ public class WebView extends AbsoluteLayout // follow the links. Double tap will toggle between zoom overview mode and // the last zoom scale. boolean mInZoomOverview = false; // ideally mZoomOverviewWidth should be mContentWidth. But sites like espn, // engadget always have wider mContentWidth no matter what viewport size is. int mZoomOverviewWidth = WebViewCore.DEFAULT_VIEWPORT_WIDTH; Loading Loading @@ -4687,6 +4688,7 @@ public class WebView extends AbsoluteLayout mZoomCenterX = mLastTouchX; mZoomCenterY = mLastTouchY; mInZoomOverview = !mInZoomOverview; mCallbackProxy.uiOnChangeViewingMode(mInZoomOverview); if (mInZoomOverview) { if (getSettings().getBuiltInZoomControls()) { if (mZoomButtonsController.isVisible()) { Loading Loading @@ -5034,6 +5036,14 @@ public class WebView extends AbsoluteLayout mInZoomOverview = ENABLE_DOUBLETAP_ZOOM && settings.getLoadWithOverviewMode(); } mCallbackProxy.uiOnChangeViewingMode(true); if (!mInZoomOverview) { // We are going to start zoomed in. However, we // truly want to show the title bar, and then hide // it once the page has loaded mCallbackProxy.uiChangeViewingModeOnFinishedLoad( false, getOriginalUrl()); } setNewZoomScale(mLastScale, false); setContentScrollTo(restoreState.mScrollX, restoreState.mScrollY); Loading