| OLD | NEW |
| 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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
| 9 import android.app.ActivityManager; | 9 import android.app.ActivityManager; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 import org.chromium.base.ApiCompatibilityUtils; | 31 import org.chromium.base.ApiCompatibilityUtils; |
| 32 import org.chromium.base.BuildInfo; | 32 import org.chromium.base.BuildInfo; |
| 33 import org.chromium.base.ContextUtils; | 33 import org.chromium.base.ContextUtils; |
| 34 import org.chromium.base.Log; | 34 import org.chromium.base.Log; |
| 35 import org.chromium.base.ThreadUtils; | 35 import org.chromium.base.ThreadUtils; |
| 36 import org.chromium.base.VisibleForTesting; | 36 import org.chromium.base.VisibleForTesting; |
| 37 import org.chromium.base.annotations.CalledByNative; | 37 import org.chromium.base.annotations.CalledByNative; |
| 38 import org.chromium.blink_public.platform.WebDisplayMode; | 38 import org.chromium.blink_public.platform.WebDisplayMode; |
| 39 import org.chromium.chrome.R; | 39 import org.chromium.chrome.R; |
| 40 import org.chromium.chrome.browser.webapps.ChromeWebApkHost; | |
| 41 import org.chromium.chrome.browser.webapps.WebApkInfo; | 40 import org.chromium.chrome.browser.webapps.WebApkInfo; |
| 42 import org.chromium.chrome.browser.webapps.WebappActivity; | 41 import org.chromium.chrome.browser.webapps.WebappActivity; |
| 43 import org.chromium.chrome.browser.webapps.WebappAuthenticator; | 42 import org.chromium.chrome.browser.webapps.WebappAuthenticator; |
| 44 import org.chromium.chrome.browser.webapps.WebappDataStorage; | 43 import org.chromium.chrome.browser.webapps.WebappDataStorage; |
| 45 import org.chromium.chrome.browser.webapps.WebappLauncherActivity; | 44 import org.chromium.chrome.browser.webapps.WebappLauncherActivity; |
| 46 import org.chromium.chrome.browser.webapps.WebappRegistry; | 45 import org.chromium.chrome.browser.webapps.WebappRegistry; |
| 47 import org.chromium.chrome.browser.widget.RoundedIconGenerator; | 46 import org.chromium.chrome.browser.widget.RoundedIconGenerator; |
| 48 import org.chromium.content_public.common.ScreenOrientationConstants; | 47 import org.chromium.content_public.common.ScreenOrientationConstants; |
| 49 import org.chromium.ui.widget.Toast; | 48 import org.chromium.ui.widget.Toast; |
| 50 import org.chromium.webapk.lib.client.WebApkValidator; | 49 import org.chromium.webapk.lib.client.WebApkValidator; |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 523 |
| 525 return bitmap; | 524 return bitmap; |
| 526 } | 525 } |
| 527 | 526 |
| 528 /** | 527 /** |
| 529 * Returns the package name of the WebAPK if WebAPKs are enabled and there i
s an installed | 528 * Returns the package name of the WebAPK if WebAPKs are enabled and there i
s an installed |
| 530 * WebAPK which can handle {@link url}. Returns null otherwise. | 529 * WebAPK which can handle {@link url}. Returns null otherwise. |
| 531 */ | 530 */ |
| 532 @CalledByNative | 531 @CalledByNative |
| 533 private static String queryWebApkPackage(String url) { | 532 private static String queryWebApkPackage(String url) { |
| 534 if (!ChromeWebApkHost.isEnabled()) return null; | |
| 535 return WebApkValidator.queryWebApkPackage(ContextUtils.getApplicationCon
text(), url); | 533 return WebApkValidator.queryWebApkPackage(ContextUtils.getApplicationCon
text(), url); |
| 536 } | 534 } |
| 537 | 535 |
| 538 /** | 536 /** |
| 539 * Compresses a bitmap into a PNG and converts into a Base64 encoded string. | 537 * Compresses a bitmap into a PNG and converts into a Base64 encoded string. |
| 540 * The encoded string can be decoded using {@link decodeBitmapFromString(Str
ing)}. | 538 * The encoded string can be decoded using {@link decodeBitmapFromString(Str
ing)}. |
| 541 * @param bitmap The Bitmap to compress and encode. | 539 * @param bitmap The Bitmap to compress and encode. |
| 542 * @return the String encoding the Bitmap. | 540 * @return the String encoding the Bitmap. |
| 543 */ | 541 */ |
| 544 public static String encodeBitmapAsString(Bitmap bitmap) { | 542 public static String encodeBitmapAsString(Bitmap bitmap) { |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 } | 814 } |
| 817 return array; | 815 return array; |
| 818 } | 816 } |
| 819 | 817 |
| 820 private static native void nativeOnWebappDataStored(long callbackPointer); | 818 private static native void nativeOnWebappDataStored(long callbackPointer); |
| 821 private static native void nativeOnWebApksRetrieved(long callbackPointer, St
ring[] names, | 819 private static native void nativeOnWebApksRetrieved(long callbackPointer, St
ring[] names, |
| 822 String[] shortNames, String[] packageName, int[] shellApkVersions, i
nt[] versionCodes, | 820 String[] shortNames, String[] packageName, int[] shellApkVersions, i
nt[] versionCodes, |
| 823 String[] uris, String[] scopes, String[] manifestUrls, String[] mani
festStartUrls, | 821 String[] uris, String[] scopes, String[] manifestUrls, String[] mani
festStartUrls, |
| 824 int[] displayModes, int[] orientations, long[] themeColors, long[] b
ackgroundColors); | 822 int[] displayModes, int[] orientations, long[] themeColors, long[] b
ackgroundColors); |
| 825 } | 823 } |
| OLD | NEW |