diff options
author | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-03 01:30:41 +0000 |
---|---|---|
committer | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-03 01:30:41 +0000 |
commit | 4a1c4952ce12e0bca1a366e6ef7118893910fa67 (patch) | |
tree | 891892df963b712449eebe3d2cd2563aa812782b /android_webview | |
parent | cb48fde258d455e14a4314b8b09f172785d66304 (diff) | |
download | chromium_src-4a1c4952ce12e0bca1a366e6ef7118893910fa67.zip chromium_src-4a1c4952ce12e0bca1a366e6ef7118893910fa67.tar.gz chromium_src-4a1c4952ce12e0bca1a366e6ef7118893910fa67.tar.bz2 |
[Android WebView] Always visible to ContentViewCore
Keep the |visibile_| arg in InProcessViewRenderer for now since it's
only used in devtools.
For RestoreState, we used to wait until the view is visible
before loading, but now need to explicitly call Load after
restore.
Note the DCHECK in InProcessViewRenderer::DrawGL is intentionally
left there to avoid conflict with another CL. Will clean up later.
BUG=250594
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/19540025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215442 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwContents.java | 34 | ||||
-rw-r--r-- | android_webview/native/state_serializer.cc | 4 |
2 files changed, 14 insertions, 24 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index 2d498da..8330cae 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -150,8 +150,7 @@ public class AwContents { // This can be accessed on any thread after construction. See AwContentsIoThreadClient. private final AwSettings mSettings; - private boolean mIsPaused; - private boolean mIsVisible; // Equivalent to windowVisible && viewVisible && !mIsPaused. + private boolean mIsVisible; // Equivalent to windowVisible && viewVisible. private boolean mIsAttachedToWindow; private Bitmap mFavicon; private boolean mHasRequestedVisitedHistoryFromClient; @@ -545,6 +544,9 @@ public class AwContents { mContentViewCore.setUpdateFrameInfoListener(new AwContentUpdateFrameInfoListener()); mSettings.setWebContents(nativeWebContents); nativeSetDipScale(mNativeAwContents, (float) mDIPScale); + + // The only call to onShow. onHide should never be called. + mContentViewCore.onShow(); } /** @@ -572,7 +574,7 @@ public class AwContents { // Save existing view state. final boolean wasAttached = mIsAttachedToWindow; final boolean wasVisible = getContainerViewVisible(); - final boolean wasPaused = mIsPaused; + final boolean wasPaused = mUnimplementedIsPaused; final boolean wasFocused = mWindowFocused; // Properly clean up existing mContentViewCore and mNativeAwContents. @@ -1011,31 +1013,27 @@ public class AwContents { ContentViewStatics.setWebKitSharedTimersSuspended(false); } + private boolean mUnimplementedIsPaused; + /** * @see android.webkit.WebView#onPause() */ public void onPause() { - mIsPaused = true; - updateVisibilityState(); - mContentViewCore.onActivityPause(); + mUnimplementedIsPaused = true; } /** * @see android.webkit.WebView#onResume() */ public void onResume() { - mIsPaused = false; - updateVisibilityState(); - // Not calling mContentViewCore.onActivityResume because it is the same - // as onShow, but we do not want to call onShow yet, since AwContents - // visibility depends on other things. TODO(boliu): Clean this up. + mUnimplementedIsPaused = false; } /** * @see android.webkit.WebView#isPaused() */ public boolean isPaused() { - return mIsPaused; + return mUnimplementedIsPaused; } /** @@ -1341,11 +1339,6 @@ public class AwContents { mContentViewCore.onAttachedToWindow(); nativeOnAttachedToWindow(mNativeAwContents, mContainerView.getWidth(), mContainerView.getHeight()); - - // This is for the case where this is created by restoreState, which - // needs to call to NavigationController::LoadIfNecessary to actually - // load the restored page. - if (!mIsPaused) onResume(); } /** @@ -1418,7 +1411,7 @@ public class AwContents { boolean windowVisible = mContainerView.getWindowVisibility() == View.VISIBLE; boolean viewVisible = mContainerView.getVisibility() == View.VISIBLE; - return windowVisible && viewVisible && !mIsPaused; + return windowVisible && viewVisible; } private void setVisibilityInternal(boolean visible) { @@ -1426,11 +1419,6 @@ public class AwContents { // visibility. In general, callers should use updateVisibilityState // instead. mIsVisible = visible; - if (mIsVisible) { - mContentViewCore.onShow(); - } else { - mContentViewCore.onHide(); - } nativeSetVisibility(mNativeAwContents, mIsVisible); } diff --git a/android_webview/native/state_serializer.cc b/android_webview/native/state_serializer.cc index 1fb64ff..632737c 100644 --- a/android_webview/native/state_serializer.cc +++ b/android_webview/native/state_serializer.cc @@ -104,11 +104,13 @@ bool RestoreFromPickle(PickleIterator* iterator, } // |web_contents| takes ownership of these entries after this call. - web_contents->GetController().Restore( + content::NavigationController& controller = web_contents->GetController(); + controller.Restore( selected_entry, content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, &restored_entries.get()); DCHECK_EQ(0u, restored_entries.size()); + controller.LoadIfNecessary(); return true; } |