Chromium Code Reviews| 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..68153bfd6d1b6e83d3ebd0f3639c0d6c77144f08 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,13 +10,11 @@ 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; |
| @@ -25,7 +23,7 @@ import java.util.ArrayList; |
| import org.chromium.chrome.R; |
| import org.chromium.content.browser.ContainerViewDelegate; |
| import org.chromium.ui.gfx.DeviceDisplayInfo; |
| -import org.chromium.ui.gfx.NativeWindow; |
| +import org.chromium.ui.WindowAndroid; |
| /** |
| * The Autofill suggestion popup that lists relevant suggestions. |
| @@ -46,7 +44,7 @@ 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 WindowAndroid mWindowAndroid; |
| private final ContainerViewDelegate mContainerViewDelegate; |
| private AnchorView mAnchorView; |
| private Rect mAnchorRect; |
| @@ -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. |
|
nilesh
2013/04/18 16:50:06
It says it needs the application context but getti
aurimas (slooooooooow)
2013/04/18 20:46:16
It was a mistake in the comment. I wrote this comm
|
| * @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, ContainerViewDelegate containerViewDelegate, |
| AutofillPopupDelegate autofillCallback) { |
| - super(nativeWindow.getContext()); |
| - mNativeWindow = nativeWindow; |
| + super(windowAndroid.getContext()); |
| + mWindowAndroid = windowAndroid; |
|
nilesh
2013/04/18 16:50:06
Why store a ref to window, when only application c
aurimas (slooooooooow)
2013/04/18 20:46:16
Done.
|
| 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 |