Commit ebe5f031 authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

weblayer: Make keyboard IME work

Use the ContentView as the WebContents container view
Also emulate focus changes like content shell.

Change-Id: I6edf3e7be920bcc2a385d0698b1bf949a496c91e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1790150
Commit-Queue: Bo <boliu@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694886}
parent 003754cc
......@@ -76,7 +76,9 @@ public final class BrowserControllerImpl extends IBrowserController.Stub {
mNativeBrowserController = nativeCreateBrowserController(profile.getNativeProfile());
mWebContents = nativeGetWebContents(mNativeBrowserController);
mWebContents.initialize("", ViewAndroidDelegate.createBasicDelegate(mContentViewRenderView),
mContentView = ContentView.createContentView(context, mWebContents);
mWebContents.initialize("", ViewAndroidDelegate.createBasicDelegate(mContentView),
new InternalAccessDelegateImpl(), mWindowAndroid,
WebContents.createDefaultInternalsHolder());
......@@ -85,12 +87,12 @@ public final class BrowserControllerImpl extends IBrowserController.Stub {
new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1f));
mContentView = ContentView.createContentView(context, mWebContents);
mContentViewRenderView.addView(mContentView,
new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1f));
mWebContents.onShow();
mContentView.requestFocus();
}
long getNativeBrowserController() {
......
......@@ -36,6 +36,7 @@ public class WebLayerShellActivity extends FragmentActivity {
private Profile mProfile;
private BrowserController mBrowserController;
private EditText mUrlView;
private View mMainView;
public static class ShellFragment extends Fragment {
private BrowserController mBrowserController;
......@@ -61,6 +62,7 @@ public class WebLayerShellActivity extends FragmentActivity {
LinearLayout mainView = new LinearLayout(this);
int viewId = View.generateViewId();
mainView.setId(viewId);
mMainView = mainView;
setContentView(mainView);
mUrlView = new EditText(this);
......@@ -111,6 +113,7 @@ public class WebLayerShellActivity extends FragmentActivity {
private void loadUrl(String url) {
mBrowserController.getNavigationController().navigate(Uri.parse(sanitizeUrl(url)));
mUrlView.clearFocus();
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment