Java Code Examples for org.chromium.chrome.browser.webapps.ChromeWebApkHost#isEnabled()
The following examples show how to use
org.chromium.chrome.browser.webapps.ChromeWebApkHost#isEnabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NotificationPlatformBridge.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Returns the package for the WebAPK which should handle the URL. * * @param url The url to check. * @return Package name of the WebAPK which should handle the URL. Returns empty string if the * URL should not be handled by a WebAPK. */ @CalledByNative private String queryWebApkPackage(String url) { if (!ChromeWebApkHost.isEnabled()) return ""; String webApkPackage = WebApkValidator.queryWebApkPackage(mAppContext, url); return webApkPackage == null ? "" : webApkPackage; }
Example 2
Source File: NotificationPlatformBridge.java From 365browser with Apache License 2.0 | 5 votes |
/** * Returns the package for the WebAPK which should handle the URL. * * @param url The url to check. * @return Package name of the WebAPK which should handle the URL. Returns empty string if the * URL should not be handled by a WebAPK. */ @CalledByNative private String queryWebApkPackage(String url) { if (!ChromeWebApkHost.isEnabled()) return ""; String webApkPackage = WebApkValidator.queryWebApkPackage(ContextUtils.getApplicationContext(), url); return webApkPackage == null ? "" : webApkPackage; }
Example 3
Source File: NotificationPlatformBridge.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * Invoked by the NotificationService when a Notification intent has been received. There may * not be an active instance of the NotificationPlatformBridge at this time, so inform the * native side through a static method, initializing both ends if needed. * * @param intent The intent as received by the Notification service. * @return Whether the event could be handled by the native Notification bridge. */ public static boolean dispatchNotificationEvent(Intent intent) { if (sInstance == null) { nativeInitializeNotificationPlatformBridge(); if (sInstance == null) { Log.e(TAG, "Unable to initialize the native NotificationPlatformBridge."); return false; } } String notificationId = intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_ID); String origin = intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_INFO_ORIGIN); String profileId = intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_INFO_PROFILE_ID); boolean incognito = intent.getBooleanExtra( NotificationConstants.EXTRA_NOTIFICATION_INFO_PROFILE_INCOGNITO, false); String tag = intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_INFO_TAG); Log.i(TAG, "Dispatching notification event to native: " + notificationId); if (NotificationConstants.ACTION_CLICK_NOTIFICATION.equals(intent.getAction())) { String webApkPackage = ""; if (ChromeWebApkHost.isEnabled()) { webApkPackage = intent.getStringExtra( NotificationConstants.EXTRA_NOTIFICATION_INFO_WEBAPK_PACKAGE); if (webApkPackage == null) { webApkPackage = ""; } } int actionIndex = intent.getIntExtra( NotificationConstants.EXTRA_NOTIFICATION_INFO_ACTION_INDEX, -1); sInstance.onNotificationClicked(notificationId, origin, profileId, incognito, tag, webApkPackage, actionIndex, getNotificationReply(intent)); return true; } else if (NotificationConstants.ACTION_CLOSE_NOTIFICATION.equals(intent.getAction())) { // Notification deleteIntent is executed only "when the notification is explicitly // dismissed by the user, either with the 'Clear All' button or by swiping it away // individually" (though a third-party NotificationListenerService may also trigger it). sInstance.onNotificationClosed( notificationId, origin, profileId, incognito, tag, true /* byUser */); return true; } Log.e(TAG, "Unrecognized Notification action: " + intent.getAction()); return false; }
Example 4
Source File: ShortcutHelper.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * Returns the package name of the WebAPK if WebAPKs are enabled and there is an installed * WebAPK which can handle {@link url}. Returns null otherwise. */ @CalledByNative private static String queryWebApkPackage(String url) { if (!ChromeWebApkHost.isEnabled()) return null; return WebApkValidator.queryWebApkPackage(ContextUtils.getApplicationContext(), url); }
Example 5
Source File: NotificationPlatformBridge.java From 365browser with Apache License 2.0 | 4 votes |
/** * Invoked by the NotificationService when a Notification intent has been received. There may * not be an active instance of the NotificationPlatformBridge at this time, so inform the * native side through a static method, initializing both ends if needed. * * @param intent The intent as received by the Notification service. * @return Whether the event could be handled by the native Notification bridge. */ static boolean dispatchNotificationEvent(Intent intent) { if (sInstance == null) { nativeInitializeNotificationPlatformBridge(); if (sInstance == null) { Log.e(TAG, "Unable to initialize the native NotificationPlatformBridge."); return false; } } String notificationId = intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_ID); String origin = intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_INFO_ORIGIN); String profileId = intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_INFO_PROFILE_ID); boolean incognito = intent.getBooleanExtra( NotificationConstants.EXTRA_NOTIFICATION_INFO_PROFILE_INCOGNITO, false); String tag = intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_INFO_TAG); Log.i(TAG, "Dispatching notification event to native: " + notificationId); if (NotificationConstants.ACTION_CLICK_NOTIFICATION.equals(intent.getAction())) { String webApkPackage = ""; if (ChromeWebApkHost.isEnabled()) { webApkPackage = intent.getStringExtra( NotificationConstants.EXTRA_NOTIFICATION_INFO_WEBAPK_PACKAGE); if (webApkPackage == null) { webApkPackage = ""; } } int actionIndex = intent.getIntExtra( NotificationConstants.EXTRA_NOTIFICATION_INFO_ACTION_INDEX, -1); sInstance.onNotificationClicked(notificationId, origin, profileId, incognito, tag, webApkPackage, actionIndex, getNotificationReply(intent)); return true; } else if (NotificationConstants.ACTION_CLOSE_NOTIFICATION.equals(intent.getAction())) { // Notification deleteIntent is executed only "when the notification is explicitly // dismissed by the user, either with the 'Clear All' button or by swiping it away // individually" (though a third-party NotificationListenerService may also trigger it). sInstance.onNotificationClosed( notificationId, origin, profileId, incognito, tag, true /* byUser */); return true; } Log.e(TAG, "Unrecognized Notification action: " + intent.getAction()); return false; }
Example 6
Source File: ShortcutHelper.java From 365browser with Apache License 2.0 | 4 votes |
/** * Returns the package name of the WebAPK if WebAPKs are enabled and there is an installed * WebAPK which can handle {@link url}. Returns null otherwise. */ @CalledByNative private static String queryWebApkPackage(String url) { if (!ChromeWebApkHost.isEnabled()) return null; return WebApkValidator.queryWebApkPackage(ContextUtils.getApplicationContext(), url); }