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

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

Issue 888793002: Make content_browsertests for Chrome on Android running with valid Views (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments Created 5 years, 10 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
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.content_shell; 5 package org.chromium.content_shell;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.Context; 8 import android.content.Context;
9 import android.util.AttributeSet; 9 import android.util.AttributeSet;
10 import android.view.LayoutInflater; 10 import android.view.LayoutInflater;
11 import android.view.View; 11 import android.view.View;
12 import android.widget.FrameLayout; 12 import android.widget.FrameLayout;
13 13
14 import org.chromium.base.CalledByNative; 14 import org.chromium.base.CalledByNative;
15 import org.chromium.base.JNINamespace; 15 import org.chromium.base.JNINamespace;
16 import org.chromium.base.ThreadUtils; 16 import org.chromium.base.ThreadUtils;
17 import org.chromium.base.VisibleForTesting;
17 import org.chromium.content.browser.ActivityContentVideoViewClient; 18 import org.chromium.content.browser.ActivityContentVideoViewClient;
18 import org.chromium.content.browser.ContentVideoViewClient; 19 import org.chromium.content.browser.ContentVideoViewClient;
19 import org.chromium.content.browser.ContentViewClient; 20 import org.chromium.content.browser.ContentViewClient;
20 import org.chromium.content.browser.ContentViewCore; 21 import org.chromium.content.browser.ContentViewCore;
21 import org.chromium.content.browser.ContentViewRenderView; 22 import org.chromium.content.browser.ContentViewRenderView;
22 import org.chromium.ui.base.WindowAndroid; 23 import org.chromium.ui.base.WindowAndroid;
23 24
24 /** 25 /**
25 * Container and generator of ShellViews. 26 * Container and generator of ShellViews.
26 */ 27 */
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 62 }
62 }; 63 };
63 } 64 }
64 }; 65 };
65 } 66 }
66 67
67 /** 68 /**
68 * @param window The window used to generate all shells. 69 * @param window The window used to generate all shells.
69 */ 70 */
70 public void setWindow(WindowAndroid window) { 71 public void setWindow(WindowAndroid window) {
72 setWindow(window, true);
73 }
74
75 /**
76 * @param window The window used to generate all shells.
77 * @param initialLoadingNeeded Whether initial loading is needed or not.
78 */
79 @VisibleForTesting
80 public void setWindow(WindowAndroid window, final boolean initialLoadingNeed ed) {
71 assert window != null; 81 assert window != null;
72 mWindow = window; 82 mWindow = window;
73 mContentViewRenderView = new ContentViewRenderView(getContext()) { 83 mContentViewRenderView = new ContentViewRenderView(getContext()) {
74 @Override 84 @Override
75 protected void onReadyToRender() { 85 protected void onReadyToRender() {
76 if (sStartup) { 86 if (sStartup) {
77 mActiveShell.loadUrl(mStartupUrl); 87 if (initialLoadingNeeded) mActiveShell.loadUrl(mStartupUrl);
78 sStartup = false; 88 sStartup = false;
79 } 89 }
80 } 90 }
81 91
82 @Override 92 @Override
83 protected void onWindowVisibilityChanged(int visibility) { 93 protected void onWindowVisibilityChanged(int visibility) {
84 if (visibility == View.GONE && mActiveShell != null) { 94 if (visibility == View.GONE && mActiveShell != null) {
85 ContentViewCore contentViewCore = mActiveShell.getContentVie wCore(); 95 ContentViewCore contentViewCore = mActiveShell.getContentVie wCore();
86 if (contentViewCore != null) contentViewCore.onHide(); 96 if (contentViewCore != null) contentViewCore.onHide();
87 } 97 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 if (shellView.getParent() == null) return; 183 if (shellView.getParent() == null) return;
174 ContentViewCore contentViewCore = shellView.getContentViewCore(); 184 ContentViewCore contentViewCore = shellView.getContentViewCore();
175 if (contentViewCore != null) contentViewCore.onHide(); 185 if (contentViewCore != null) contentViewCore.onHide();
176 shellView.setContentViewRenderView(null); 186 shellView.setContentViewRenderView(null);
177 removeView(shellView); 187 removeView(shellView);
178 } 188 }
179 189
180 private static native void nativeInit(Object shellManagerInstance); 190 private static native void nativeInit(Object shellManagerInstance);
181 private static native void nativeLaunchShell(String url); 191 private static native void nativeLaunchShell(String url);
182 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698