| 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..546dd34630e1521ab8bd497fe19147551705eba6
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/webui/webapk_info_callback.h
|
| @@ -0,0 +1,50 @@
|
| +// 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_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 WebAPKs installed
|
| +// 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);
|
| +
|
| + // Fetches a list of the WebAPKs installed in the device, including their
|
| + // package name and version info.
|
| + void MakeInfoRequest(JNIEnv* env);
|
| +
|
| + // Called by Java code with information about a WebAPK. 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;
|
| +
|
| + // 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_
|
|
|