| 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 #ifndef CHROME_BROWSER_UI_AUTOFILL_CREDIT_CARD_SCANNER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_CREDIT_CARD_SCANNER_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_AUTOFILL_CREDIT_CARD_SCANNER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_CREDIT_CARD_SCANNER_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include <memory> |
| 9 |
| 9 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 10 | 11 |
| 11 namespace content { | 12 namespace content { |
| 12 class WebContents; | 13 class WebContents; |
| 13 } | 14 } |
| 14 | 15 |
| 15 namespace autofill { | 16 namespace autofill { |
| 16 | 17 |
| 17 class CreditCardScannerViewDelegate; | 18 class CreditCardScannerViewDelegate; |
| 18 | 19 |
| 19 // View for the credit card scanner UI. Owned by the controller. | 20 // View for the credit card scanner UI. Owned by the controller. |
| 20 class CreditCardScannerView { | 21 class CreditCardScannerView { |
| 21 public: | 22 public: |
| 22 // Returns true if the platform implements the credit card scanner UI and the | 23 // Returns true if the platform implements the credit card scanner UI and the |
| 23 // device supports scanning credit cards, e.g., it has a camera. | 24 // device supports scanning credit cards, e.g., it has a camera. |
| 24 static bool CanShow(); | 25 static bool CanShow(); |
| 25 | 26 |
| 26 // Creates a view for the credit card scanner UI. The view is associated with | 27 // Creates a view for the credit card scanner UI. The view is associated with |
| 27 // the |web_contents| and notifies the |delegate| when a scan is cancelled or | 28 // the |web_contents| and notifies the |delegate| when a scan is cancelled or |
| 28 // completed. Should be called only if CanShow() returns true. | 29 // completed. Should be called only if CanShow() returns true. |
| 29 static scoped_ptr<CreditCardScannerView> Create( | 30 static std::unique_ptr<CreditCardScannerView> Create( |
| 30 const base::WeakPtr<CreditCardScannerViewDelegate>& delegate, | 31 const base::WeakPtr<CreditCardScannerViewDelegate>& delegate, |
| 31 content::WebContents* web_contents); | 32 content::WebContents* web_contents); |
| 32 | 33 |
| 33 virtual ~CreditCardScannerView() {} | 34 virtual ~CreditCardScannerView() {} |
| 34 | 35 |
| 35 // Shows the UI for scanning credit cards. | 36 // Shows the UI for scanning credit cards. |
| 36 virtual void Show() = 0; | 37 virtual void Show() = 0; |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 } // namespace autofill | 40 } // namespace autofill |
| 40 | 41 |
| 41 #endif // CHROME_BROWSER_UI_AUTOFILL_CREDIT_CARD_SCANNER_VIEW_H_ | 42 #endif // CHROME_BROWSER_UI_AUTOFILL_CREDIT_CARD_SCANNER_VIEW_H_ |
| OLD | NEW |