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

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

Issue 172043002: Fix a crash of the Content Shell for Android when showing videos in a ContentVideoView. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/shell/android/java/src/org/chromium/content_shell/Shell.java
===================================================================
--- content/shell/android/java/src/org/chromium/content_shell/Shell.java (revision 251875)
+++ content/shell/android/java/src/org/chromium/content_shell/Shell.java (working copy)
@@ -22,6 +22,7 @@
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.content.browser.ContentView;
+import org.chromium.content.browser.ContentViewClient;
import org.chromium.content.browser.ContentViewRenderView;
import org.chromium.content.browser.LoadUrlParams;
import org.chromium.ui.base.WindowAndroid;
@@ -43,6 +44,7 @@
// TODO(jrg): a mContentView.destroy() call is needed, both upstream and downstream.
private ContentView mContentView;
+ private ContentViewClient mContentViewClient;
private EditText mUrlTextView;
private ImageButton mPrevButton;
private ImageButton mNextButton;
@@ -81,6 +83,26 @@
}
/**
+ * @param client The {@link ContentViewClient} to be bound to any current or new
+ * {@link ContentViewCore}s associated with this {@link Shell}.
+ */
+ public void setContentViewClient(ContentViewClient client) {
Ted C 2014/02/20 00:54:08 with my comment in ShellManager, you should be abl
+ if (mContentViewClient == client) return;
+
+ ContentViewClient oldClient = mContentViewClient;
+ mContentViewClient = client;
+
+ if (mContentView == null) return;
+
+ if (mContentViewClient != null) {
+ mContentView.setContentViewClient(mContentViewClient);
+ } else if (oldClient != null) {
+ // We can't set a null client, but we should clear references to the last one.
+ mContentView.setContentViewClient(new ContentViewClient());
+ }
+ }
+
+ /**
* Initializes the Shell for use.
*
* @param nativeShell The pointer to the native Shell object.
@@ -246,6 +268,7 @@
@CalledByNative
private void initFromNativeTabContents(long nativeTabContents) {
mContentView = ContentView.newInstance(getContext(), nativeTabContents, mWindow);
+ if (mContentViewClient != null) mContentView.setContentViewClient(mContentViewClient);
Ted C 2014/02/20 00:54:08 we will know that mContentViewClient isn't null, s
if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.getUrl());
((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentView,
new FrameLayout.LayoutParams(

Powered by Google App Engine
This is Rietveld 408576698