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

Side by Side Diff: chrome/browser/autofill/autofill_cc_infobar_delegate.h

Issue 780423002: Don't deref stale AutofillMetrics pointer in AutofillCCInfoBarDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_CC_INFOBAR_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_CC_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_CC_INFOBAR_DELEGATE_H_ 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_CC_INFOBAR_DELEGATE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 26 matching lines...) Expand all
37 return scoped_ptr<ConfirmInfoBarDelegate>( 37 return scoped_ptr<ConfirmInfoBarDelegate>(
38 new AutofillCCInfoBarDelegate(metric_logger, save_card_callback)); 38 new AutofillCCInfoBarDelegate(metric_logger, save_card_callback));
39 } 39 }
40 #endif 40 #endif
41 41
42 private: 42 private:
43 AutofillCCInfoBarDelegate(const AutofillMetrics* metric_logger, 43 AutofillCCInfoBarDelegate(const AutofillMetrics* metric_logger,
44 const base::Closure& save_card_callback); 44 const base::Closure& save_card_callback);
45 ~AutofillCCInfoBarDelegate() override; 45 ~AutofillCCInfoBarDelegate() override;
46 46
47 void LogUserAction(AutofillMetrics::InfoBarMetric user_action);
48
49 // ConfirmInfoBarDelegate: 47 // ConfirmInfoBarDelegate:
50 void InfoBarDismissed() override; 48 void InfoBarDismissed() override;
51 int GetIconID() const override; 49 int GetIconID() const override;
52 Type GetInfoBarType() const override; 50 Type GetInfoBarType() const override;
53 bool ShouldExpireInternal(const NavigationDetails& details) const override; 51 bool ShouldExpireInternal(const NavigationDetails& details) const override;
54 base::string16 GetMessageText() const override; 52 base::string16 GetMessageText() const override;
55 base::string16 GetButtonLabel(InfoBarButton button) const override; 53 base::string16 GetButtonLabel(InfoBarButton button) const override;
56 bool Accept() override; 54 bool Accept() override;
57 bool Cancel() override; 55 bool Cancel() override;
58 base::string16 GetLinkText() const override; 56 base::string16 GetLinkText() const override;
59 bool LinkClicked(WindowOpenDisposition disposition) override; 57 bool LinkClicked(WindowOpenDisposition disposition) override;
60 58
61 // For logging UMA metrics. 59 // For logging UMA metrics.
62 // Weak reference. Owned by the AutofillManager that initiated this infobar. 60 // Weak reference. Owned by the AutofillManager that initiated this infobar.
61 // May be stale during shutdown!
63 const AutofillMetrics* metric_logger_; 62 const AutofillMetrics* metric_logger_;
64 63
65 // The callback to save credit card if the user accepts the infobar. 64 // The callback to save credit card if the user accepts the infobar.
66 base::Closure save_card_callback_; 65 base::Closure save_card_callback_;
67 66
68 // Did the user ever explicitly accept or dismiss this infobar? 67 // Did the user ever explicitly accept or dismiss this infobar?
69 bool had_user_interaction_; 68 bool had_user_interaction_;
70 69
71 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, CreditCardInfoBar); 70 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, CreditCardInfoBar);
72 71
73 DISALLOW_COPY_AND_ASSIGN(AutofillCCInfoBarDelegate); 72 DISALLOW_COPY_AND_ASSIGN(AutofillCCInfoBarDelegate);
74 }; 73 };
75 74
76 } // namespace autofill 75 } // namespace autofill
77 76
78 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_CC_INFOBAR_DELEGATE_H_ 77 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_CC_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698