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

Unified Diff: android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java

Issue 481803004: Removing ContentViewCore dependencies from few functions which acts as direct wrapper to WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review comments and rebased the patch. Created 6 years, 3 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: android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
index af31b563eee4b5d4057c1fb80b70488e3fd84942..8ed513f15c084d4348656a0c6a74023bacc51f92 100644
--- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellActivity.java
@@ -37,6 +37,8 @@ import org.chromium.android_webview.AwSettings;
import org.chromium.android_webview.test.AwTestContainerView;
import org.chromium.android_webview.test.NullContentsClient;
import org.chromium.content_public.browser.LoadUrlParams;
+import org.chromium.content_public.browser.NavigationController;
+import org.chromium.content_public.browser.WebContents;
/**
* This is a lightweight activity for tests that only require WebView functionality.
@@ -47,6 +49,8 @@ public class AwShellActivity extends Activity {
private AwBrowserContext mBrowserContext;
private AwDevToolsServer mDevToolsServer;
private AwTestContainerView mAwTestContainerView;
+ private WebContents mWebContents;
+ private NavigationController mNavigationController;
private EditText mUrlTextView;
private ImageButton mPrevButton;
private ImageButton mNextButton;
@@ -59,6 +63,8 @@ public class AwShellActivity extends Activity {
mAwTestContainerView = createAwTestContainerView();
+ mWebContents = mAwTestContainerView.getContentViewCore().getWebContents();
+ mNavigationController = mWebContents.getNavigationController();
LinearLayout contentContainer = (LinearLayout) findViewById(R.id.content_container);
mAwTestContainerView.setLayoutParams(new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1f));
@@ -182,7 +188,7 @@ public class AwShellActivity extends Activity {
mNextButton.setVisibility(hasFocus ? View.GONE : View.VISIBLE);
mPrevButton.setVisibility(hasFocus ? View.GONE : View.VISIBLE);
if (!hasFocus) {
- mUrlTextView.setText(mAwTestContainerView.getContentViewCore().getUrl());
+ mUrlTextView.setText(mWebContents.getUrl());
}
}
});
@@ -193,8 +199,8 @@ public class AwShellActivity extends Activity {
mPrevButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- if (mAwTestContainerView.getContentViewCore().canGoBack()) {
- mAwTestContainerView.getContentViewCore().goBack();
+ if (mNavigationController.canGoBack()) {
+ mNavigationController.goBack();
}
}
});
@@ -203,8 +209,8 @@ public class AwShellActivity extends Activity {
mNextButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- if (mAwTestContainerView.getContentViewCore().canGoForward()) {
- mAwTestContainerView.getContentViewCore().goForward();
+ if (mNavigationController.canGoForward()) {
+ mNavigationController.goForward();
}
}
});
@@ -213,8 +219,8 @@ public class AwShellActivity extends Activity {
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
- if (mAwTestContainerView.getContentViewCore().canGoBack()) {
- mAwTestContainerView.getContentViewCore().goBack();
+ if (mNavigationController.canGoBack()) {
+ mNavigationController.goBack();
return true;
}
}

Powered by Google App Engine
This is Rietveld 408576698