OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_FLOW_INFOBAR_DELEGATE_H_ | |
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_FLOW_INFOBAR_DELEGATE_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/gtest_prod_util.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/string16.h" | |
12 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | |
13 #include "chrome/browser/autofill/autofill_manager.h" | |
14 #include "chrome/browser/autofill/autofill_metrics.h" | |
15 #include "chrome/common/form_data.h" | |
16 #include "webkit/glue/window_open_disposition.h" | |
17 | |
18 namespace content { | |
19 struct LoadCommittedDetails; | |
20 struct SSLStatus; | |
21 } | |
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 AutofillFlowInfoBarDelegate : public ConfirmInfoBarDelegate { | |
26 public: | |
27 // Creates an autofillflow infobar delegate and adds it to |infobar_service|. | |
28 static void Create(InfoBarService* infobar_service, | |
29 AutofillManager* autofill_manager, | |
30 const AutofillMetrics* metric_logger, | |
31 const GURL& source_url, | |
32 const content::SSLStatus& ssl_status); | |
33 | |
34 #if defined(UNIT_TEST) | |
35 static scoped_ptr<ConfirmInfoBarDelegate> Create( | |
Albert Bodenhamer
2013/01/14 22:10:18
It would be good to unify the 2 different Create m
Raman Kakilate
2013/01/14 23:37:46
I am being consistent with http://code.google.com/
| |
36 AutofillManager* autofill_manager, | |
37 const AutofillMetrics* metric_logger, | |
38 const GURL& source_url, | |
39 const content::SSLStatus& ssl_status) { | |
40 return scoped_ptr<ConfirmInfoBarDelegate>(new AutofillFlowInfoBarDelegate( | |
41 NULL, autofill_manager, metric_logger, source_url, ssl_status)); | |
42 } | |
43 #endif | |
44 | |
45 private: | |
46 AutofillFlowInfoBarDelegate(InfoBarService* infobar_service, | |
47 AutofillManager* autofill_manager, | |
48 const AutofillMetrics* metric_logger, | |
49 const GURL& source_url, | |
50 const content::SSLStatus& ssl_status); | |
51 | |
52 virtual ~AutofillFlowInfoBarDelegate(); | |
53 | |
54 void LogUserAction(AutofillMetrics::InfoBarMetric user_action); | |
Albert Bodenhamer
2013/01/14 22:10:18
LogUserAction makes me think that you're recording
Raman Kakilate
2013/01/14 23:37:46
Done.
| |
55 | |
56 // ConfirmInfoBarDelegate: | |
57 virtual void InfoBarDismissed() OVERRIDE; | |
58 virtual gfx::Image* GetIcon() const OVERRIDE; | |
59 virtual Type GetInfoBarType() const OVERRIDE; | |
60 virtual bool ShouldExpireInternal( | |
61 const content::LoadCommittedDetails& details) const OVERRIDE; | |
62 virtual string16 GetMessageText() const OVERRIDE; | |
63 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | |
64 virtual bool Accept() OVERRIDE; | |
65 virtual bool Cancel() OVERRIDE; | |
66 virtual string16 GetLinkText() const OVERRIDE; | |
67 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | |
68 | |
69 // For logging UMA metrics. | |
70 // Weak reference. Owned by the AutofillManager that initiated this infobar. | |
71 const AutofillMetrics* metric_logger_; | |
72 | |
73 // To callback AutofillManager's ShowAutofillFlowDialog. | |
74 AutofillManager* autofill_manager_; | |
75 | |
76 // URL of the page which triggered infobar. | |
77 GURL source_url_; | |
78 | |
79 // SSL status of the page which triggered infobar. | |
80 content::SSLStatus ssl_status_; | |
81 | |
82 // Did the user ever explicitly accept or dismiss this infobar? | |
83 bool had_user_interaction_; | |
84 | |
85 // AutofillFlow Formdata to be used. | |
86 FormData autofill_flow_form_data_; | |
87 | |
88 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillFlowInfoBar); | |
89 | |
90 DISALLOW_COPY_AND_ASSIGN(AutofillFlowInfoBarDelegate); | |
91 }; | |
92 | |
93 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_FLOW_INFOBAR_DELEGATE_H_ | |
OLD | NEW |