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

Side by Side Diff: chrome/browser/autofill/android/phone_number_util_android.h

Issue 2743763003: [Payments] Format and validate phone number by using libphonenumber (Closed)
Patch Set: Created 3 years, 9 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
(Empty)
1 // Copyright 2017 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.
4
5 #ifndef CHROME_BROWSER_AUTOFILL_ANDROID_PHONE_NUMBER_UTIL_ANDROID_H_
6 #define CHROME_BROWSER_AUTOFILL_ANDROID_PHONE_NUMBER_UTIL_ANDROID_H_
7
8 #include "base/android/jni_weak_ref.h"
9 #include "base/android/scoped_java_ref.h"
10 #include "third_party/libphonenumber/phonenumber_api.h"
11
12 using base::android::JavaParamRef;
13 using base::android::ScopedJavaLocalRef;
14 using i18n::phonenumbers::PhoneNumberUtil;
15
16 namespace autofill {
17
18 // Android wrapper of i18n::phonenumbers::PhoneNumberUtil.
19 class PhoneNumberUtilAndroid {
20 public:
21 PhoneNumberUtilAndroid(JNIEnv* env, jobject obj);
22
23 // Formats the given number |jphone_number| by using
24 // i18n::phonenumbers::PhoneNumberUtil::Format.
25 ScopedJavaLocalRef<jstring> Format(
26 JNIEnv* env,
27 const JavaParamRef<jobject>& unused_obj,
28 const JavaParamRef<jstring>& jphone_number);
29
30 // Checks whether the given number |jphone_number| is valid by using
31 // i18n::phonenumbers::PhoneNumberUtil::IsValidNumber.
32 jboolean IsValidNumber(JNIEnv* env,
33 const JavaParamRef<jobject>& unused_obj,
34 const JavaParamRef<jstring>& jphone_number);
35
36 // Registers the JNI bindings for this class.
37 static bool Register(JNIEnv* env);
38
39 private:
40 // Pointer to the java counterpart.
41 JavaObjectWeakGlobalRef weak_java_obj_;
42
43 // Instance of i18n::phonenumbers::PhoneNumberUtil.
44 PhoneNumberUtil* phone_number_util_;
45 };
46
47 } // namespace autofill
48
49 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PHONE_NUMBER_UTIL_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698