org.chromium.chrome.browser.ChromeFeatureList Java Examples
The following examples show how to use
org.chromium.chrome.browser.ChromeFeatureList.
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: PhysicalWeb.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Perform various Physical Web operations that should happen on startup. */ public static void onChromeStart() { // The PhysicalWebUma calls in this method should be called only when the native library is // loaded. This is always the case on chrome startup. if (featureIsEnabled() && (isPhysicalWebPreferenceEnabled() || isOnboarding())) { boolean ignoreOtherClients = ChromeFeatureList.isEnabled(IGNORE_OTHER_CLIENTS_FEATURE_NAME); ContextUtils.getAppSharedPreferences().edit() .putBoolean(PREF_IGNORE_OTHER_CLIENTS, ignoreOtherClients) .apply(); startPhysicalWeb(); PhysicalWebUma.uploadDeferredMetrics(); } else { stopPhysicalWeb(); } }
Example #2
Source File: PaymentRequestFactory.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override public PaymentRequest createImpl() { if (!ChromeFeatureList.isEnabled(ChromeFeatureList.WEB_PAYMENTS)) { return new InvalidPaymentRequest(); } if (mWebContents == null) return new InvalidPaymentRequest(); ContentViewCore contentViewCore = ContentViewCore.fromWebContents(mWebContents); if (contentViewCore == null) return new InvalidPaymentRequest(); WindowAndroid window = contentViewCore.getWindowAndroid(); if (window == null) return new InvalidPaymentRequest(); Activity context = window.getActivity().get(); if (context == null) return new InvalidPaymentRequest(); return new PaymentRequestImpl(context, mWebContents); }
Example #3
Source File: SiteSettingsPreferences.java From delion with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.site_settings_preferences); getActivity().setTitle(R.string.prefs_site_settings); mProtectedContentMenuAvailable = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; String autoplayTrialGroupName = FieldTrialList.findFullName("MediaElementGestureOverrideExperiment"); mAutoplayMenuAvailable = autoplayTrialGroupName.startsWith("Enabled") || ChromeFeatureList.isEnabled(AUTOPLAY_MUTED_VIDEOS); String category = ""; if (getArguments() != null) { category = getArguments().getString(SingleCategoryPreferences.EXTRA_CATEGORY, ""); if (MEDIA_KEY.equals(category)) { mMediaSubMenu = true; getActivity().setTitle(findPreference(MEDIA_KEY).getTitle().toString()); } } configurePreferences(); updatePreferenceStates(); }
Example #4
Source File: PhysicalWeb.java From delion with Apache License 2.0 | 6 votes |
/** * Perform various Physical Web operations that should happen on startup. * @param application An instance of {@link ChromeApplication}. */ public static void onChromeStart(ChromeApplication application) { // The PhysicalWebUma calls in this method should be called only when the native library is // loaded. This is always the case on chrome startup. if (featureIsEnabled() && (isPhysicalWebPreferenceEnabled(application) || isOnboarding(application))) { boolean ignoreOtherClients = ChromeFeatureList.isEnabled(IGNORE_OTHER_CLIENTS_FEATURE_NAME); ContextUtils.getAppSharedPreferences().edit() .putBoolean(PREF_IGNORE_OTHER_CLIENTS, ignoreOtherClients) .apply(); startPhysicalWeb(application); PhysicalWebUma.uploadDeferredMetrics(application); } else { stopPhysicalWeb(application); } }
Example #5
Source File: PaymentRequestImpl.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * If no payment methods are supported, disconnect from the client and return true. * * @return True if no payment methods are supported */ private boolean disconnectIfNoPaymentMethodsSupported() { boolean waitingForPaymentApps = !isFinishedQueryingPaymentApps(); boolean foundPaymentMethods = mPaymentMethodsSection != null && !mPaymentMethodsSection.isEmpty(); boolean userCanAddCreditCard = mMerchantSupportsAutofillPaymentInstruments && !ChromeFeatureList.isEnabled(ChromeFeatureList.NO_CREDIT_CARD_ABORT); if (!mArePaymentMethodsSupported || (getIsShowing() && !waitingForPaymentApps && !foundPaymentMethods && !userCanAddCreditCard)) { // All payment apps have responded, but none of them have instruments. It's possible to // add credit cards, but the merchant does not support them either. The payment request // must be rejected. disconnectFromClientWithDebugMessage("Requested payment methods have no instruments", PaymentErrorReason.NOT_SUPPORTED); recordAbortReasonHistogram(mArePaymentMethodsSupported ? PaymentRequestMetrics.ABORT_REASON_NO_MATCHING_PAYMENT_METHOD : PaymentRequestMetrics.ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD); if (sObserverForTest != null) sObserverForTest.onPaymentRequestServiceShowFailed(); return true; } return false; }
Example #6
Source File: AutofillAndPaymentsPreferences.java From 365browser with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceUtils.addPreferencesFromResource(this, R.xml.autofill_and_payments_preferences); getActivity().setTitle(R.string.prefs_autofill_and_payments); ChromeSwitchPreference autofillSwitch = (ChromeSwitchPreference) findPreference(PREF_AUTOFILL_SWITCH); autofillSwitch.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { PersonalDataManager.setAutofillEnabled((boolean) newValue); return true; } }); if (ChromeFeatureList.isEnabled(ChromeFeatureList.ANDROID_PAYMENT_APPS)) { Preference pref = new Preference(getActivity()); pref.setTitle(getActivity().getString(R.string.payment_apps_title)); pref.setFragment(AndroidPaymentAppsFragment.class.getCanonicalName()); pref.setShouldDisableView(true); pref.setKey(PREF_ANDROID_PAYMENT_APPS); getPreferenceScreen().addPreference(pref); } }
Example #7
Source File: DataReductionProxySettings.java From 365browser with Apache License 2.0 | 6 votes |
/** * Returns true if the Data Reduction Proxy menu item should be shown in the main menu. */ public boolean shouldUseDataReductionMainMenuItem() { if (!ChromeFeatureList.isEnabled(ChromeFeatureList.DATA_REDUCTION_MAIN_MENU)) return false; if (ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean( ChromeFeatureList.DATA_REDUCTION_MAIN_MENU, PARAM_PERSISTENT_MENU_ITEM_ENABLED, false)) { // If the Data Reduction Proxy is enabled, set the pref storing that the proxy has // ever been enabled. if (isDataReductionProxyEnabled()) { ContextUtils.getAppSharedPreferences() .edit() .putBoolean(DATA_REDUCTION_HAS_EVER_BEEN_ENABLED_PREF, true) .apply(); } return ContextUtils.getAppSharedPreferences().getBoolean( DATA_REDUCTION_HAS_EVER_BEEN_ENABLED_PREF, false); } else { return isDataReductionProxyEnabled(); } }
Example #8
Source File: CustomTabsConnection.java From AndroidChromium with Apache License 2.0 | 6 votes |
private boolean validatePostMessageOriginInternal(final CustomTabsSessionToken session) { if (!mWarmupHasBeenCalled.get()) return false; if (!isCallerForegroundOrSelf()) return false; final int uid = Binder.getCallingUid(); ThreadUtils.postOnUiThread(new Runnable() { @Override public void run() { // If the API is not enabled, we don't set the post message origin, which will // avoid PostMessageHandler initialization and disallow postMessage calls. if (!ChromeFeatureList.isEnabled(ChromeFeatureList.CCT_POST_MESSAGE_API)) return; mClientManager.setPostMessageOriginForSession( session, acquireOriginForSession(session, uid)); } }); return true; }
Example #9
Source File: SearchEngineAdapter.java From 365browser with Apache License 2.0 | 6 votes |
private boolean locationShouldBeShown(TemplateUrl templateUrl) { String url = getSearchEngineUrl(templateUrl); if (url.isEmpty()) return false; // Do not show location if the scheme isn't HTTPS. Uri uri = Uri.parse(url); if (!UrlConstants.HTTPS_SCHEME.equals(uri.getScheme())) return false; // Only show the location setting if it is explicitly enabled or disabled. GeolocationInfo locationSettings = new GeolocationInfo(url, null, false); ContentSetting locationPermission = locationSettings.getContentSetting(); if (locationPermission != ContentSetting.ASK) return true; if (ChromeFeatureList.isEnabled(ChromeFeatureList.CONSISTENT_OMNIBOX_GEOLOCATION)) { return WebsitePreferenceBridge.shouldUseDSEGeolocationSetting(url, false); } return GeolocationHeader.isGeoHeaderEnabledForUrl(url, false); }
Example #10
Source File: InvalidationController.java From 365browser with Apache License 2.0 | 6 votes |
/** * Returns the instance that will use {@code context} to issue intents. * * Calling this method will create the instance if it does not yet exist. */ public static InvalidationController get(Context context) { synchronized (LOCK) { if (sInstance == null) { // The PageRevisitInstrumentation trial needs sessions invalidations to be on such // that local session data is current and can be used to perform checks. boolean requireInvalidationsForInstrumentation = FieldTrialList.findFullName("PageRevisitInstrumentation").equals("Enabled"); // If the NTP is trying to suggest foreign tabs, then recieving invalidations is // vital, otherwise data is stale and less useful. boolean requireInvalidationsForSuggestions = ChromeFeatureList.isEnabled( ChromeFeatureList.NTP_FOREIGN_SESSIONS_SUGGESTIONS); boolean canDisableSessionInvalidations = !requireInvalidationsForInstrumentation && !requireInvalidationsForSuggestions; sInstance = new InvalidationController(context, canDisableSessionInvalidations); } return sInstance; } }
Example #11
Source File: PaymentRequestImpl.java From 365browser with Apache License 2.0 | 6 votes |
/** Updates the modifiers for payment instruments and order summary. */ private void updateInstrumentModifiedTotals() { if (!ChromeFeatureList.isEnabled(ChromeFeatureList.WEB_PAYMENTS_MODIFIERS)) return; if (mModifiers == null) return; if (mPaymentMethodsSection == null) return; for (int i = 0; i < mPaymentMethodsSection.getSize(); i++) { PaymentInstrument instrument = (PaymentInstrument) mPaymentMethodsSection.getItem(i); PaymentDetailsModifier modifier = getModifier(instrument); instrument.setModifiedTotal(modifier == null || modifier.total == null ? null : getOrCreateCurrencyFormatter(modifier.total.amount) .format(modifier.total.amount.value)); } updateOrderSummary((PaymentInstrument) mPaymentMethodsSection.getSelectedItem()); }
Example #12
Source File: InvalidationController.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Returns the instance that will use {@code context} to issue intents. * * Calling this method will create the instance if it does not yet exist. */ public static InvalidationController get(Context context) { synchronized (LOCK) { if (sInstance == null) { // The PageRevisitInstrumentation trial needs sessions invalidations to be on such // that local session data is current and can be used to perform checks. boolean requireInvalidationsForInstrumentation = FieldTrialList.findFullName("PageRevisitInstrumentation").equals("Enabled"); // If the NTP is trying to suggest foreign tabs, then recieving invalidations is // vital, otherwise data is stale and less useful. boolean requireInvalidationsForSuggestions = ChromeFeatureList.isEnabled( ChromeFeatureList.NTP_FOREIGN_SESSIONS_SUGGESTIONS); boolean canDisableSessionInvalidations = !requireInvalidationsForInstrumentation && !requireInvalidationsForSuggestions; boolean canUseGcmUpstream = FieldTrialList.findFullName("InvalidationsGCMUpstream").equals("Enabled"); sInstance = new InvalidationController( context, canDisableSessionInvalidations, canUseGcmUpstream); } return sInstance; } }
Example #13
Source File: FeatureUtilities.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Cache whether or not Chrome Home is enabled. */ public static void cacheChromeHomeEnabled() { Context context = ContextUtils.getApplicationContext(); // Chrome Home doesn't work with tablets. if (DeviceFormFactor.isTablet(context)) return; boolean isChromeHomeEnabled = ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_HOME); ChromePreferenceManager manager = ChromePreferenceManager.getInstance(context); boolean valueChanged = isChromeHomeEnabled != manager.isChromeHomeEnabled(); manager.setChromeHomeEnabled(isChromeHomeEnabled); sChromeHomeEnabled = isChromeHomeEnabled; // If the cached value changed, restart chrome. if (valueChanged) ApplicationLifetime.terminate(true); }
Example #14
Source File: SearchEngineAdapter.java From 365browser with Apache License 2.0 | 6 votes |
private boolean locationEnabled(TemplateUrl templateUrl) { String url = getSearchEngineUrl(templateUrl); if (url.isEmpty()) return false; GeolocationInfo locationSettings = new GeolocationInfo(url, null, false); ContentSetting locationPermission = locationSettings.getContentSetting(); if (locationPermission == ContentSetting.ASK) { // Handle the case where the geoHeader being sent when no permission has been specified. if (ChromeFeatureList.isEnabled(ChromeFeatureList.CONSISTENT_OMNIBOX_GEOLOCATION)) { if (WebsitePreferenceBridge.shouldUseDSEGeolocationSetting(url, false)) { return WebsitePreferenceBridge.getDSEGeolocationSetting(); } } else if (GeolocationHeader.isGeoHeaderEnabledForUrl(url, false)) { return true; } } return locationPermission == ContentSetting.ALLOW; }
Example #15
Source File: ProcessInitializationHandler.java From 365browser with Apache License 2.0 | 5 votes |
/** * Performs the post native initialization. */ protected void handlePostNativeInitialization() { final ChromeApplication application = (ChromeApplication) ContextUtils.getApplicationContext(); DataReductionProxySettings.reconcileDataReductionProxyEnabledState(application); ChromeActivitySessionTracker.getInstance().initializeWithNative(); ChromeApplication.removeSessionCookies(); AppBannerManager.setAppDetailsDelegate(AppHooks.get().createAppDetailsDelegate()); ChromeLifetimeController.initialize(); PrefServiceBridge.getInstance().migratePreferences(application); if (ChromeFeatureList.isEnabled(ChromeFeatureList.NEW_PHOTO_PICKER)) { UiUtils.setPhotoPickerDelegate(new UiUtils.PhotoPickerDelegate() { private PhotoPickerDialog mDialog; @Override public void showPhotoPicker( Context context, PhotoPickerListener listener, boolean allowMultiple) { mDialog = new PhotoPickerDialog(context, listener, allowMultiple); mDialog.getWindow().getAttributes().windowAnimations = R.style.PhotoPickerDialogAnimation; mDialog.show(); } @Override public void dismissPhotoPicker() { mDialog.dismiss(); mDialog = null; } }); } SearchWidgetProvider.initialize(); }
Example #16
Source File: ContextualSearchFieldTrial.java From 365browser with Apache License 2.0 | 5 votes |
/** * @return Whether or not URL actions based on Contextual Cards is enabled. */ static boolean isContextualSearchUrlActionsEnabled() { if (sContextualSearchUrlActionsEnabled == null) { sContextualSearchUrlActionsEnabled = ChromeFeatureList.isEnabled(ChromeFeatureList.CONTEXTUAL_SEARCH_URL_ACTIONS); } return sContextualSearchUrlActionsEnabled; }
Example #17
Source File: VrShellDelegate.java From 365browser with Apache License 2.0 | 5 votes |
private static boolean activitySupportsVrBrowsing(Activity activity) { if (activity instanceof ChromeTabbedActivity) return true; if (activity instanceof CustomTabActivity) { return ChromeFeatureList.isEnabled(ChromeFeatureList.VR_CUSTOM_TAB_BROWSING); } return false; }
Example #18
Source File: VrShellDelegate.java From 365browser with Apache License 2.0 | 5 votes |
/** * @return Whether or not VR Shell is currently enabled. */ private static boolean isVrShellEnabled(int vrSupportLevel) { // Only enable ChromeVR (VrShell) on Daydream devices as it currently needs a Daydream // controller. if (vrSupportLevel != VR_DAYDREAM) return false; return ChromeFeatureList.isEnabled(ChromeFeatureList.VR_SHELL); }
Example #19
Source File: SectionList.java From 365browser with Apache License 2.0 | 5 votes |
@Override public boolean isResetAllowed() { if (!ChromeFeatureList.isEnabled(ChromeFeatureList.CHROME_HOME)) return false; // TODO(dgn): Also check if the bottom sheet is closed and how long since it has been closed // or opened, so that we don't refresh content while the user still cares about it. // Note: don't only use visibility, as pending FetchMore requests can still come, we don't // want to clear all the current suggestions in that case. See https://crbug.com/711414 return !mUiDelegate.isVisible(); }
Example #20
Source File: VrCoreVersionCheckerImpl.java From 365browser with Apache License 2.0 | 5 votes |
@Override public int getVrCoreCompatibility() { // Supported Build version is determined by the webvr cardboard support feature. // Default is KITKAT unless specified via server side finch config. if (Build.VERSION.SDK_INT < ChromeFeatureList.getFieldTrialParamByFeatureAsInt( ChromeFeatureList.WEBVR_CARDBOARD_SUPPORT, MIN_SDK_VERSION_PARAM_NAME, Build.VERSION_CODES.KITKAT)) { return VrCoreVersionChecker.VR_NOT_SUPPORTED; } try { String vrCoreSdkLibraryVersionString = VrCoreUtils.getVrCoreSdkLibraryVersion( ContextUtils.getApplicationContext()); Version vrCoreSdkLibraryVersion = Version.parse(vrCoreSdkLibraryVersionString); Version targetSdkLibraryVersion = Version.parse(com.google.vr.ndk.base.BuildConstants.VERSION); if (!vrCoreSdkLibraryVersion.isAtLeast(targetSdkLibraryVersion)) { return VrCoreVersionChecker.VR_OUT_OF_DATE; } return VrCoreVersionChecker.VR_READY; } catch (VrCoreNotAvailableException e) { Log.i(TAG, "Unable to find VrCore."); // Old versions of VrCore are not integrated with the sdk library version check and will // trigger this exception even though VrCore is installed. // Double check package manager to make sure we are not telling user to install // when it should just be an update. if (PackageUtils.getPackageVersion( ContextUtils.getApplicationContext(), VR_CORE_PACKAGE_ID) != -1) { return VrCoreVersionChecker.VR_OUT_OF_DATE; } return VrCoreVersionChecker.VR_NOT_AVAILABLE; } }
Example #21
Source File: GeolocationSnackbarController.java From 365browser with Apache License 2.0 | 5 votes |
/** * Shows the geolocation snackbar if it hasn't already been shown and the geolocation snackbar * is currently relevant: i.e. the default search engine is Google, location is enabled * for Chrome, the tab is not incognito, etc. * * @param snackbarManager The SnackbarManager used to show the snackbar. * @param view Any view that's attached to the view hierarchy. * @param isIncognito Whether the currently visible tab is incognito. * @param delayMs The delay in ms before the snackbar should be shown. This is intended to * give the keyboard time to animate in. */ public static void maybeShowSnackbar(final SnackbarManager snackbarManager, View view, boolean isIncognito, int delayMs) { final Context context = view.getContext(); if (ChromeFeatureList.isEnabled(ChromeFeatureList.CONSISTENT_OMNIBOX_GEOLOCATION)) return; if (getGeolocationSnackbarShown(context)) return; // If in incognito mode, don't show the snackbar now, but maybe show it later. if (isIncognito) return; if (neverShowSnackbar(context)) { setGeolocationSnackbarShown(context); return; } Uri searchUri = Uri.parse(TemplateUrlService.getInstance().getUrlForSearchQuery("foo")); TypefaceSpan robotoMediumSpan = new TypefaceSpan("sans-serif-medium"); String messageWithoutSpans = context.getResources().getString( R.string.omnibox_geolocation_disclosure, "<b>" + searchUri.getHost() + "</b>"); SpannableString message = SpanApplier.applySpans(messageWithoutSpans, new SpanInfo("<b>", "</b>", robotoMediumSpan)); String settings = context.getResources().getString(R.string.preferences); int durationMs = AccessibilityUtil.isAccessibilityEnabled() ? ACCESSIBILITY_SNACKBAR_DURATION_MS : SNACKBAR_DURATION_MS; final GeolocationSnackbarController controller = new GeolocationSnackbarController(); final Snackbar snackbar = Snackbar .make(message, controller, Snackbar.TYPE_ACTION, Snackbar.UMA_OMNIBOX_GEOLOCATION) .setAction(settings, view) .setSingleLine(false) .setDuration(durationMs); view.postDelayed(new Runnable() { @Override public void run() { snackbarManager.dismissSnackbars(controller); snackbarManager.showSnackbar(snackbar); setGeolocationSnackbarShown(context); } }, delayMs); }
Example #22
Source File: PaymentRequestImpl.java From 365browser with Apache License 2.0 | 5 votes |
/** Sets the modifier for the order summary based on the given instrument, if any. */ private void updateOrderSummary(@Nullable PaymentInstrument instrument) { if (!ChromeFeatureList.isEnabled(ChromeFeatureList.WEB_PAYMENTS_MODIFIERS)) return; PaymentDetailsModifier modifier = getModifier(instrument); PaymentItem total = modifier == null ? null : modifier.total; if (total == null) total = mRawTotal; CurrencyFormatter formatter = getOrCreateCurrencyFormatter(total.amount); mUiShoppingCart.setTotal(new LineItem(total.label, formatter.getFormattedCurrencyCode(), formatter.format(total.amount.value), false /* isPending */)); mUiShoppingCart.setAdditionalContents( modifier == null ? null : getLineItems(modifier.additionalDisplayItems)); if (mUI != null) mUI.updateOrderSummarySection(mUiShoppingCart); }
Example #23
Source File: CustomTabsConnection.java From 365browser with Apache License 2.0 | 5 votes |
private void startSpeculation(CustomTabsSessionToken session, String url, int speculationMode, Bundle extras, int uid) { WarmupManager warmupManager = WarmupManager.getInstance(); Profile profile = Profile.getLastUsedProfile(); boolean preconnect = true, createSpareWebContents = true; if (speculationMode == SpeculationParams.HIDDEN_TAB && !ChromeFeatureList.isEnabled(ChromeFeatureList.CCT_BACKGROUND_TAB)) { speculationMode = SpeculationParams.PRERENDER; } switch (speculationMode) { case SpeculationParams.PREFETCH: boolean didPrefetch = new LoadingPredictor(profile).prepareForPageLoad(url); if (didPrefetch) mSpeculation = SpeculationParams.forPrefetch(session, url); preconnect = !didPrefetch; break; case SpeculationParams.PRERENDER: boolean didPrerender = prerenderUrl(session, url, extras, uid); createSpareWebContents = !didPrerender; break; case SpeculationParams.HIDDEN_TAB: launchUrlInHiddenTab(session, url, extras); break; default: break; } if (preconnect) warmupManager.maybePreconnectUrlAndSubResources(profile, url); if (createSpareWebContents) warmupManager.createSpareWebContents(); }
Example #24
Source File: GeolocationHeader.java From 365browser with Apache License 2.0 | 5 votes |
/** * Requests a location refresh so that a valid location will be available for constructing * an X-Geo header in the near future (i.e. within 5 minutes). */ public static void primeLocationForGeoHeader() { if (!hasGeolocationPermission()) return; if (sFirstLocationTime == Long.MAX_VALUE) { sFirstLocationTime = SystemClock.elapsedRealtime(); } GeolocationTracker.refreshLastKnownLocation( ContextUtils.getApplicationContext(), REFRESH_LOCATION_AGE); // Only refresh visible networks if enabled. if (ChromeFeatureList.isEnabled(ChromeFeatureList.XGEO_VISIBLE_NETWORKS)) { VisibleNetworksTracker.refreshVisibleNetworks(ContextUtils.getApplicationContext()); } }
Example #25
Source File: PaymentRequestFactory.java From 365browser with Apache License 2.0 | 5 votes |
@Override public PaymentRequest createImpl() { if (!ChromeFeatureList.isEnabled(ChromeFeatureList.WEB_PAYMENTS)) { return new InvalidPaymentRequest(); } if (mRenderFrameHost == null) return new InvalidPaymentRequest(); return new PaymentRequestImpl(mRenderFrameHost); }
Example #26
Source File: NativePageFactory.java From 365browser with Apache License 2.0 | 5 votes |
private static NativePageType nativePageType(String url, NativePage candidatePage, boolean isIncognito) { if (url == null) return NativePageType.NONE; Uri uri = Uri.parse(url); if (!UrlConstants.CHROME_NATIVE_SCHEME.equals(uri.getScheme())) { return NativePageType.NONE; } String host = uri.getHost(); if (candidatePage != null && candidatePage.getHost().equals(host)) { return NativePageType.CANDIDATE; } if (UrlConstants.NTP_HOST.equals(host)) { return NativePageType.NTP; } else if (UrlConstants.BOOKMARKS_HOST.equals(host)) { return NativePageType.BOOKMARKS; } else if (UrlConstants.DOWNLOADS_HOST.equals(host)) { return NativePageType.DOWNLOADS; } else if (UrlConstants.HISTORY_HOST.equals(host)) { return NativePageType.HISTORY; } else if (UrlConstants.RECENT_TABS_HOST.equals(host) && !isIncognito) { return NativePageType.RECENT_TABS; } else if (UrlConstants.PHYSICAL_WEB_DIAGNOSTICS_HOST.equals(host)) { if (ChromeFeatureList.isEnabled("PhysicalWeb")) { return NativePageType.PHYSICAL_WEB; } else { return NativePageType.NONE; } } else { return NativePageType.NONE; } }
Example #27
Source File: PasswordEntryEditor.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (ChromeFeatureList.isEnabled(VIEW_PASSWORDS)) { setHasOptionsMenu(true); } }
Example #28
Source File: ContextualSearchFieldTrial.java From 365browser with Apache License 2.0 | 5 votes |
/** * @return Whether or not single actions based on Contextual Cards is enabled. */ static boolean isContextualSearchSingleActionsEnabled() { if (sContextualSearchSingleActionsEnabled == null) { sContextualSearchSingleActionsEnabled = ChromeFeatureList.isEnabled(ChromeFeatureList.CONTEXTUAL_SEARCH_SINGLE_ACTIONS); } return sContextualSearchSingleActionsEnabled; }
Example #29
Source File: GeolocationHeader.java From 365browser with Apache License 2.0 | 5 votes |
/** * Returns true if the user has disabled sharing their location with url (e.g. via the * geolocation infobar). */ static boolean isLocationDisabledForUrl(Uri uri, boolean isIncognito) { if (ChromeFeatureList.isEnabled(ChromeFeatureList.CONSISTENT_OMNIBOX_GEOLOCATION)) { boolean enabled = WebsitePreferenceBridge.shouldUseDSEGeolocationSetting( uri.toString(), isIncognito) && WebsitePreferenceBridge.getDSEGeolocationSetting(); return !enabled; } else { return locationContentSettingForUrl(uri, isIncognito) == ContentSetting.BLOCK; } }
Example #30
Source File: PaymentAppFactory.java From 365browser with Apache License 2.0 | 5 votes |
private PaymentAppFactory() { mAdditionalFactories = new ArrayList<>(); if (ChromeFeatureList.isEnabled(ChromeFeatureList.ANDROID_PAYMENT_APPS)) { mAdditionalFactories.add(new AndroidPaymentAppFactory()); } if (ChromeFeatureList.isEnabled(ChromeFeatureList.SERVICE_WORKER_PAYMENT_APPS)) { mAdditionalFactories.add(new ServiceWorkerPaymentAppBridge()); } }