| Index: chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationPopupBridge.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationPopupBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationPopupBridge.java
|
| index aca6d9ba9b34624a8b2d4a4baf10c6a063613873..2c3654cd2eb16c3307507eef8a8165eff3ef6f92 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationPopupBridge.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationPopupBridge.java
|
| @@ -14,7 +14,6 @@ import org.chromium.base.annotations.CalledByNative;
|
| import org.chromium.base.annotations.JNINamespace;
|
| import org.chromium.ui.DropdownPopupWindow;
|
| import org.chromium.ui.R;
|
| -import org.chromium.ui.base.ViewAndroidDelegate;
|
| import org.chromium.ui.base.WindowAndroid;
|
|
|
| /**
|
| @@ -26,30 +25,30 @@ public class PasswordGenerationPopupBridge implements AdapterView.OnItemClickLis
|
| private final long mNativePasswordGenerationPopupViewAndroid;
|
| private final Context mContext;
|
| private final DropdownPopupWindow mPopup;
|
| - private float mAnchorWidth;
|
| -
|
| + private final View mAnchorView;
|
| /**
|
| * A convenience method for the constructor to be invoked from the native counterpart.
|
| + * @param anchorView View anchored for popup.
|
| * @param nativePopup The pointer to the native counterpart.
|
| * @param windowAndroid The browser window.
|
| - * @param containerViewDelegate Interface to acquire and release anchors.
|
| */
|
| @CalledByNative
|
| - private static PasswordGenerationPopupBridge create(long nativePopup,
|
| - WindowAndroid windowAndroid, ViewAndroidDelegate viewAndroidDelegate) {
|
| - return new PasswordGenerationPopupBridge(nativePopup, windowAndroid, viewAndroidDelegate);
|
| + private static PasswordGenerationPopupBridge create(View anchorView, long nativePopup,
|
| + WindowAndroid windowAndroid) {
|
| + return new PasswordGenerationPopupBridge(anchorView, nativePopup, windowAndroid);
|
| }
|
|
|
| /**
|
| * Builds the bridge between native and Java objects.
|
| + * @param anchorView View anchored for popup.
|
| * @param nativePopup The pointer to the native counterpart.
|
| * @param windowAndroid The browser window.
|
| - * @param containerViewDelegate Interface to acquire and release anchors.
|
| */
|
| - public PasswordGenerationPopupBridge(long nativePopup, WindowAndroid windowAndroid,
|
| - ViewAndroidDelegate containerViewDelegate) {
|
| + public PasswordGenerationPopupBridge(View anchorView, long nativePopup,
|
| + WindowAndroid windowAndroid) {
|
| mNativePasswordGenerationPopupViewAndroid = nativePopup;
|
| mContext = windowAndroid.getActivity().get();
|
| + mAnchorView = anchorView;
|
| // mContext could've been garbage collected.
|
| if (mContext == null) {
|
| mPopup = null;
|
| @@ -62,14 +61,13 @@ public class PasswordGenerationPopupBridge implements AdapterView.OnItemClickLis
|
| }
|
| });
|
| } else {
|
| - mPopup = new DropdownPopupWindow(mContext, containerViewDelegate);
|
| + mPopup = new DropdownPopupWindow(mContext, anchorView);
|
| mPopup.setOnItemClickListener(this);
|
| mPopup.setOnDismissListener(this);
|
| mPopup.disableHideOnOutsideTap();
|
| mPopup.setContentDescriptionForAccessibility(
|
| mContext.getString(R.string.password_generation_popup_content_description));
|
| }
|
| - mAnchorWidth = 0;
|
| }
|
|
|
| /**
|
| @@ -99,19 +97,6 @@ public class PasswordGenerationPopupBridge implements AdapterView.OnItemClickLis
|
| private native void nativeDismissed(long nativePasswordGenerationPopupViewAndroid);
|
|
|
| /**
|
| - * Sets the location and size of the popup anchor (password input field).
|
| - * @param x X coordinate.
|
| - * @param y Y coordinate.
|
| - * @param width The width of the anchor.
|
| - * @param height The height of the anchor.
|
| - */
|
| - @CalledByNative
|
| - private void setAnchorRect(float x, float y, float width, float height) {
|
| - mAnchorWidth = width;
|
| - if (mPopup != null) mPopup.setAnchorRect(x, y, width, height);
|
| - }
|
| -
|
| - /**
|
| * Shows a password generation popup with specified data. Should be called after
|
| * setAnchorRect().
|
| * @param isRtl True if the popup should be RTL.
|
| @@ -129,9 +114,11 @@ public class PasswordGenerationPopupBridge implements AdapterView.OnItemClickLis
|
| String suggestionTitle, String explanationText, int explanationTextLinkRangeStart,
|
| int explanationTextLinkRangeEnd) {
|
| if (mPopup != null) {
|
| + float anchorWidth = mAnchorView.getLayoutParams().width;
|
| + assert anchorWidth > 0;
|
| PasswordGenerationAdapter adapter = new PasswordGenerationAdapter(mContext, this,
|
| passwordDisplayed, password, suggestionTitle, explanationText,
|
| - explanationTextLinkRangeStart, explanationTextLinkRangeEnd, mAnchorWidth);
|
| + explanationTextLinkRangeStart, explanationTextLinkRangeEnd, anchorWidth);
|
| mPopup.setAdapter(adapter);
|
| mPopup.setRtl(isRtl);
|
| mPopup.show();
|
|
|