Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2196)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/autofill/PasswordGenerationPopupBridge.java

Issue 2103243002: Factor out ContentViewAndroidDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..acfd2654b687b73743d8a7a9b1049f8adf7da49c 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
@@ -30,24 +30,30 @@ public class PasswordGenerationPopupBridge implements AdapterView.OnItemClickLis
/**
* A convenience method for the constructor to be invoked from the native counterpart.
+ * @param anchorView View anchored for popup.
+ * @param anchorWidth Width of the anchor view.
* @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, float anchorWidth,
+ long nativePopup, WindowAndroid windowAndroid,
+ ViewAndroidDelegate viewAndroidDelegate) {
+ return new PasswordGenerationPopupBridge(anchorView, anchorWidth, nativePopup,
+ windowAndroid, viewAndroidDelegate);
}
/**
* Builds the bridge between native and Java objects.
+ * @param anchorView View anchored for popup.
+ * @param anchorWidth Width of the anchor view.
* @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, float anchorWidth, long nativePopup,
+ WindowAndroid windowAndroid, ViewAndroidDelegate containerViewDelegate) {
mNativePasswordGenerationPopupViewAndroid = nativePopup;
mContext = windowAndroid.getActivity().get();
// mContext could've been garbage collected.
@@ -62,14 +68,15 @@ public class PasswordGenerationPopupBridge implements AdapterView.OnItemClickLis
}
});
} else {
- mPopup = new DropdownPopupWindow(mContext, containerViewDelegate);
+ mPopup = new DropdownPopupWindow(mContext, anchorView, anchorWidth,
+ containerViewDelegate);
mPopup.setOnItemClickListener(this);
mPopup.setOnDismissListener(this);
mPopup.disableHideOnOutsideTap();
mPopup.setContentDescriptionForAccessibility(
mContext.getString(R.string.password_generation_popup_content_description));
}
- mAnchorWidth = 0;
+ mAnchorWidth = anchorWidth;
}
/**
@@ -99,19 +106,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.

Powered by Google App Engine
This is Rietveld 408576698