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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java

Issue 2714633003: Adds more metadata to the about:webapks page (Closed)
Patch Set: Adds more metadata to the about:webapks page 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
« no previous file with comments | « no previous file | chrome/browser/android/shortcut_helper.cc » ('j') | ui/gfx/color_utils.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.app.ActivityManager; 7 import android.app.ActivityManager;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.pm.ApplicationInfo; 10 import android.content.pm.ApplicationInfo;
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 return null; 664 return null;
665 } 665 }
666 666
667 /** 667 /**
668 * Calls the native |callbackPointer| with lists of information on all insta lled WebAPKs. 668 * Calls the native |callbackPointer| with lists of information on all insta lled WebAPKs.
669 * 669 *
670 * @param callbackPointer Callback to call with the information on the WebAP Ks found. 670 * @param callbackPointer Callback to call with the information on the WebAP Ks found.
671 */ 671 */
672 @CalledByNative 672 @CalledByNative
673 public static void retrieveWebApks(long callbackPointer) { 673 public static void retrieveWebApks(long callbackPointer) {
674 List<String> names = new ArrayList<>();
674 List<String> shortNames = new ArrayList<>(); 675 List<String> shortNames = new ArrayList<>();
675 List<String> packageNames = new ArrayList<>(); 676 List<String> packageNames = new ArrayList<>();
676 List<Integer> shellApkVersions = new ArrayList<>(); 677 List<Integer> shellApkVersions = new ArrayList<>();
677 List<Integer> versionCodes = new ArrayList<>(); 678 List<Integer> versionCodes = new ArrayList<>();
679 List<String> uris = new ArrayList<>();
680 List<String> scopes = new ArrayList<>();
681 List<String> manifestUrls = new ArrayList<>();
682 List<String> manifestStartUrls = new ArrayList<>();
683 List<Integer> displayModes = new ArrayList<>();
684 List<Integer> orientations = new ArrayList<>();
685 List<Long> themeColors = new ArrayList<>();
686 List<Long> backgroundColors = new ArrayList<>();
678 687
679 Context context = ContextUtils.getApplicationContext(); 688 Context context = ContextUtils.getApplicationContext();
680 PackageManager packageManager = context.getPackageManager(); 689 PackageManager packageManager = context.getPackageManager();
681 for (PackageInfo packageInfo : packageManager.getInstalledPackages(0)) { 690 for (PackageInfo packageInfo : packageManager.getInstalledPackages(0)) {
682 if (WebApkValidator.isValidWebApk(context, packageInfo.packageName)) { 691 if (WebApkValidator.isValidWebApk(context, packageInfo.packageName)) {
683 // Pass non-null URL parameter so that {@link WebApkInfo#create( )} 692 // Pass non-null URL parameter so that {@link WebApkInfo#create( )}
684 // return value is non-null 693 // return value is non-null
685 WebApkInfo webApkInfo = 694 WebApkInfo webApkInfo =
686 WebApkInfo.create(packageInfo.packageName, "", ShortcutS ource.UNKNOWN); 695 WebApkInfo.create(packageInfo.packageName, "", ShortcutS ource.UNKNOWN);
687 if (webApkInfo != null) { 696 if (webApkInfo != null) {
697 names.add(webApkInfo.name());
688 shortNames.add(webApkInfo.shortName()); 698 shortNames.add(webApkInfo.shortName());
689 packageNames.add(webApkInfo.webApkPackageName()); 699 packageNames.add(webApkInfo.webApkPackageName());
690 shellApkVersions.add(webApkInfo.shellApkVersion()); 700 shellApkVersions.add(webApkInfo.shellApkVersion());
691 versionCodes.add(packageInfo.versionCode); 701 versionCodes.add(packageInfo.versionCode);
702 uris.add(webApkInfo.uri().toString());
703 scopes.add(webApkInfo.scopeUri().toString());
704 manifestUrls.add(webApkInfo.manifestUrl());
705 manifestStartUrls.add(webApkInfo.manifestStartUrl());
706 displayModes.add(webApkInfo.displayMode());
707 orientations.add(webApkInfo.orientation());
708 themeColors.add(webApkInfo.themeColor());
709 backgroundColors.add(webApkInfo.backgroundColor());
692 } 710 }
693 } 711 }
694 } 712 }
695 nativeOnWebApksRetrieved(callbackPointer, shortNames.toArray(new String[ 0]), 713 nativeOnWebApksRetrieved(callbackPointer, names.toArray(new String[0]),
696 packageNames.toArray(new String[0]), integerListToIntArray(shell ApkVersions), 714 shortNames.toArray(new String[0]), packageNames.toArray(new Stri ng[0]),
697 integerListToIntArray(versionCodes)); 715 integerListToIntArray(shellApkVersions), integerListToIntArray(v ersionCodes),
716 uris.toArray(new String[0]), scopes.toArray(new String[0]),
717 manifestUrls.toArray(new String[0]), manifestStartUrls.toArray(n ew String[0]),
718 integerListToIntArray(displayModes), integerListToIntArray(orien tations),
719 longListToLongArray(themeColors), longListToLongArray(background Colors));
698 } 720 }
699 721
700 private static int[] integerListToIntArray(@NonNull List<Integer> list) { 722 private static int[] integerListToIntArray(@NonNull List<Integer> list) {
701 int[] array = new int[list.size()]; 723 int[] array = new int[list.size()];
702 for (int i = 0; i < list.size(); i++) { 724 for (int i = 0; i < list.size(); i++) {
703 array[i] = list.get(i); 725 array[i] = list.get(i);
704 } 726 }
705 return array; 727 return array;
706 } 728 }
707 729
730 private static long[] longListToLongArray(@NonNull List<Long> list) {
731 long[] array = new long[list.size()];
732 for (int i = 0; i < list.size(); i++) {
733 array[i] = list.get(i);
734 }
735 return array;
736 }
737
708 private static native void nativeOnWebappDataStored(long callbackPointer); 738 private static native void nativeOnWebappDataStored(long callbackPointer);
709 private static native void nativeOnWebApksRetrieved(long callbackPointer, St ring[] shortNames, 739 private static native void nativeOnWebApksRetrieved(long callbackPointer, St ring[] names,
710 String[] packageName, int[] shellApkVersions, int[] versionCodes); 740 String[] shortNames, String[] packageName, int[] shellApkVersions, i nt[] versionCodes,
741 String[] uris, String[] scopes, String[] manifestUrls, String[] mani festStartUrls,
742 int[] displayModes, int[] orientations, long[] themeColors, long[] b ackgroundColors);
711 } 743 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/shortcut_helper.cc » ('j') | ui/gfx/color_utils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698