OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h" | 5 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 ~Controller() override {} | 42 ~Controller() override {} |
43 | 43 |
44 // CreditCardScannerViewDelegate implementation. | 44 // CreditCardScannerViewDelegate implementation. |
45 void ScanCancelled() override { | 45 void ScanCancelled() override { |
46 AutofillMetrics::LogScanCreditCardCompleted( | 46 AutofillMetrics::LogScanCreditCardCompleted( |
47 base::TimeTicks::Now() - show_time_, false); | 47 base::TimeTicks::Now() - show_time_, false); |
48 delete this; | 48 delete this; |
49 } | 49 } |
50 | 50 |
51 // CreditCardScannerViewDelegate implementation. | 51 // CreditCardScannerViewDelegate implementation. |
52 void ScanCompleted(const base::string16& card_number, | 52 void ScanCompleted(const CreditCard& card) override { |
53 int expiration_month, | |
54 int expiration_year) override { | |
55 AutofillMetrics::LogScanCreditCardCompleted( | 53 AutofillMetrics::LogScanCreditCardCompleted( |
56 base::TimeTicks::Now() - show_time_, true); | 54 base::TimeTicks::Now() - show_time_, true); |
57 callback_.Run(card_number, expiration_month, expiration_year); | 55 callback_.Run(card); |
58 delete this; | 56 delete this; |
59 } | 57 } |
60 | 58 |
61 // The view for the credit card scanner. | 59 // The view for the credit card scanner. |
62 std::unique_ptr<CreditCardScannerView> view_; | 60 std::unique_ptr<CreditCardScannerView> view_; |
63 | 61 |
64 // The callback to be invoked when scanning completes successfully. | 62 // The callback to be invoked when scanning completes successfully. |
65 AutofillClient::CreditCardScanCallback callback_; | 63 AutofillClient::CreditCardScanCallback callback_; |
66 | 64 |
67 // The time when the UI was shown. | 65 // The time when the UI was shown. |
(...skipping 11 matching lines...) Expand all Loading... |
79 } | 77 } |
80 | 78 |
81 // static | 79 // static |
82 void CreditCardScannerController::ScanCreditCard( | 80 void CreditCardScannerController::ScanCreditCard( |
83 content::WebContents* web_contents, | 81 content::WebContents* web_contents, |
84 const AutofillClient::CreditCardScanCallback& callback) { | 82 const AutofillClient::CreditCardScanCallback& callback) { |
85 (new Controller(web_contents, callback))->Show(); | 83 (new Controller(web_contents, callback))->Show(); |
86 } | 84 } |
87 | 85 |
88 } // namespace autofill | 86 } // namespace autofill |
OLD | NEW |