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

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: Rebased 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..54404bd05b45629274bada771262577b2053fc5e 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;
/**
@@ -30,24 +29,27 @@ 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) {
+ return new PasswordGenerationPopupBridge(anchorView, anchorWidth, nativePopup,
+ windowAndroid);
}
/**
* 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) {
mNativePasswordGenerationPopupViewAndroid = nativePopup;
mContext = windowAndroid.getActivity().get();
// mContext could've been garbage collected.
@@ -62,14 +64,14 @@ public class PasswordGenerationPopupBridge implements AdapterView.OnItemClickLis
}
});
} else {
- mPopup = new DropdownPopupWindow(mContext, containerViewDelegate);
+ mPopup = new DropdownPopupWindow(mContext, anchorView, anchorWidth);
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 +101,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