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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_ANDROID_AUTOFILL_CREDIT_CARD_SCANNER_VIEW_ANDROID_H_
6 #define CHROME_BROWSER_UI_ANDROID_AUTOFILL_CREDIT_CARD_SCANNER_VIEW_ANDROID_H_
10 #include "base/android/scoped_java_ref.h"
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/ui/autofill/credit_card_scanner_view.h"
21 class CreditCardScannerViewDelegate
;
23 // Android implementation of the view for credit card scanner UI. Uses Android
24 // APIs through JNI service.
25 class CreditCardScannerViewAndroid
: public CreditCardScannerView
{
27 // Registers with JNI services.
28 static bool Register(JNIEnv
* env
);
30 CreditCardScannerViewAndroid(
31 const base::WeakPtr
<CreditCardScannerViewDelegate
>& delegate
,
32 content::WebContents
* web_contents
);
33 ~CreditCardScannerViewAndroid() override
;
35 // Called by JNI when user cancelled credit card scan.
36 void ScanCancelled(JNIEnv
* env
, jobject object
);
38 // Called by JNI when credit card scan completed successfully.
39 void ScanCompleted(JNIEnv
* env
,
42 jint expiration_month
,
43 jint expiration_year
);
45 // CreditCardScannerView implementation.
48 // The object to be notified when scanning was cancelled or completed.
49 base::WeakPtr
<CreditCardScannerViewDelegate
> delegate_
;
51 // The corresponding Java object that uses Android APIs for scanning.
52 base::android::ScopedJavaGlobalRef
<jobject
> java_object_
;
54 DISALLOW_COPY_AND_ASSIGN(CreditCardScannerViewAndroid
);
57 } // namespace autofill
59 #endif // CHROME_BROWSER_UI_ANDROID_AUTOFILL_CREDIT_CARD_SCANNER_VIEW_ANDROID_H_