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

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

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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>
8
7 #include "base/callback.h" 9 #include "base/callback.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "chrome/browser/ui/autofill/credit_card_scanner_view.h" 15 #include "chrome/browser/ui/autofill/credit_card_scanner_view.h"
15 #include "chrome/browser/ui/autofill/credit_card_scanner_view_delegate.h" 16 #include "chrome/browser/ui/autofill/credit_card_scanner_view_delegate.h"
16 #include "components/autofill/core/browser/autofill_metrics.h" 17 #include "components/autofill/core/browser/autofill_metrics.h"
17 18
18 namespace autofill { 19 namespace autofill {
19 20
20 namespace { 21 namespace {
(...skipping 30 matching lines...) Expand all
51 void ScanCompleted(const base::string16& card_number, 52 void ScanCompleted(const base::string16& card_number,
52 int expiration_month, 53 int expiration_month,
53 int expiration_year) override { 54 int expiration_year) override {
54 AutofillMetrics::LogScanCreditCardCompleted( 55 AutofillMetrics::LogScanCreditCardCompleted(
55 base::TimeTicks::Now() - show_time_, true); 56 base::TimeTicks::Now() - show_time_, true);
56 callback_.Run(card_number, expiration_month, expiration_year); 57 callback_.Run(card_number, expiration_month, expiration_year);
57 delete this; 58 delete this;
58 } 59 }
59 60
60 // The view for the credit card scanner. 61 // The view for the credit card scanner.
61 scoped_ptr<CreditCardScannerView> view_; 62 std::unique_ptr<CreditCardScannerView> view_;
62 63
63 // The callback to be invoked when scanning completes successfully. 64 // The callback to be invoked when scanning completes successfully.
64 AutofillClient::CreditCardScanCallback callback_; 65 AutofillClient::CreditCardScanCallback callback_;
65 66
66 // The time when the UI was shown. 67 // The time when the UI was shown.
67 base::TimeTicks show_time_; 68 base::TimeTicks show_time_;
68 69
69 DISALLOW_COPY_AND_ASSIGN(Controller); 70 DISALLOW_COPY_AND_ASSIGN(Controller);
70 }; 71 };
71 72
72 } // namespace 73 } // namespace
73 74
74 // static 75 // static
75 bool CreditCardScannerController::HasCreditCardScanFeature() { 76 bool CreditCardScannerController::HasCreditCardScanFeature() {
76 static const bool kCanShow = CreditCardScannerView::CanShow(); 77 static const bool kCanShow = CreditCardScannerView::CanShow();
77 return kCanShow; 78 return kCanShow;
78 } 79 }
79 80
80 // static 81 // static
81 void CreditCardScannerController::ScanCreditCard( 82 void CreditCardScannerController::ScanCreditCard(
82 content::WebContents* web_contents, 83 content::WebContents* web_contents,
83 const AutofillClient::CreditCardScanCallback& callback) { 84 const AutofillClient::CreditCardScanCallback& callback) {
84 (new Controller(web_contents, callback))->Show(); 85 (new Controller(web_contents, callback))->Show();
85 } 86 }
86 87
87 } // namespace autofill 88 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/country_combobox_model_unittest.cc ('k') | chrome/browser/ui/autofill/credit_card_scanner_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698