本文整理匯總了Java中org.chromium.chrome.browser.webapps.ChromeWebApkHost.isEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java ChromeWebApkHost.isEnabled方法的具體用法?Java ChromeWebApkHost.isEnabled怎麽用?Java ChromeWebApkHost.isEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.chromium.chrome.browser.webapps.ChromeWebApkHost
的用法示例。
在下文中一共展示了ChromeWebApkHost.isEnabled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: queryWebApkPackage
import org.chromium.chrome.browser.webapps.ChromeWebApkHost; //導入方法依賴的package包/類
/**
* 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;
}
示例2: queryWebApkPackage
import org.chromium.chrome.browser.webapps.ChromeWebApkHost; //導入方法依賴的package包/類
/**
* 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;
}
示例3: dispatchNotificationEvent
import org.chromium.chrome.browser.webapps.ChromeWebApkHost; //導入方法依賴的package包/類
/**
* 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;
}
示例4: queryWebApkPackage
import org.chromium.chrome.browser.webapps.ChromeWebApkHost; //導入方法依賴的package包/類
/**
* 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);
}
示例5: dispatchNotificationEvent
import org.chromium.chrome.browser.webapps.ChromeWebApkHost; //導入方法依賴的package包/類
/**
* 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;
}