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

Unified Diff: chrome/browser/ui/android/infobars/translate_infobar.cc

Issue 1150193004: Straighten up life cycle of native InfoBar pointers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed setNativeInfoBarPtr calls from child classes Created 5 years, 7 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/infobars/translate_infobar.cc
diff --git a/chrome/browser/ui/android/infobars/translate_infobar.cc b/chrome/browser/ui/android/infobars/translate_infobar.cc
index d287757448286d8d325ffb7e8be2adb3d2285b03..f4cdf4411cde2c7d97b8f6370b3e99aa022bbf1c 100644
--- a/chrome/browser/ui/android/infobars/translate_infobar.cc
+++ b/chrome/browser/ui/android/infobars/translate_infobar.cc
@@ -104,9 +104,11 @@ void TranslateInfoBar::ApplyTranslateOptions(JNIEnv* env,
void TranslateInfoBar::TransferOwnership(TranslateInfoBar* destination,
translate::TranslateStep new_type) {
JNIEnv* env = base::android::AttachCurrentThread();
- if (Java_TranslateInfoBarDelegate_changeTranslateInfoBarTypeAndPointer(
- env, java_translate_delegate_.obj(),
- reinterpret_cast<intptr_t>(destination), new_type)) {
+ if (destination != nullptr &&
David Trainor- moved to gerrit 2015/06/02 17:51:55 If destination is null, should we just drop owners
Changwan Ryu 2015/06/03 04:55:41 Removed the check as it cannot be null.
+ Java_TranslateInfoBarDelegate_changeTranslateInfoBarTypeAndPointer(
+ env, java_translate_delegate_.obj(),
+ reinterpret_cast<intptr_t>(destination->infobar_android()),
+ reinterpret_cast<intptr_t>(destination), new_type)) {
ReassignJavaInfoBar(destination);
destination->SetJavaDelegate(java_translate_delegate_.Release());
}

Powered by Google App Engine
This is Rietveld 408576698