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

Side by Side Diff: chrome/browser/ui/webui/webapk_info_callback.cc

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Adds an about:webapks page with information about all installed Web APKs on the device Created 3 years, 11 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 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.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/webapk_info_callback.h"
6
7 #include <jni.h>
8
9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h"
11 #include "jni/WebapkInfoCallback_jni.h"
12
13 using base::android::JavaParamRef;
14
15 WebapkInfoCallback::WebapkInfoCallback(
16 const base::RepeatingCallback<void(std::string, std::string, int, int)>&
17 callback)
18 : callback_(callback),
19 j_webapk_info_callback_(
20 Java_WebapkInfoCallback_create(base::android::AttachCurrentThread(),
21 reinterpret_cast<uintptr_t>(this))) {}
22
23 WebapkInfoCallback::~WebapkInfoCallback() {}
24
25 void WebapkInfoCallback::Destroy(JNIEnv* env,
26 const JavaParamRef<jobject>& obj) {
27 delete this;
28 }
29
30 void WebapkInfoCallback::OnWebApkFound(
31 JNIEnv* env,
32 const JavaParamRef<jobject>& obj,
33 const base::android::JavaParamRef<jstring>& j_name,
34 const base::android::JavaParamRef<jstring>& j_package_name,
35 const jint j_shell_apk_version,
36 const jint j_version_code) const {
37 std::string name = base::android::ConvertJavaStringToUTF8(env, j_name);
38 std::string package_name =
39 base::android::ConvertJavaStringToUTF8(env, j_package_name);
40 int shell_apk_version = static_cast<int>(j_shell_apk_version);
41 int version_code = static_cast<int>(j_version_code);
42 callback_.Run(name, package_name, shell_apk_version, version_code);
43 }
44
45 // static
46 bool WebapkInfoCallback::Register(JNIEnv* env) {
47 return RegisterNativesImpl(env);
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698