| 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 base::string16& card_holder_name, |
| 53 const base::string16& card_number, |
| 53 int expiration_month, | 54 int expiration_month, |
| 54 int expiration_year) override { | 55 int expiration_year) override { |
| 55 AutofillMetrics::LogScanCreditCardCompleted( | 56 AutofillMetrics::LogScanCreditCardCompleted( |
| 56 base::TimeTicks::Now() - show_time_, true); | 57 base::TimeTicks::Now() - show_time_, true); |
| 57 callback_.Run(card_number, expiration_month, expiration_year); | 58 callback_.Run(card_holder_name, card_number, expiration_month, |
| 59 expiration_year); |
| 58 delete this; | 60 delete this; |
| 59 } | 61 } |
| 60 | 62 |
| 61 // The view for the credit card scanner. | 63 // The view for the credit card scanner. |
| 62 std::unique_ptr<CreditCardScannerView> view_; | 64 std::unique_ptr<CreditCardScannerView> view_; |
| 63 | 65 |
| 64 // The callback to be invoked when scanning completes successfully. | 66 // The callback to be invoked when scanning completes successfully. |
| 65 AutofillClient::CreditCardScanCallback callback_; | 67 AutofillClient::CreditCardScanCallback callback_; |
| 66 | 68 |
| 67 // The time when the UI was shown. | 69 // The time when the UI was shown. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 79 } | 81 } |
| 80 | 82 |
| 81 // static | 83 // static |
| 82 void CreditCardScannerController::ScanCreditCard( | 84 void CreditCardScannerController::ScanCreditCard( |
| 83 content::WebContents* web_contents, | 85 content::WebContents* web_contents, |
| 84 const AutofillClient::CreditCardScanCallback& callback) { | 86 const AutofillClient::CreditCardScanCallback& callback) { |
| 85 (new Controller(web_contents, callback))->Show(); | 87 (new Controller(web_contents, callback))->Show(); |
| 86 } | 88 } |
| 87 | 89 |
| 88 } // namespace autofill | 90 } // namespace autofill |
| OLD | NEW |