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

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

Issue 901203003: Redo how AppBannerInfoBars are created and stored (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving init before the early return so that restored tabs also get them Created 5 years, 10 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
« no previous file with comments | « chrome/browser/ui/android/infobars/app_banner_infobar.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/android/infobars/app_banner_infobar.cc
diff --git a/chrome/browser/ui/android/infobars/app_banner_infobar.cc b/chrome/browser/ui/android/infobars/app_banner_infobar.cc
index 367586fbd58ebf0d20b3d986d522e5253cdf8db7..9e6aeac50f98667da4d3919c68951c2479f4b76e 100644
--- a/chrome/browser/ui/android/infobars/app_banner_infobar.cc
+++ b/chrome/browser/ui/android/infobars/app_banner_infobar.cc
@@ -8,7 +8,7 @@
#include "base/android/jni_string.h"
#include "base/android/scoped_java_ref.h"
#include "chrome/browser/android/banners/app_banner_infobar_delegate.h"
-#include "jni/AppBannerInfoBarDelegate_jni.h"
+#include "jni/AppBannerInfoBar_jni.h"
#include "ui/gfx/android/java_bitmap.h"
#include "ui/gfx/image/image.h"
@@ -24,33 +24,31 @@ AppBannerInfoBar::~AppBannerInfoBar() {
base::android::ScopedJavaLocalRef<jobject>
AppBannerInfoBar::CreateRenderInfoBar(JNIEnv* env) {
- java_delegate_.Reset(Java_AppBannerInfoBarDelegate_create(env));
+ ConfirmInfoBarDelegate* app_banner_infobar_delegate = GetDelegate();
- base::android::ScopedJavaLocalRef<jstring> ok_button_text =
- base::android::ConvertUTF16ToJavaString(
- env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK));
-
- ConfirmInfoBarDelegate* delegate = GetDelegate();
base::android::ScopedJavaLocalRef<jstring> app_title =
base::android::ConvertUTF16ToJavaString(
- env, delegate->GetMessageText());
+ env, app_banner_infobar_delegate->GetMessageText());
+
+ base::android::ScopedJavaLocalRef<jobject> java_bitmap;
+ if (!app_banner_infobar_delegate->GetIcon().IsEmpty()) {
+ java_bitmap = gfx::ConvertToJavaBitmap(
+ app_banner_infobar_delegate->GetIcon().ToSkBitmap());
+ }
+ base::android::ScopedJavaLocalRef<jobject> infobar;
base::android::ScopedJavaLocalRef<jstring> app_url =
base::android::ConvertUTF8ToJavaString(env, app_url_.spec());
- ScopedJavaLocalRef<jobject> java_bitmap;
- if (!delegate->GetIcon().IsEmpty()) {
- java_bitmap = gfx::ConvertToJavaBitmap(delegate->GetIcon().ToSkBitmap());
- }
-
- return Java_AppBannerInfoBarDelegate_showInfoBar(
+ infobar.Reset(Java_AppBannerInfoBar_createWebAppInfoBar(
env,
- java_delegate_.obj(),
reinterpret_cast<intptr_t>(this),
app_title.obj(),
java_bitmap.obj(),
- ok_button_text.obj(),
- app_url.obj());
+ app_url.obj()));
+
+ java_infobar_.Reset(env, infobar.obj());
+ return infobar;
}
// Native JNI methods ---------------------------------------------------------
« no previous file with comments | « chrome/browser/ui/android/infobars/app_banner_infobar.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698