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

Unified Diff: components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.cc

Issue 1540423004: Add card details and legal message to Android save credit card infobar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android 64-bit compile. Created 4 years, 11 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: components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.cc
diff --git a/components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.cc b/components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bcb39f91950bb6a3588f07f7207a95db6b074009
--- /dev/null
+++ b/components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.cc
@@ -0,0 +1,49 @@
+// 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 "components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.h"
+
+#include <utility>
+
+#include "base/strings/utf_string_conversions.h"
+#include "base/values.h"
+#include "components/autofill/core/browser/credit_card.h"
+#include "components/autofill/core/browser/legal_message_line.h"
+#include "components/infobars/core/infobar.h"
+#include "components/infobars/core/infobar_manager.h"
+#include "ui/base/window_open_disposition.h"
+#include "url/gurl.h"
+
+namespace autofill {
+
+AutofillSaveCardInfoBarDelegateMobile::AutofillSaveCardInfoBarDelegateMobile(
+ bool upload,
+ const CreditCard& card,
+ scoped_ptr<base::DictionaryValue> legal_message,
+ const base::Closure& save_card_callback)
+ : AutofillCCInfoBarDelegate(upload, save_card_callback),
+#if defined(OS_IOS)
+ // TODO(jdonnelly): Use credit card issuer images on iOS.
+ // http://crbug.com/535784
+ issuer_icon_id_(kNoIconID),
+#else
+ issuer_icon_id_(CreditCard::IconResourceId(
+ CreditCard::GetCreditCardType(card.GetRawInfo(CREDIT_CARD_NUMBER)))),
+#endif // defined(OS_IOS)
Justin Donnelly 2016/01/14 18:32:10 I think this comment is harming more than it helps
please use gerrit instead 2016/01/14 18:48:43 Done.
+ // Prepend the midline horizontal ellipsis (U+22EF).
+ card_label_(base::UTF8ToUTF16("\xE2\x8B\xAF") + card.LastFourDigits()),
+ card_sub_label_(card.AbbreviatedExpirationDateForDisplay()) {
+ if (legal_message)
+ LegalMessageLine::Parse(*legal_message, &legal_messages_);
+}
+
+AutofillSaveCardInfoBarDelegateMobile::
+ ~AutofillSaveCardInfoBarDelegateMobile() {}
+
+void AutofillSaveCardInfoBarDelegateMobile::OnLegalMessageLinkClicked(
+ GURL url) {
+ infobar()->owner()->OpenURL(url, NEW_FOREGROUND_TAB);
+}
+
+} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698