Chromium Code Reviews| Index: chrome/browser/ui/webui/webapk_info_callback.h |
| diff --git a/chrome/browser/ui/webui/webapk_info_callback.h b/chrome/browser/ui/webui/webapk_info_callback.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..38fce7db3c3d2017548ee2b19b59060bfab56e0e |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/webapk_info_callback.h |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
|
hartmanng
2017/01/13 15:40:21
s/2016/2017/
gonzalon
2017/01/13 20:24:39
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_WEBUI_WEBAPK_INFO_CALLBACK_H_ |
| +#define CHROME_BROWSER_UI_WEBUI_WEBAPK_INFO_CALLBACK_H_ |
| + |
| +#include "base/android/jni_weak_ref.h" |
| +#include "base/android/scoped_java_ref.h" |
| +#include "base/callback.h" |
| + |
| +// A callback wrapper for fetching information regarding the Web APKs installed |
|
hartmanng
2017/01/13 15:40:21
s/Web APKs/WebAPKs/
gonzalon
2017/01/13 20:24:39
Done.
|
| +// on the Android device. |
| +class WebapkInfoCallback { |
| + public: |
| + explicit WebapkInfoCallback( |
| + const base::RepeatingCallback<void(std::string, std::string, int, int)>& |
| + callback); |
| + ~WebapkInfoCallback(); |
| + |
| + // Destroys this object. |
| + void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| + |
| + // Called by Java code with information about a Web APK. It will be called |
| + // once for each one installed in the device. |
| + void OnWebApkFound(JNIEnv* env, |
| + const base::android::JavaParamRef<jobject>& obj, |
| + const base::android::JavaParamRef<jstring>& name, |
| + const base::android::JavaParamRef<jstring>& package_name, |
| + const jint j_shell_apk_version, |
| + const jint j_version_code) const; |
| + |
| + // The Java counterpart of this object. |
| + const base::android::ScopedJavaGlobalRef<jobject>& j_webapk_info_callback() |
| + const { |
| + return j_webapk_info_callback_; |
| + } |
| + |
| + // JNI registration. |
| + static bool Register(JNIEnv* env); |
| + |
| + private: |
| + // The wrapped native filter. |
| + base::RepeatingCallback<void(std::string, std::string, int, int)> callback_; |
| + |
| + // The Java counterpart of this C++ object. |
| + base::android::ScopedJavaGlobalRef<jobject> j_webapk_info_callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebapkInfoCallback); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_WEBUI_WEBAPK_INFO_CALLBACK_H_ |