org.chromium.chrome.browser.webapps.ChromeWebApkHost Java Examples
The following examples show how to use
org.chromium.chrome.browser.webapps.ChromeWebApkHost.
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: ChromeBrowserInitializer.java From delion with Apache License 2.0 | 6 votes |
private void preInflationStartup() { ThreadUtils.assertOnUiThread(); if (mPreInflationStartupComplete) return; PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, mApplication); // 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(); if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_WEBAPK)) { ChromeWebApkHost.init(); } warmUpSharedPrefs(); DeviceUtils.addDeviceSpecificUserAgentSwitch(mApplication); ApplicationStatus.registerStateListenerForAllActivities( createActivityStateListener()); mPreInflationStartupComplete = true; }
Example #2
Source File: ChromeBrowserInitializer.java From AndroidChromium with Apache License 2.0 | 6 votes |
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; }
Example #3
Source File: ChromeBrowserInitializer.java From 365browser with Apache License 2.0 | 6 votes |
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; }
Example #4
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 #5
Source File: FeatureUtilities.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * 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(); }
Example #6
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 #7
Source File: FeatureUtilities.java From 365browser with Apache License 2.0 | 5 votes |
/** * Caches flags that must take effect on startup but are set via native code. */ public static void cacheNativeFlags() { cacheHerbFlavor(); ChromeWebApkHost.cacheEnabledStateForNextLaunch(); cacheChromeHomeEnabled(); FirstRunGlueImpl.cacheFirstRunPrefs(); }
Example #8
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 #9
Source File: ChromeTabbedActivity.java From AndroidChromium with Apache License 2.0 | 4 votes |
@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"); } }
Example #10
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 #11
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 #12
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); }