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

Unified Diff: content/shell/android/java/src/org/chromium/content_shell/ShellManager.java

Issue 2231433002: Revert of Remove unnecessary page loading in ContentShellActivity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
diff --git a/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java b/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
index 543c4223051077f09ab4ced4e7fe2b1d8679c72d..8812289110edad6514a34ae3a82556945174095a 100644
--- a/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
+++ b/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
@@ -12,6 +12,7 @@
import android.widget.FrameLayout;
import org.chromium.base.ThreadUtils;
+import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.content.browser.ActivityContentVideoViewEmbedder;
@@ -28,6 +29,7 @@
public class ShellManager extends FrameLayout {
public static final String DEFAULT_SHELL_URL = "http://www.google.com";
+ private static boolean sStartup = true;
private WindowAndroid mWindow;
private Shell mActiveShell;
@@ -67,9 +69,26 @@
* @param window The window used to generate all shells.
*/
public void setWindow(WindowAndroid window) {
+ setWindow(window, true);
+ }
+
+ /**
+ * @param window The window used to generate all shells.
+ * @param initialLoadingNeeded Whether initial loading is needed or not.
+ */
+ @VisibleForTesting
+ public void setWindow(WindowAndroid window, final boolean initialLoadingNeeded) {
assert window != null;
mWindow = window;
- mContentViewRenderView = new ContentViewRenderView(getContext());
+ mContentViewRenderView = new ContentViewRenderView(getContext()) {
+ @Override
+ protected void onReadyToRender() {
+ if (sStartup) {
+ if (initialLoadingNeeded) mActiveShell.loadUrl(mStartupUrl);
+ sStartup = false;
+ }
+ }
+ };
mContentViewRenderView.onNativeLibraryLoaded(window);
}

Powered by Google App Engine
This is Rietveld 408576698