diff options
author | sgurun@chromium.org <sgurun@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-03 08:16:31 +0000 |
---|---|---|
committer | sgurun@chromium.org <sgurun@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-03 08:16:31 +0000 |
commit | 6f09f204799ea321d06110f1ab612b8b3dad26fa (patch) | |
tree | 9751df7974c4aca1de736d0b0058ad16f9bb58c7 /android_webview | |
parent | 3e5d16303f43f646ceb37573de40d6a0dfde1859 (diff) | |
download | chromium_src-6f09f204799ea321d06110f1ab612b8b3dad26fa.zip chromium_src-6f09f204799ea321d06110f1ab612b8b3dad26fa.tar.gz chromium_src-6f09f204799ea321d06110f1ab612b8b3dad26fa.tar.bz2 |
Combine ViewAndroidDelegate code.
The ViewAndroidDelegate code in AutofillManagerDelegate and ContentViewCore
has a lot of redundancies. Combine.
Review URL: https://chromiumcodereview.appspot.com/21969002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwAutofillManagerDelegate.java | 39 | ||||
-rw-r--r-- | android_webview/java/src/org/chromium/android_webview/AwContents.java | 2 |
2 files changed, 3 insertions, 38 deletions
diff --git a/android_webview/java/src/org/chromium/android_webview/AwAutofillManagerDelegate.java b/android_webview/java/src/org/chromium/android_webview/AwAutofillManagerDelegate.java index 5310268..c3a74af 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwAutofillManagerDelegate.java +++ b/android_webview/java/src/org/chromium/android_webview/AwAutofillManagerDelegate.java @@ -11,7 +11,6 @@ import android.view.ViewGroup; import org.chromium.base.CalledByNative; import org.chromium.base.JNINamespace; import org.chromium.content.browser.ContentViewCore; -import org.chromium.ui.ViewAndroidDelegate; import org.chromium.ui.autofill.AutofillPopup; import org.chromium.ui.autofill.AutofillSuggestion; @@ -23,7 +22,6 @@ public class AwAutofillManagerDelegate { private final int mNativeAwAutofillManagerDelegate; private AutofillPopup mAutofillPopup; private ViewGroup mContainerView; - private double mDIPScale; private ContentViewCore mContentViewCore; @CalledByNative @@ -35,10 +33,9 @@ public class AwAutofillManagerDelegate { mNativeAwAutofillManagerDelegate = nativeAwAutofillManagerDelegate; } - public void init(ContentViewCore contentViewCore, double DIPScale) { + public void init(ContentViewCore contentViewCore) { mContentViewCore = contentViewCore; mContainerView = contentViewCore.getContainerView(); - mDIPScale = DIPScale; } @CalledByNative @@ -50,7 +47,7 @@ public class AwAutofillManagerDelegate { if (mAutofillPopup == null) { mAutofillPopup = new AutofillPopup( mContentViewCore.getContext(), - getViewAndroidDelegate(), + mContentViewCore.getViewAndroidDelegate(), new AutofillPopup.AutofillPopupDelegate() { public void requestHide() { } public void suggestionSelected(int listIndex) { @@ -70,38 +67,6 @@ public class AwAutofillManagerDelegate { mAutofillPopup = null; } - private ViewAndroidDelegate getViewAndroidDelegate() { - return new ViewAndroidDelegate() { - @Override - public View acquireAnchorView() { - View anchorView = new View(mContentViewCore.getContext()); - mContainerView.addView(anchorView); - return anchorView; - } - - @Override - @SuppressWarnings("deprecation") // AbsoluteLayout.LayoutParams - public void setAnchorViewPosition( - View view, float x, float y, float width, float height) { - assert(view.getParent() == mContainerView); - - int leftMargin = (int)Math.round(x * mDIPScale); - int topMargin = (int)mContentViewCore.getRenderCoordinates().getContentOffsetYPix() - + (int)Math.round(y * mDIPScale); - - android.widget.AbsoluteLayout.LayoutParams lp = - new android.widget.AbsoluteLayout.LayoutParams((int)width, - (int)height, leftMargin, topMargin); - view.setLayoutParams(lp); - } - - @Override - public void releaseAnchorView(View anchorView) { - mContainerView.removeView(anchorView); - } - }; - } - @CalledByNative private static AutofillSuggestion[] createAutofillSuggestionArray(int size) { return new AutofillSuggestion[size]; diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index 01127a6..a5f8983 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -1647,7 +1647,7 @@ public class AwContents { @CalledByNative private void setAwAutofillManagerDelegate(AwAutofillManagerDelegate delegate) { mAwAutofillManagerDelegate = delegate; - delegate.init(mContentViewCore, mDIPScale); + delegate.init(mContentViewCore); } @CalledByNative |