| Index: chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopup.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopup.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopup.java
|
| index 0a256fb63a4e8a0fa40f38f92b9bd88b9c82c5ec..572a4f65dd85ac02ea2a70c914b5cd20db2ca77d 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopup.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopup.java
|
| @@ -10,22 +10,20 @@ import android.graphics.Paint;
|
| import android.graphics.Point;
|
| import android.graphics.Rect;
|
| import android.graphics.drawable.Drawable;
|
| -import android.util.Log;
|
| import android.view.LayoutInflater;
|
| import android.view.View;
|
| import android.view.WindowManager;
|
| import android.widget.AdapterView;
|
| import android.widget.FrameLayout;
|
| -import android.widget.ListAdapter;
|
| import android.widget.ListPopupWindow;
|
| import android.widget.TextView;
|
|
|
| import java.util.ArrayList;
|
|
|
| import org.chromium.chrome.R;
|
| -import org.chromium.content.browser.ContainerViewDelegate;
|
| +import org.chromium.ui.ViewAndroidDelegate;
|
| import org.chromium.ui.gfx.DeviceDisplayInfo;
|
| -import org.chromium.ui.gfx.NativeWindow;
|
| +import org.chromium.ui.gfx.WindowAndroid;
|
|
|
| /**
|
| * The Autofill suggestion popup that lists relevant suggestions.
|
| @@ -46,8 +44,8 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem
|
| private static final int TEXT_PADDING_DP = 30;
|
|
|
| private final AutofillPopupDelegate mAutofillCallback;
|
| - private final NativeWindow mNativeWindow;
|
| - private final ContainerViewDelegate mContainerViewDelegate;
|
| + private final WindowAndroid mWindowAndroid;
|
| + private final ViewAndroidDelegate mContainerViewDelegate;
|
| private AnchorView mAnchorView;
|
| private Rect mAnchorRect;
|
| private Paint mNameViewPaint;
|
| @@ -124,20 +122,20 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem
|
|
|
| /**
|
| * Creates an AutofillWindow with specified parameters.
|
| - * @param nativeWindow NativeWindow used to get application context.
|
| + * @param windowAndroid WindowAndroid used to get application context.
|
| * @param containerViewDelegate View delegate used to add and remove views.
|
| * @param autofillCallback A object that handles the calls to the native AutofillPopupView.
|
| */
|
| - public AutofillPopup(NativeWindow nativeWindow, ContainerViewDelegate containerViewDelegate,
|
| + public AutofillPopup(WindowAndroid windowAndroid, ViewAndroidDelegate containerViewDelegate,
|
| AutofillPopupDelegate autofillCallback) {
|
| - super(nativeWindow.getContext());
|
| - mNativeWindow = nativeWindow;
|
| + super(windowAndroid.getContext());
|
| + mWindowAndroid = windowAndroid;
|
| mContainerViewDelegate = containerViewDelegate;
|
| mAutofillCallback = autofillCallback;
|
|
|
| setOnItemClickListener(this);
|
|
|
| - mAnchorView = new AnchorView(mNativeWindow.getContext(), this);
|
| + mAnchorView = new AnchorView(mWindowAndroid.getContext(), this);
|
| mContainerViewDelegate.addViewToContainerView(mAnchorView);
|
| setAnchorView(mAnchorView);
|
| }
|
| @@ -151,7 +149,7 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem
|
| * @param height The height of the anchor view.
|
| */
|
| public void setAnchorRect(float x, float y, float width, float height) {
|
| - float scale = (float) DeviceDisplayInfo.create(mNativeWindow.getContext()).getDIPScale();
|
| + float scale = (float) DeviceDisplayInfo.create(mWindowAndroid.getContext()).getDIPScale();
|
| mAnchorRect = new Rect(Math.round(x * scale), Math.round(y * scale),
|
| Math.round((x + width) * scale), Math.round((y + height) * scale));
|
| mAnchorRect.offset(0, mContainerViewDelegate.getChildViewOffsetYPix());
|
| @@ -171,7 +169,7 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem
|
| cleanedData.add(suggestions[i]);
|
| }
|
| }
|
| - setAdapter(new AutofillListAdapter(mNativeWindow.getContext(), cleanedData));
|
| + setAdapter(new AutofillListAdapter(mWindowAndroid.getContext(), cleanedData));
|
| // Once the mAnchorRect is resized and placed correctly, it will show the Autofill popup.
|
| mAnchorView.setSize(mAnchorRect, getDesiredWidth(suggestions));
|
| }
|
| @@ -201,7 +199,7 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem
|
| private int getDesiredWidth(AutofillSuggestion[] data) {
|
| if (mNameViewPaint == null || mLabelViewPaint == null) {
|
| LayoutInflater inflater =
|
| - (LayoutInflater) mNativeWindow.getContext().getSystemService(
|
| + (LayoutInflater) mWindowAndroid.getContext().getSystemService(
|
| Context.LAYOUT_INFLATER_SERVICE);
|
| View layout = inflater.inflate(R.layout.autofill_text, null);
|
| TextView nameView = (TextView) layout.findViewById(R.id.autofill_name);
|
| @@ -227,7 +225,7 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem
|
| }
|
| // Adding padding.
|
| return maxTextWidth + (int) (TEXT_PADDING_DP *
|
| - mNativeWindow.getContext().getResources().getDisplayMetrics().density);
|
| + mWindowAndroid.getContext().getResources().getDisplayMetrics().density);
|
| }
|
|
|
| @Override
|
|
|