Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_CC_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_WALLET_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_CC_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_AUTOFILL_WALLET_INFOBAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 12 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| 13 #include "chrome/browser/autofill/autofill_manager.h" | |
| 13 #include "chrome/browser/autofill/autofill_metrics.h" | 14 #include "chrome/browser/autofill/autofill_metrics.h" |
| 15 #include "chrome/common/form_data.h" | |
| 14 #include "webkit/glue/window_open_disposition.h" | 16 #include "webkit/glue/window_open_disposition.h" |
| 15 | 17 |
| 16 class CreditCard; | |
| 17 class PersonalDataManager; | 18 class PersonalDataManager; |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 struct LoadCommittedDetails; | 21 struct LoadCommittedDetails; |
| 22 struct SSLStatus; | |
| 21 } | 23 } |
| 22 | 24 |
| 23 // An InfoBar delegate that enables the user to allow or deny storing credit | 25 // An InfoBar delegate that enables the user to allow or deny storing credit |
| 24 // card information gathered from a form submission. | 26 // card information gathered from a form submission. |
| 25 class AutofillCCInfoBarDelegate : public ConfirmInfoBarDelegate { | 27 class WalletInfoBarDelegate : public ConfirmInfoBarDelegate { |
|
Ilya Sherman
2012/12/13 02:29:23
This infobar is not specific to Wallet. The flow
Raman Kakilate
2012/12/13 21:34:34
This infobar assumes the kind of data it needs fro
Ilya Sherman
2012/12/13 23:23:18
I don't see anything in the data that is tied to W
Raman Kakilate
2013/01/10 00:54:40
Renamed it to AutofillFlowInfoBarDelegate as discu
| |
| 26 public: | 28 public: |
| 27 AutofillCCInfoBarDelegate(InfoBarService* infobar_service, | 29 WalletInfoBarDelegate(InfoBarService* infobar_service, |
| 28 const CreditCard* credit_card, | 30 PersonalDataManager* personal_data, |
| 29 PersonalDataManager* personal_data, | 31 AutofillManager* autofill_mgr, |
| 30 const AutofillMetrics* metric_logger); | 32 const AutofillMetrics* metric_logger, |
| 33 const GURL& source_url, | |
| 34 const content::SSLStatus& ssl_status); | |
| 31 | 35 |
| 32 private: | 36 private: |
| 33 virtual ~AutofillCCInfoBarDelegate(); | 37 virtual ~WalletInfoBarDelegate(); |
| 34 | 38 |
| 35 void LogUserAction(AutofillMetrics::InfoBarMetric user_action); | 39 void LogUserAction(AutofillMetrics::InfoBarMetric user_action); |
| 36 | 40 |
| 37 // ConfirmInfoBarDelegate: | 41 // ConfirmInfoBarDelegate: |
| 38 virtual bool ShouldExpire( | 42 virtual bool ShouldExpire( |
| 39 const content::LoadCommittedDetails& details) const OVERRIDE; | 43 const content::LoadCommittedDetails& details) const OVERRIDE; |
| 40 virtual void InfoBarDismissed() OVERRIDE; | 44 virtual void InfoBarDismissed() OVERRIDE; |
| 41 virtual gfx::Image* GetIcon() const OVERRIDE; | 45 virtual gfx::Image* GetIcon() const OVERRIDE; |
| 42 virtual Type GetInfoBarType() const OVERRIDE; | 46 virtual Type GetInfoBarType() const OVERRIDE; |
| 43 virtual string16 GetMessageText() const OVERRIDE; | 47 virtual string16 GetMessageText() const OVERRIDE; |
| 44 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 48 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 45 virtual bool Accept() OVERRIDE; | 49 virtual bool Accept() OVERRIDE; |
| 46 virtual bool Cancel() OVERRIDE; | 50 virtual bool Cancel() OVERRIDE; |
| 47 virtual string16 GetLinkText() const OVERRIDE; | 51 virtual string16 GetLinkText() const OVERRIDE; |
| 48 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | 52 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
| 49 | 53 |
| 50 // The credit card that should be saved if the user accepts the infobar. | |
| 51 scoped_ptr<const CreditCard> credit_card_; | |
| 52 | |
| 53 // The personal data manager to which the credit card should be saved. | 54 // The personal data manager to which the credit card should be saved. |
| 54 // Weak reference. | 55 // Weak reference. |
| 55 PersonalDataManager* personal_data_; | 56 PersonalDataManager* personal_data_; |
|
Ilya Sherman
2012/12/13 02:29:23
Why do you need the PDM?
Raman Kakilate
2012/12/13 21:34:34
No I don't yet, removed.
| |
| 56 | 57 |
| 57 // For logging UMA metrics. | 58 // For logging UMA metrics. |
| 58 // Weak reference. Owned by the AutofillManager that initiated this infobar. | 59 // Weak reference. Owned by the AutofillManager that initiated this infobar. |
| 59 const AutofillMetrics* metric_logger_; | 60 const AutofillMetrics* metric_logger_; |
| 60 | 61 |
| 62 // To callback AutofillManager's ShowWalletDialog. | |
| 63 AutofillManager* autofill_mgr_; | |
|
Ilya Sherman
2012/12/13 02:29:23
nit: Please spell out "manager"
Raman Kakilate
2012/12/13 21:34:34
Done.
| |
| 64 | |
| 65 // URL of the page which triggered infobar. | |
| 66 GURL source_url_; | |
| 67 | |
| 68 // SSL status of the page which triggered infobar. | |
| 69 content::SSLStatus ssl_status_; | |
| 70 | |
| 61 // Did the user ever explicitly accept or dismiss this infobar? | 71 // Did the user ever explicitly accept or dismiss this infobar? |
| 62 bool had_user_interaction_; | 72 bool had_user_interaction_; |
| 63 | 73 |
| 64 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, CreditCardInfoBar); | 74 DISALLOW_COPY_AND_ASSIGN(WalletInfoBarDelegate); |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(AutofillCCInfoBarDelegate); | |
| 67 }; | 75 }; |
| 68 | 76 |
| 69 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_CC_INFOBAR_DELEGATE_H_ | 77 #endif // CHROME_BROWSER_AUTOFILL_WALLET_INFOBAR_DELEGATE_H_ |
| OLD | NEW |