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

Unified Diff: chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkUtils.java

Issue 2133923002: Simplify caller checking logic in WebApkServiceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into sandbox_on_transact1 Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/webapk/DEPS ('k') | chrome/android/webapk/libs/runtime_library/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkUtils.java
diff --git a/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkUtils.java b/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkUtils.java
index abb3a92c6e2dbbae04fca838c0881013eb106150..f1a05bc7a9697af53562e00c8f25b6e58def7a9b 100644
--- a/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkUtils.java
+++ b/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkUtils.java
@@ -60,6 +60,27 @@ public class WebApkUtils {
}
/**
+ * Returns the uid for the host browser that was specified when building the WebAPK.
+ * @param context A context.
+ * @return The application uid. Returns -1 on an error.
+ */
+ public static int getHostBrowserUid(Context context) {
+ String hostPackageName = getHostBrowserPackageName(context);
+ if (hostPackageName == null) {
+ return -1;
+ }
+ try {
+ PackageManager packageManager = context.getPackageManager();
+ ApplicationInfo appInfo = packageManager.getApplicationInfo(
+ hostPackageName, PackageManager.GET_META_DATA);
+ return appInfo.uid;
+ } catch (NameNotFoundException e) {
+ e.printStackTrace();
+ }
+ return -1;
+ }
+
+ /**
* Returns name of "Runtime Dex" asset in Chrome APK based on version.
* @param version
* @return Dex asset name.
« no previous file with comments | « chrome/android/webapk/DEPS ('k') | chrome/android/webapk/libs/runtime_library/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698