Index: chrome/browser/ui/android/infobars/account_chooser_infobar.cc |
diff --git a/chrome/browser/ui/android/infobars/account_chooser_infobar.cc b/chrome/browser/ui/android/infobars/account_chooser_infobar.cc |
index b93083cea43be510878b606395eaa5c4b90504fe..6cd4c834ffafc7a5316edc2f2d3ef5c7a3fdfd35 100644 |
--- a/chrome/browser/ui/android/infobars/account_chooser_infobar.cc |
+++ b/chrome/browser/ui/android/infobars/account_chooser_infobar.cc |
@@ -96,6 +96,10 @@ AccountChooserInfoBar::AccountChooserInfoBar( |
} |
AccountChooserInfoBar::~AccountChooserInfoBar() { |
+ if (java_info_bar()) { |
David Trainor- moved to gerrit
2015/06/03 19:38:46
Just override onNativeDestroyed() in Java?
Changwan Ryu
2015/06/04 01:42:27
Done.
|
+ JNIEnv* env = base::android::AttachCurrentThread(); |
+ Java_AccountChooserInfoBar_onNativeDestroyed(env, java_info_bar()); |
+ } |
} |
base::android::ScopedJavaLocalRef<jobject> |
@@ -114,8 +118,7 @@ AccountChooserInfoBar::CreateRenderInfoBar(JNIEnv* env) { |
GetDelegate()->local_credentials_forms().size()); |
base::android::ScopedJavaGlobalRef<jobject> java_infobar_global; |
java_infobar_global.Reset(Java_AccountChooserInfoBar_show( |
- env, reinterpret_cast<intptr_t>(this), GetEnumeratedIconId(), |
- java_credentials_array.obj())); |
+ env, GetEnumeratedIconId(), java_credentials_array.obj())); |
base::android::ScopedJavaLocalRef<jobject> java_infobar(java_infobar_global); |
content::WebContents* web_contents = |
InfoBarService::WebContentsFromInfoBar(this); |
@@ -153,6 +156,14 @@ AccountChooserInfoBarDelegateAndroid* AccountChooserInfoBar::GetDelegate() { |
return static_cast<AccountChooserInfoBarDelegateAndroid*>(delegate()); |
} |
+void AccountChooserInfoBar::SetJavaInfoBar( |
+ const base::android::JavaRef<jobject>& java_info_bar) { |
+ InfoBarAndroid::SetJavaInfoBar(java_info_bar); |
+ JNIEnv* env = base::android::AttachCurrentThread(); |
+ Java_AccountChooserInfoBar_setNativePtr(env, java_info_bar.obj(), |
+ reinterpret_cast<intptr_t>(this)); |
+} |
+ |
bool RegisterAccountChooserInfoBar(JNIEnv* env) { |
return RegisterNativesImpl(env); |
} |