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

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

Issue 1780443002: Cleanup: roll AutofillCCInfoBarDelegate into AutofillSaveCardInfoBarDelegateMobile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pay_mac_bubble_default
Patch Set: Make overriden methods public. Created 4 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_
7
8 #include "base/callback.h"
9 #include "base/gtest_prod_util.h"
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h"
13 #include "components/autofill/core/browser/autofill_metrics.h"
14 #include "components/infobars/core/confirm_infobar_delegate.h"
15 #include "ui/base/window_open_disposition.h"
16
17 namespace infobars {
18 class InfoBarManager;
19 }
20
21 namespace autofill {
22
23 // An InfoBar delegate that enables the user to allow or deny storing credit
24 // card information gathered from a form submission.
25 class AutofillCCInfoBarDelegate : public ConfirmInfoBarDelegate {
26 public:
27 // Creates an autofill credit card infobar and delegate and adds the infobar
28 // to |infobar_manager|.
29 static void CreateForLocalSave(infobars::InfoBarManager* infobar_manager,
30 const base::Closure& save_card_callback);
31 static void CreateForUpload(infobars::InfoBarManager* infobar_manager,
32 const base::Closure& save_card_callback);
33
34 #if defined(UNIT_TEST)
35 static scoped_ptr<ConfirmInfoBarDelegate> Create(
36 const base::Closure& save_card_callback) {
37 return scoped_ptr<ConfirmInfoBarDelegate>(
38 new AutofillCCInfoBarDelegate(false, save_card_callback));
39 }
40 #endif
41
42 ~AutofillCCInfoBarDelegate() override;
43
44 // ConfirmInfoBarDelegate:
45 int GetIconId() const override;
46 base::string16 GetMessageText() const override;
47 base::string16 GetLinkText() const override;
48
49 protected:
50 AutofillCCInfoBarDelegate(bool upload,
51 const base::Closure& save_card_callback);
52
53 private:
54 void LogUserAction(AutofillMetrics::InfoBarMetric user_action);
55
56 // ConfirmInfoBarDelegate:
57 Type GetInfoBarType() const override;
58 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
59 gfx::VectorIconId GetVectorIconId() const override;
60 bool ShouldExpire(const NavigationDetails& details) const override;
61 void InfoBarDismissed() override;
62 base::string16 GetButtonLabel(InfoBarButton button) const override;
63 bool Accept() override;
64 bool Cancel() override;
65 GURL GetLinkURL() const override;
66
67 bool upload_;
68
69 // The callback to save credit card if the user accepts the infobar.
70 base::Closure save_card_callback_;
71
72 // Did the user ever explicitly accept or dismiss this infobar?
73 bool had_user_interaction_;
74
75 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, CreditCardInfoBar);
76
77 DISALLOW_COPY_AND_ASSIGN(AutofillCCInfoBarDelegate);
78 };
79
80 } // namespace autofill
81
82 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_CC_INFOBAR_DELEGATE_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/BUILD.gn ('k') | components/autofill/core/browser/autofill_cc_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698