Index: content/shell/android/java/src/org/chromium/content_shell/Shell.java |
diff --git a/content/shell/android/java/src/org/chromium/content_shell/Shell.java b/content/shell/android/java/src/org/chromium/content_shell/Shell.java |
index 5940b5b2ad30ddcfb9ac72f06a20a9a90d9b174d..85190a322189e6df399399ca96840e402919109e 100644 |
--- a/content/shell/android/java/src/org/chromium/content_shell/Shell.java |
+++ b/content/shell/android/java/src/org/chromium/content_shell/Shell.java |
@@ -27,6 +27,8 @@ import org.chromium.content.browser.ContentViewClient; |
import org.chromium.content.browser.ContentViewCore; |
import org.chromium.content.browser.ContentViewRenderView; |
import org.chromium.content_public.browser.LoadUrlParams; |
+import org.chromium.content_public.browser.NavigationController; |
+import org.chromium.content_public.browser.WebContents; |
import org.chromium.ui.base.WindowAndroid; |
/** |
@@ -45,6 +47,8 @@ public class Shell extends LinearLayout { |
}; |
private ContentViewCore mContentViewCore; |
+ private WebContents mWebContents; |
+ private NavigationController mNavigationController; |
private ContentViewClient mContentViewClient; |
private EditText mUrlTextView; |
private ImageButton mPrevButton; |
@@ -162,7 +166,7 @@ public class Shell extends LinearLayout { |
mNextButton.setVisibility(hasFocus ? GONE : VISIBLE); |
mPrevButton.setVisibility(hasFocus ? GONE : VISIBLE); |
if (!hasFocus) { |
- mUrlTextView.setText(mContentViewCore.getUrl()); |
+ mUrlTextView.setText(mWebContents.getUrl()); |
} |
} |
}); |
@@ -187,10 +191,10 @@ public class Shell extends LinearLayout { |
public void loadUrl(String url) { |
if (url == null) return; |
- if (TextUtils.equals(url, mContentViewCore.getUrl())) { |
- mContentViewCore.reload(true); |
+ if (TextUtils.equals(url, mWebContents.getUrl())) { |
+ mNavigationController.reload(true); |
} else { |
- mContentViewCore.loadUrl(new LoadUrlParams(sanitizeUrl(url))); |
+ mNavigationController.loadUrl(new LoadUrlParams(sanitizeUrl(url))); |
} |
mUrlTextView.clearFocus(); |
// TODO(aurimas): Remove this when crbug.com/174541 is fixed. |
@@ -214,7 +218,7 @@ public class Shell extends LinearLayout { |
mPrevButton.setOnClickListener(new OnClickListener() { |
@Override |
public void onClick(View v) { |
- if (mContentViewCore.canGoBack()) mContentViewCore.goBack(); |
+ if (mNavigationController.canGoBack()) mNavigationController.goBack(); |
} |
}); |
@@ -222,21 +226,21 @@ public class Shell extends LinearLayout { |
mNextButton.setOnClickListener(new OnClickListener() { |
@Override |
public void onClick(View v) { |
- if (mContentViewCore.canGoForward()) mContentViewCore.goForward(); |
+ if (mNavigationController.canGoForward()) mNavigationController.goForward(); |
} |
}); |
mStopButton = (ImageButton)findViewById(R.id.stop); |
mStopButton.setOnClickListener(new OnClickListener() { |
@Override |
public void onClick(View v) { |
- if (mLoading) mContentViewCore.stopLoading(); |
+ if (mLoading) mWebContents.stop(); |
} |
}); |
mReloadButton = (ImageButton)findViewById(R.id.reload); |
mReloadButton.setOnClickListener(new OnClickListener() { |
@Override |
public void onClick(View v) { |
- mContentViewCore.reload(true); |
+ mNavigationController.reload(true); |
} |
}); |
} |
@@ -282,9 +286,12 @@ public class Shell extends LinearLayout { |
ContentView cv = ContentView.newInstance(context, mContentViewCore); |
mContentViewCore.initialize(cv, cv, nativeWebContents, mWindow); |
mContentViewCore.setContentViewClient(mContentViewClient); |
- |
+ mWebContents = mContentViewCore.getWebContents(); |
+ mNavigationController = mWebContents.getNavigationController(); |
if (getParent() != null) mContentViewCore.onShow(); |
- if (mContentViewCore.getUrl() != null) mUrlTextView.setText(mContentViewCore.getUrl()); |
+ if (mWebContents.getUrl() != null) { |
+ mUrlTextView.setText(mWebContents.getUrl()); |
+ } |
((FrameLayout) findViewById(R.id.contentview_holder)).addView(cv, |
new FrameLayout.LayoutParams( |
FrameLayout.LayoutParams.MATCH_PARENT, |