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

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

Issue 2026353002: [Autofill] Credit Card Assist Infobar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleaning Created 4 years, 4 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/autofill_credit_card_filling_infobar.cc
diff --git a/chrome/browser/ui/android/infobars/autofill_credit_card_filling_infobar.cc b/chrome/browser/ui/android/infobars/autofill_credit_card_filling_infobar.cc
new file mode 100644
index 0000000000000000000000000000000000000000..47c5b2746070b450a9b07daf5b540cbba3318568
--- /dev/null
+++ b/chrome/browser/ui/android/infobars/autofill_credit_card_filling_infobar.cc
@@ -0,0 +1,61 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/android/infobars/autofill_credit_card_filling_infobar.h"
+
+#include <utility>
+
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+#include "base/memory/ptr_util.h"
+#include "chrome/browser/android/resource_mapper.h"
+#include "chrome/browser/infobars/infobar_service.h"
+#include "components/autofill/core/browser/autofill_credit_card_filling_infobar_delegate_mobile.h"
+#include "jni/AutofillCreditCardFillingInfoBar_jni.h"
+#include "ui/gfx/android/java_bitmap.h"
+#include "ui/gfx/image/image.h"
+#include "url/gurl.h"
+
+AutofillCreditCardFillingInfoBar::AutofillCreditCardFillingInfoBar(
+ std::unique_ptr<autofill::AutofillCreditCardFillingInfoBarDelegateMobile>
+ delegate)
+ : ConfirmInfoBar(std::move(delegate)) {}
+
+AutofillCreditCardFillingInfoBar::~AutofillCreditCardFillingInfoBar() {}
+
+base::android::ScopedJavaLocalRef<jobject>
+AutofillCreditCardFillingInfoBar::CreateRenderInfoBar(JNIEnv* env) {
+ autofill::AutofillCreditCardFillingInfoBarDelegateMobile* delegate =
+ static_cast<autofill::AutofillCreditCardFillingInfoBarDelegateMobile*>(
+ GetDelegate());
+ ScopedJavaLocalRef<jobject> java_bitmap;
+ if (delegate->GetIconId() == infobars::InfoBarDelegate::kNoIconID &&
+ !delegate->GetIcon().IsEmpty()) {
+ java_bitmap = gfx::ConvertToJavaBitmap(delegate->GetIcon().ToSkBitmap());
+ }
+
+ base::android::ScopedJavaLocalRef<jobject> java_delegate =
+ Java_AutofillCreditCardFillingInfoBar_create(
+ env, reinterpret_cast<intptr_t>(this), GetEnumeratedIconId(),
+ java_bitmap.obj(),
+ base::android::ConvertUTF16ToJavaString(
+ env, delegate->GetMessageText())
+ .obj(),
+ base::android::ConvertUTF16ToJavaString(
+ env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK))
+ .obj(),
+ base::android::ConvertUTF16ToJavaString(
+ env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_CANCEL))
+ .obj());
+
+ Java_AutofillCreditCardFillingInfoBar_addDetail(
+ env, java_delegate.obj(),
+ ResourceMapper::MapFromChromiumId(delegate->issuer_icon_id()),
+ base::android::ConvertUTF16ToJavaString(env, delegate->card_label())
+ .obj(),
+ base::android::ConvertUTF16ToJavaString(env, delegate->card_sub_label())
+ .obj());
+
+ return java_delegate;
+}

Powered by Google App Engine
This is Rietveld 408576698