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

Side by Side Diff: chrome/browser/ui/autofill/credit_card_scanner_controller.cc

Issue 2249773002: Scan card holder name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass CreditCard, don't alter the constructor. Created 4 years, 4 months 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 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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698