本文整理匯總了Java中org.chromium.chrome.browser.webapps.ChromeWebApkHost類的典型用法代碼示例。如果您正苦於以下問題:Java ChromeWebApkHost類的具體用法?Java ChromeWebApkHost怎麽用?Java ChromeWebApkHost使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ChromeWebApkHost類屬於org.chromium.chrome.browser.webapps包,在下文中一共展示了ChromeWebApkHost類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: preInflationStartup
import org.chromium.chrome.browser.webapps.ChromeWebApkHost; //導入依賴的package包/類
private void preInflationStartup() {
ThreadUtils.assertOnUiThread();
if (mPreInflationStartupComplete) return;
PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);
// Ensure critical files are available, so they aren't blocked on the file-system
// behind long-running accesses in next phase.
// Don't do any large file access here!
ContentApplication.initCommandLine(mApplication);
waitForDebuggerIfNeeded();
ChromeStrictMode.configureStrictMode();
ChromeWebApkHost.init();
warmUpSharedPrefs();
DeviceUtils.addDeviceSpecificUserAgentSwitch(mApplication);
ApplicationStatus.registerStateListenerForAllActivities(
createActivityStateListener());
mPreInflationStartupComplete = true;
}
示例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(mAppContext, url);
return webApkPackage == null ? "" : webApkPackage;
}
示例3: cacheNativeFlags
import org.chromium.chrome.browser.webapps.ChromeWebApkHost; //導入依賴的package包/類
/**
* Caches flags that must take effect on startup but are set via native code.
*/
public static void cacheNativeFlags() {
cacheHerbFlavor();
DownloadUtils.cacheIsDownloadHomeEnabled();
InstantAppsHandler.getInstance().cacheInstantAppsEnabled();
ChromeWebApkHost.cacheEnabledStateForNextLaunch();
cacheChromeHomeEnabled();
FirstRunGlueImpl.cacheFirstRunPrefs();
}
示例4: 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;
}
示例5: cacheNativeFlags
import org.chromium.chrome.browser.webapps.ChromeWebApkHost; //導入依賴的package包/類
/**
* Caches flags that must take effect on startup but are set via native code.
*/
public static void cacheNativeFlags() {
cacheHerbFlavor();
ChromeWebApkHost.cacheEnabledStateForNextLaunch();
cacheChromeHomeEnabled();
FirstRunGlueImpl.cacheFirstRunPrefs();
}
示例6: 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;
}
示例7: finishNativeInitialization
import org.chromium.chrome.browser.webapps.ChromeWebApkHost; //導入依賴的package包/類
@Override
public void finishNativeInitialization() {
try {
TraceEvent.begin("ChromeTabbedActivity.finishNativeInitialization");
launchFirstRunExperience();
refreshSignIn();
ChromePreferenceManager preferenceManager = ChromePreferenceManager.getInstance(this);
// Promos can only be shown when we start with ACTION_MAIN intent and
// after FRE is complete.
if (!mIntentWithEffect && FirstRunStatus.getFirstRunFlowComplete()) {
// Only show promos on the second oppurtunity. This is because we show FRE on the
// first oppurtunity, and we don't want to show such content back to back.
if (preferenceManager.getPromosSkippedOnFirstStart()) {
// Data reduction promo should be temporarily suppressed if the sign in promo is
// shown to avoid nagging users too much.
if (!SigninPromoUtil.launchSigninPromoIfNeeded(this)) {
DataReductionPromoScreen.launchDataReductionPromo(this);
}
} else {
preferenceManager.setPromosSkippedOnFirstStart(true);
}
// Notify users experimenting with WebAPKs if they need to do extra steps to enable
// WebAPKs.
ChromeWebApkHost.launchWebApkRequirementsDialogIfNeeded(this);
}
initializeUI();
// The dataset has already been created, we need to initialize our state.
mTabModelSelectorImpl.notifyChanged();
getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
Window.PROGRESS_VISIBILITY_OFF);
// Check for incognito tabs to handle the case where Chrome was swiped away in the
// background.
int incognitoCount = TabWindowManager.getInstance().getIncognitoTabCount();
if (incognitoCount == 0) IncognitoNotificationManager.dismissIncognitoNotification();
// LocaleManager can only function after the native library is loaded.
mLocaleManager = LocaleManager.getInstance();
mLocaleManager.showSearchEnginePromoIfNeeded(this);
super.finishNativeInitialization();
} finally {
TraceEvent.end("ChromeTabbedActivity.finishNativeInitialization");
}
}
示例8: 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);
}
示例9: 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;
}