| Index: chrome/browser/autofill/android/phone_number_util_android.h
|
| diff --git a/chrome/browser/autofill/android/phone_number_util_android.h b/chrome/browser/autofill/android/phone_number_util_android.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..889556ef1dbae55ee62fbabda9212827735467e6
|
| --- /dev/null
|
| +++ b/chrome/browser/autofill/android/phone_number_util_android.h
|
| @@ -0,0 +1,49 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_AUTOFILL_ANDROID_PHONE_NUMBER_UTIL_ANDROID_H_
|
| +#define CHROME_BROWSER_AUTOFILL_ANDROID_PHONE_NUMBER_UTIL_ANDROID_H_
|
| +
|
| +#include "base/android/jni_weak_ref.h"
|
| +#include "base/android/scoped_java_ref.h"
|
| +#include "third_party/libphonenumber/phonenumber_api.h"
|
| +
|
| +using base::android::JavaParamRef;
|
| +using base::android::ScopedJavaLocalRef;
|
| +using i18n::phonenumbers::PhoneNumberUtil;
|
| +
|
| +namespace autofill {
|
| +
|
| +// Android wrapper of i18n::phonenumbers::PhoneNumberUtil.
|
| +class PhoneNumberUtilAndroid {
|
| + public:
|
| + PhoneNumberUtilAndroid(JNIEnv* env, jobject obj);
|
| +
|
| + // Formats the given number |jphone_number| by using
|
| + // i18n::phonenumbers::PhoneNumberUtil::Format.
|
| + ScopedJavaLocalRef<jstring> Format(
|
| + JNIEnv* env,
|
| + const JavaParamRef<jobject>& unused_obj,
|
| + const JavaParamRef<jstring>& jphone_number);
|
| +
|
| + // Checks whether the given number |jphone_number| is valid by using
|
| + // i18n::phonenumbers::PhoneNumberUtil::IsValidNumber.
|
| + jboolean IsValidNumber(JNIEnv* env,
|
| + const JavaParamRef<jobject>& unused_obj,
|
| + const JavaParamRef<jstring>& jphone_number);
|
| +
|
| + // Registers the JNI bindings for this class.
|
| + static bool Register(JNIEnv* env);
|
| +
|
| + private:
|
| + // Pointer to the java counterpart.
|
| + JavaObjectWeakGlobalRef weak_java_obj_;
|
| +
|
| + // Instance of i18n::phonenumbers::PhoneNumberUtil.
|
| + PhoneNumberUtil* phone_number_util_;
|
| +};
|
| +
|
| +} // namespace autofill
|
| +
|
| +#endif // CHROME_BROWSER_AUTOFILL_ANDROID_PHONE_NUMBER_UTIL_ANDROID_H_
|
|
|