OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.webapps; | 5 package org.chromium.chrome.browser.webapps; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.net.Uri; | 9 import android.net.Uri; |
10 import android.os.Build; | 10 import android.os.Build; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } | 235 } |
236 | 236 |
237 /** | 237 /** |
238 * Checks whether the WebAPK package specified in the intent is a valid WebA
PK and whether the | 238 * Checks whether the WebAPK package specified in the intent is a valid WebA
PK and whether the |
239 * url specified in the intent can be fulfilled by the WebAPK. | 239 * url specified in the intent can be fulfilled by the WebAPK. |
240 * | 240 * |
241 * @param intent The intent | 241 * @param intent The intent |
242 * @return true iff all validation criteria are met. | 242 * @return true iff all validation criteria are met. |
243 */ | 243 */ |
244 private boolean isValidWebApk(Intent intent) { | 244 private boolean isValidWebApk(Intent intent) { |
245 if (!ChromeWebApkHost.isEnabled()) return false; | |
246 | |
247 String webApkPackage = | 245 String webApkPackage = |
248 IntentUtils.safeGetStringExtra(intent, WebApkConstants.EXTRA_WEB
APK_PACKAGE_NAME); | 246 IntentUtils.safeGetStringExtra(intent, WebApkConstants.EXTRA_WEB
APK_PACKAGE_NAME); |
249 if (TextUtils.isEmpty(webApkPackage)) return false; | 247 if (TextUtils.isEmpty(webApkPackage)) return false; |
250 | 248 |
251 String url = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA
_URL); | 249 String url = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA
_URL); |
252 if (TextUtils.isEmpty(url)) return false; | 250 if (TextUtils.isEmpty(url)) return false; |
253 | 251 |
254 if (!WebApkValidator.canWebApkHandleUrl(this, webApkPackage, url)) { | 252 if (!WebApkValidator.canWebApkHandleUrl(this, webApkPackage, url)) { |
255 Log.d(TAG, "%s is not within scope of %s WebAPK", url, webApkPackage
); | 253 Log.d(TAG, "%s is not within scope of %s WebAPK", url, webApkPackage
); |
256 return false; | 254 return false; |
257 } | 255 } |
258 return true; | 256 return true; |
259 } | 257 } |
260 } | 258 } |
OLD | NEW |