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

Side by Side Diff: chrome/android/webapk/libs/client/src/org/chromium/webapk/lib/client/WebApkValidator.java

Issue 2629573004: Add a chrome://webapks page. (Closed)
Patch Set: Fixes some more style issues 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.webapk.lib.client; 5 package org.chromium.webapk.lib.client;
6 6
7 import static org.chromium.webapk.lib.common.WebApkConstants.WEBAPK_PACKAGE_PREF IX; 7 import static org.chromium.webapk.lib.common.WebApkConstants.WEBAPK_PACKAGE_PREF IX;
8 8
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.Intent; 10 import android.content.Intent;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 return null; 77 return null;
78 } 78 }
79 79
80 /** 80 /**
81 * Returns whether the provided WebAPK is installed and passes signature che cks. 81 * Returns whether the provided WebAPK is installed and passes signature che cks.
82 * @param context A context 82 * @param context A context
83 * @param webappPackageName The package name to check 83 * @param webappPackageName The package name to check
84 * @return true iff the WebAPK is installed and passes security checks 84 * @return true iff the WebAPK is installed and passes security checks
85 */ 85 */
86 private static boolean isValidWebApk(Context context, String webappPackageNa me) { 86 public static boolean isValidWebApk(Context context, String webappPackageNam e) {
87 if (sExpectedSignature == null) { 87 if (sExpectedSignature == null) {
88 Log.wtf(TAG, "WebApk validation failure - expected signature not set ." 88 Log.wtf(TAG, "WebApk validation failure - expected signature not set ."
89 + "missing call to WebApkValidator.initWithBrowserHostSignat ure"); 89 + "missing call to WebApkValidator.initWithBrowserHostSignat ure");
90 } 90 }
91 // check signature 91 // check signature
92 PackageInfo packageInfo = null; 92 PackageInfo packageInfo = null;
93 try { 93 try {
94 packageInfo = context.getPackageManager().getPackageInfo(webappPacka geName, 94 packageInfo = context.getPackageManager().getPackageInfo(webappPacka geName,
95 PackageManager.GET_SIGNATURES); 95 PackageManager.GET_SIGNATURES);
96 } catch (NameNotFoundException e) { 96 } catch (NameNotFoundException e) {
(...skipping 20 matching lines...) Expand all
117 * with for the current host. 117 * with for the current host.
118 * @param expectedSignature 118 * @param expectedSignature
119 */ 119 */
120 public static void initWithBrowserHostSignature(byte[] expectedSignature) { 120 public static void initWithBrowserHostSignature(byte[] expectedSignature) {
121 if (sExpectedSignature != null) { 121 if (sExpectedSignature != null) {
122 return; 122 return;
123 } 123 }
124 sExpectedSignature = Arrays.copyOf(expectedSignature, expectedSignature. length); 124 sExpectedSignature = Arrays.copyOf(expectedSignature, expectedSignature. length);
125 } 125 }
126 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698