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

Unified Diff: chrome/browser/ui/android/autofill/password_generation_popup_view_android.cc

Issue 2103243002: Factor out ContentViewAndroidDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ScopedAnchorView 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/browser/ui/android/autofill/password_generation_popup_view_android.cc
diff --git a/chrome/browser/ui/android/autofill/password_generation_popup_view_android.cc b/chrome/browser/ui/android/autofill/password_generation_popup_view_android.cc
index a0f48c64dd42dbb5412ee65323d26e9fada2def1..673df2fa1dc5ce352148343ba806896668a6a69e 100644
--- a/chrome/browser/ui/android/autofill/password_generation_popup_view_android.cc
+++ b/chrome/browser/ui/android/autofill/password_generation_popup_view_android.cc
@@ -35,6 +35,7 @@ void PasswordGenerationPopupViewAndroid::SavedPasswordsLinkClicked(
void PasswordGenerationPopupViewAndroid::Dismissed(
JNIEnv* env,
const JavaParamRef<jobject>& obj) {
+
if (controller_)
controller_->ViewDestroyed();
@@ -61,16 +62,18 @@ void PasswordGenerationPopupViewAndroid::Show() {
DCHECK(view_android);
+ popup_.reset(view_android->AcquireAnchorView());
no sievers 2016/07/18 22:14:16 I'd handle |popup_.view_.is_null()| here and early
Jinsuk Kim 2016/07/19 07:08:39 Done.
java_object_.Reset(Java_PasswordGenerationPopupBridge_create(
- env, reinterpret_cast<intptr_t>(this),
- view_android->GetWindowAndroid()->GetJavaObject().obj(),
- view_android->GetViewAndroidDelegate().obj()));
+ env, popup_->obj(), controller_->element_bounds().width(),
+ reinterpret_cast<intptr_t>(this),
+ view_android->GetWindowAndroid()->GetJavaObject().obj()));
UpdateBoundsAndRedrawPopup();
}
void PasswordGenerationPopupViewAndroid::Hide() {
controller_ = NULL;
+ popup_.reset();
no sievers 2016/07/18 22:14:16 I wonder if triggering removeView() here might hav
Jinsuk Kim 2016/07/19 07:08:39 Removed. The anchor view will be deleted in Dismis
JNIEnv* env = base::android::AttachCurrentThread();
Java_PasswordGenerationPopupBridge_hide(env, java_object_.obj());
}
@@ -82,14 +85,10 @@ gfx::Size PasswordGenerationPopupViewAndroid::GetPreferredSizeOfPasswordView() {
void PasswordGenerationPopupViewAndroid::UpdateBoundsAndRedrawPopup() {
JNIEnv* env = base::android::AttachCurrentThread();
- Java_PasswordGenerationPopupBridge_setAnchorRect(
- env,
- java_object_.obj(),
- controller_->element_bounds().x(),
- controller_->element_bounds().y(),
- controller_->element_bounds().width(),
- controller_->element_bounds().height());
+ ui::ViewAndroid* view_android = controller_->container_view();
+ DCHECK(view_android);
+ view_android->SetAnchorRect(popup_->ref(), controller_->element_bounds());
ScopedJavaLocalRef<jstring> password =
base::android::ConvertUTF16ToJavaString(env, controller_->password());
ScopedJavaLocalRef<jstring> suggestion =

Powered by Google App Engine
This is Rietveld 408576698