Commit 91281c25 authored by Shakti Sahu's avatar Shakti Sahu Committed by Commit Bot

Ephemeral tab : Several fixes

This CL adds several fixes:
1 - Adds custom height for full state
2 - Fixes a crash when trying to obtain ChromeActivity by using
 ActivityWindowAndroid. This is required especially during text input.

Bug: 998826
Change-Id: Ib9a7bb370c7c230d2ca22064d92f23d1161ae0e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1815053Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Shakti Sahu <shaktisahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699867}
parent dbd9cc7e
...@@ -26,7 +26,7 @@ import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet; ...@@ -26,7 +26,7 @@ import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet;
import org.chromium.components.embedder_support.view.ContentView; import org.chromium.components.embedder_support.view.ContentView;
import org.chromium.content_public.browser.RenderCoordinates; import org.chromium.content_public.browser.RenderCoordinates;
import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.base.ActivityWindowAndroid;
/** /**
* Represents ephemeral tab content and the toolbar, which can be included inside the bottom sheet. * Represents ephemeral tab content and the toolbar, which can be included inside the bottom sheet.
...@@ -81,7 +81,7 @@ public class EphemeralTabSheetContent implements BottomSheet.BottomSheetContent ...@@ -81,7 +81,7 @@ public class EphemeralTabSheetContent implements BottomSheet.BottomSheetContent
* bottom sheet. * bottom sheet.
*/ */
private void createThinWebView() { private void createThinWebView() {
mThinWebView = ThinWebViewFactory.create(mContext, new WindowAndroid(mContext)); mThinWebView = ThinWebViewFactory.create(mContext, new ActivityWindowAndroid(mContext));
mSheetContentView = new FrameLayout(mContext); mSheetContentView = new FrameLayout(mContext);
mSheetContentView.addView(mThinWebView.getView()); mSheetContentView.addView(mThinWebView.getView());
...@@ -192,6 +192,11 @@ public class EphemeralTabSheetContent implements BottomSheet.BottomSheetContent ...@@ -192,6 +192,11 @@ public class EphemeralTabSheetContent implements BottomSheet.BottomSheetContent
return true; return true;
} }
@Override
public float getCustomFullRatio() {
return 0.9f;
}
// TODO(shaktisahu): Provide correct strings for the following methods. // TODO(shaktisahu): Provide correct strings for the following methods.
@Override @Override
public int getSheetContentDescriptionStringId() { public int getSheetContentDescriptionStringId() {
......
...@@ -1213,8 +1213,8 @@ public class BottomSheet ...@@ -1213,8 +1213,8 @@ public class BottomSheet
* @return The height of the sheet at the provided state. * @return The height of the sheet at the provided state.
*/ */
private float getSheetHeightForState(@SheetState int state) { private float getSheetHeightForState(@SheetState int state) {
if (mSheetContent != null && mSheetContent.wrapContentEnabled() if (mSheetContent != null && mSheetContent.wrapContentEnabled() && state == SheetState.FULL
&& state == SheetState.FULL) { && mSheetContent.getCustomFullRatio() == INVALID_HEIGHT_RATIO) {
ensureContentDesiredHeightIsComputed(); ensureContentDesiredHeightIsComputed();
return mContentDesiredHeight + mToolbarShadowHeight; return mContentDesiredHeight + mToolbarShadowHeight;
} }
......
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