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

Side by Side Diff: components/autofill/core/browser/autofill_cc_infobar_delegate.h

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: Initial draft 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "components/autofill/core/browser/autofill_metrics.h" 13 #include "components/autofill/core/browser/autofill_metrics.h"
14 #include "components/infobars/core/confirm_infobar_delegate.h" 14 #include "components/infobars/core/confirm_infobar_delegate.h"
15 #include "ui/base/window_open_disposition.h" 15 #include "ui/base/window_open_disposition.h"
16 16
17 namespace base {
18 class DictionaryValue;
19 }
20
17 namespace infobars { 21 namespace infobars {
18 class InfoBarManager; 22 class InfoBarManager;
19 } 23 }
20 24
21 namespace autofill { 25 namespace autofill {
22 26
27 class CreditCard;
28
23 // An InfoBar delegate that enables the user to allow or deny storing credit 29 // An InfoBar delegate that enables the user to allow or deny storing credit
24 // card information gathered from a form submission. 30 // card information gathered from a form submission.
25 class AutofillCCInfoBarDelegate : public ConfirmInfoBarDelegate { 31 class AutofillCCInfoBarDelegate : public ConfirmInfoBarDelegate {
26 public: 32 public:
27 // Creates an autofill credit card infobar and delegate and adds the infobar 33 // Creates an autofill credit card infobar and delegate and adds the infobar
28 // to |infobar_manager|. 34 // to |infobar_manager|.
29 static void CreateForLocalSave(infobars::InfoBarManager* infobar_manager, 35 static void CreateForLocalSave(infobars::InfoBarManager* infobar_manager,
30 const base::Closure& save_card_callback); 36 const base::Closure& save_card_callback,
Justin Donnelly 2015/12/30 18:06:37 Likewise I think we should maintain the callback a
please use gerrit instead 2016/01/07 01:39:25 Done.
37 const CreditCard& card);
31 static void CreateForUpload(infobars::InfoBarManager* infobar_manager, 38 static void CreateForUpload(infobars::InfoBarManager* infobar_manager,
32 const base::Closure& save_card_callback); 39 const base::Closure& save_card_callback,
40 const CreditCard& card,
41 scoped_ptr<base::DictionaryValue> legal_message);
33 42
34 #if defined(UNIT_TEST) 43 #if defined(UNIT_TEST)
35 static scoped_ptr<ConfirmInfoBarDelegate> Create( 44 static scoped_ptr<ConfirmInfoBarDelegate> Create(
36 const base::Closure& save_card_callback) { 45 const base::Closure& save_card_callback) {
37 return scoped_ptr<ConfirmInfoBarDelegate>( 46 return scoped_ptr<ConfirmInfoBarDelegate>(
38 new AutofillCCInfoBarDelegate(false, save_card_callback)); 47 new AutofillCCInfoBarDelegate(false, save_card_callback));
39 } 48 }
40 #endif 49 #endif
41 50
42 private: 51 private:
43 AutofillCCInfoBarDelegate(bool upload, 52 AutofillCCInfoBarDelegate(bool upload,
44 const base::Closure& save_card_callback); 53 const base::Closure& save_card_callback,
54 const CreditCard& card,
55 scoped_ptr<base::DictionaryValue> legal_message);
45 ~AutofillCCInfoBarDelegate() override; 56 ~AutofillCCInfoBarDelegate() override;
46 57
47 void LogUserAction(AutofillMetrics::InfoBarMetric user_action); 58 void LogUserAction(AutofillMetrics::InfoBarMetric user_action);
48 59
49 // ConfirmInfoBarDelegate: 60 // ConfirmInfoBarDelegate:
50 Type GetInfoBarType() const override; 61 Type GetInfoBarType() const override;
51 int GetIconId() const override; 62 int GetIconId() const override;
52 gfx::VectorIconId GetVectorIconId() const override; 63 gfx::VectorIconId GetVectorIconId() const override;
64 const std::vector<Detail>& GetDetails() const override;
65 const std::vector<Description>& GetDescriptions() const override;
53 bool ShouldExpire(const NavigationDetails& details) const override; 66 bool ShouldExpire(const NavigationDetails& details) const override;
54 void InfoBarDismissed() override; 67 void InfoBarDismissed() override;
55 base::string16 GetMessageText() const override; 68 base::string16 GetMessageText() const override;
56 base::string16 GetButtonLabel(InfoBarButton button) const override; 69 base::string16 GetButtonLabel(InfoBarButton button) const override;
57 bool Accept() override; 70 bool Accept() override;
58 bool Cancel() override; 71 bool Cancel() override;
59 base::string16 GetLinkText() const override; 72 base::string16 GetLinkText() const override;
60 GURL GetLinkURL() const override; 73 GURL GetLinkURL() const override;
61 74
75 // Whether the infobar is for uploading the credit card.
62 bool upload_; 76 bool upload_;
63 77
64 // The callback to save credit card if the user accepts the infobar. 78 // The callback to save credit card if the user accepts the infobar.
65 base::Closure save_card_callback_; 79 base::Closure save_card_callback_;
66 80
81 // The card details to show in the content of the infobar.
82 std::vector<Detail> card_details_;
83
84 // The legal messages to show in the content of the infobar.
85 std::vector<Description> legal_messages_;
86
67 // Did the user ever explicitly accept or dismiss this infobar? 87 // Did the user ever explicitly accept or dismiss this infobar?
68 bool had_user_interaction_; 88 bool had_user_interaction_;
69 89
70 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, CreditCardInfoBar); 90 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, CreditCardInfoBar);
71 91
72 DISALLOW_COPY_AND_ASSIGN(AutofillCCInfoBarDelegate); 92 DISALLOW_COPY_AND_ASSIGN(AutofillCCInfoBarDelegate);
73 }; 93 };
74 94
75 } // namespace autofill 95 } // namespace autofill
76 96
77 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_ 97 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698