Chromium Code Reviews| 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" | |
|
Ilya Sherman
2013/01/15 06:31:52
nit: Forward-declare
Raman Kakilate
2013/01/15 23:02:33
Done.
| |
| 14 #include "chrome/browser/autofill/autofill_metrics.h" | |
| 15 #include "chrome/common/form_data.h" | |
| 16 #include "googleurl/src/gurl.h" | |
| 17 #include "webkit/glue/window_open_disposition.h" | |
|
Ilya Sherman
2013/01/15 06:31:52
nit: I'd omit this, as it's only used by a method
Raman Kakilate
2013/01/15 23:02:33
Done.
| |
| 18 | |
| 19 namespace content { | |
| 20 struct LoadCommittedDetails; | |
| 21 struct SSLStatus; | |
| 22 } | |
| 23 | |
| 24 // An InfoBar delegate that enables the user to allow or deny storing credit | |
| 25 // card information gathered from a form submission. | |
| 26 class AutofillFlowInfoBarDelegate : public ConfirmInfoBarDelegate { | |
|
Ilya Sherman
2013/01/15 06:31:52
nit: Since Alex has checked in other code that use
Raman Kakilate
2013/01/15 23:02:33
Done.
| |
| 27 public: | |
| 28 // Creates an autofillflow infobar delegate and adds it to |infobar_service|. | |
| 29 static void Create(InfoBarService* infobar_service, | |
| 30 AutofillManager* autofill_manager, | |
| 31 const AutofillMetrics* metric_logger, | |
|
Ilya Sherman
2013/01/15 06:31:52
nit: Pass by const-ref, not const-pointer.
Raman Kakilate
2013/01/15 23:02:33
I have been consistent with autofill_cc_inforbar_d
Ilya Sherman
2013/01/15 23:24:46
This isn't desirable consistency, since the style
Albert Bodenhamer
2013/01/16 01:08:26
+1 I'm not sure why it was done that way in the ot
Raman Kakilate
2013/01/16 19:20:12
probably my sloppy c++ skills at show here.
* Aut
Ilya Sherman
2013/01/17 01:21:44
The object does not need to be copyable to be pass
| |
| 32 const GURL& source_url, | |
| 33 const content::SSLStatus& ssl_status); | |
|
Ilya Sherman
2013/01/15 06:31:52
nit: Const params should precede non-const ones.
Raman Kakilate
2013/01/15 23:02:33
Done.
| |
| 34 | |
| 35 #if defined(UNIT_TEST) | |
| 36 static scoped_ptr<ConfirmInfoBarDelegate> Create( | |
| 37 AutofillManager* autofill_manager, | |
| 38 const AutofillMetrics* metric_logger, | |
| 39 const GURL& source_url, | |
| 40 const content::SSLStatus& ssl_status) { | |
| 41 return scoped_ptr<ConfirmInfoBarDelegate>(new AutofillFlowInfoBarDelegate( | |
| 42 NULL, autofill_manager, metric_logger, source_url, ssl_status)); | |
| 43 } | |
| 44 #endif | |
| 45 | |
| 46 private: | |
| 47 AutofillFlowInfoBarDelegate(InfoBarService* infobar_service, | |
| 48 AutofillManager* autofill_manager, | |
| 49 const AutofillMetrics* metric_logger, | |
| 50 const GURL& source_url, | |
| 51 const content::SSLStatus& ssl_status); | |
| 52 | |
| 53 virtual ~AutofillFlowInfoBarDelegate(); | |
| 54 | |
| 55 // Logs UMA metric for user action type. | |
| 56 void LogUserAction(AutofillMetrics::InfoBarMetric user_action); | |
| 57 | |
| 58 // ConfirmInfoBarDelegate: | |
| 59 virtual void InfoBarDismissed() OVERRIDE; | |
| 60 virtual gfx::Image* GetIcon() const OVERRIDE; | |
| 61 virtual Type GetInfoBarType() const OVERRIDE; | |
| 62 virtual bool ShouldExpireInternal( | |
| 63 const content::LoadCommittedDetails& details) const OVERRIDE; | |
| 64 virtual string16 GetMessageText() const OVERRIDE; | |
| 65 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | |
| 66 virtual bool Accept() OVERRIDE; | |
| 67 virtual bool Cancel() OVERRIDE; | |
| 68 virtual string16 GetLinkText() const OVERRIDE; | |
| 69 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | |
| 70 | |
| 71 // For logging UMA metrics. | |
| 72 // Weak reference. Owned by the AutofillManager that initiated this infobar. | |
| 73 const AutofillMetrics* metric_logger_; | |
| 74 | |
| 75 // To callback AutofillManager's ShowAutofillFlowDialog. | |
| 76 AutofillManager* autofill_manager_; | |
| 77 | |
| 78 // URL of the page which triggered infobar. | |
| 79 GURL source_url_; | |
| 80 | |
| 81 // SSL status of the page which triggered infobar. | |
| 82 content::SSLStatus ssl_status_; | |
| 83 | |
| 84 // Did the user ever explicitly accept or dismiss this infobar? | |
| 85 bool had_user_interaction_; | |
| 86 | |
| 87 // AutofillFlow Formdata to be used. | |
|
Ilya Sherman
2013/01/15 06:31:52
nit: This comment is almost completely redundant w
Raman Kakilate
2013/01/15 23:02:33
Removed.
| |
| 88 FormData autofill_flow_form_data_; | |
| 89 | |
| 90 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillFlowInfoBar); | |
| 91 | |
| 92 DISALLOW_COPY_AND_ASSIGN(AutofillFlowInfoBarDelegate); | |
| 93 }; | |
| 94 | |
| 95 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_FLOW_INFOBAR_DELEGATE_H_ | |
| OLD | NEW |