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( |