org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings Java Examples
The following examples show how to use
org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings.
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: LofiBarController.java From delion with Apache License 2.0 | 6 votes |
/** * @param tab The tab. Saved to reload the page. */ private void showLoFiBar(Tab tab, boolean isPreview) { if (mDisabled) return; mTab = tab; String message = mContext .getString(isPreview ? R.string.data_reduction_lo_fi_preview_snackbar_message : R.string.data_reduction_lo_fi_snackbar_message); String buttonText = mContext .getString(isPreview ? R.string.data_reduction_lo_fi_preview_snackbar_action : R.string.data_reduction_lo_fi_snackbar_action); mSnackbarManager.showSnackbar( Snackbar.make(message, this, Snackbar.TYPE_NOTIFICATION, Snackbar.UMA_LOFI) .setAction(buttonText, isPreview ? PREVIEW_SNACKBAR : LOFI_SNACKBAR) .setDuration(DEFAULT_LO_FI_SNACKBAR_SHOW_DURATION_MS)); DataReductionProxySettings.getInstance().incrementLoFiSnackbarShown(); DataReductionProxyUma.dataReductionProxyLoFiUIAction( DataReductionProxyUma.ACTION_LOAD_IMAGES_SNACKBAR_SHOWN); }
Example #2
Source File: DataReductionPreferences.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.data_reduction_preferences); getActivity().setTitle(R.string.data_reduction_title); boolean isEnabled = DataReductionProxySettings.getInstance().isDataReductionProxyEnabled(); mIsEnabled = !isEnabled; mWasEnabledAtCreation = isEnabled; updatePreferences(isEnabled); setHasOptionsMenu(true); if (getActivity() != null) { mFromPromo = IntentUtils.safeGetBooleanExtra(getActivity().getIntent(), DataReductionPromoSnackbarController.FROM_PROMO, false); } }
Example #3
Source File: WarmupManager.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** Asynchronously preconnects to a given URL if the data reduction proxy is not in use. * * @param profile The profile to use for the preconnection. * @param url The URL we want to preconnect to. */ public void maybePreconnectUrlAndSubResources(Profile profile, String url) { ThreadUtils.assertOnUiThread(); if (!DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) { // If there is already a DNS request in flight for this URL, then // the preconnection will start by issuing a DNS request for the // same domain, as the result is not cached. However, such a DNS // request has already been sent from this class, so it is better to // wait for the answer to come back before preconnecting. Otherwise, // the preconnection logic will wait for the result of the second // DNS request, which should arrive after the result of the first // one. Note that we however need to wait for the main thread to be // available in this case, since the preconnection will be sent from // AsyncTask.onPostExecute(), which may delay it. if (mDnsRequestsInFlight.contains(url)) { // Note that if two requests come for the same URL with two // different profiles, the last one will win. mPendingPreconnectWithProfile.put(url, profile); } else { nativePreconnectUrlAndSubresources(profile, url); } } }
Example #4
Source File: DataReductionPreferences.java From AndroidChromium with Apache License 2.0 | 6 votes |
private static NetworkStatsHistory getNetworkStatsHistory(long[] history, int days) { if (days > history.length) days = history.length; NetworkStatsHistory networkStatsHistory = new NetworkStatsHistory( DateUtils.DAY_IN_MILLIS, days, NetworkStatsHistory.FIELD_RX_BYTES); DataReductionProxySettings config = DataReductionProxySettings.getInstance(); long time = config.getDataReductionLastUpdateTime() - days * DateUtils.DAY_IN_MILLIS; for (int i = history.length - days, bucket = 0; i < history.length; i++, bucket++) { NetworkStats.Entry entry = new NetworkStats.Entry(); entry.rxBytes = history[i]; long startTime = time + (DateUtils.DAY_IN_MILLIS * bucket); // Spread each day's record over the first hour of the day. networkStatsHistory.recordData( startTime, startTime + DateUtils.HOUR_IN_MILLIS, entry); } return networkStatsHistory; }
Example #5
Source File: CustomTabsConnection.java From 365browser with Apache License 2.0 | 6 votes |
/** * High confidence mayLaunchUrl() call, that is: * - Tries to prerender if possible. * - An empty URL cancels the current prerender if any. * - If prerendering is not possible, makes sure that there is a spare renderer. */ private void highConfidenceMayLaunchUrl(CustomTabsSessionToken session, int uid, String url, Bundle extras, List<Bundle> otherLikelyBundles) { ThreadUtils.assertOnUiThread(); if (TextUtils.isEmpty(url)) { cancelSpeculation(session); return; } url = DataReductionProxySettings.getInstance().maybeRewriteWebliteUrl(url); int debugOverrideValue = NO_OVERRIDE; if (extras != null) debugOverrideValue = extras.getInt(DEBUG_OVERRIDE_KEY, NO_OVERRIDE); int speculationMode = getSpeculationMode(session, debugOverrideValue); if (maySpeculate(session)) startSpeculation(session, url, speculationMode, extras, uid); preconnectUrls(otherLikelyBundles); }
Example #6
Source File: CustomTabActivity.java From 365browser with Apache License 2.0 | 6 votes |
/** * @return The URL that should be used from this intent. If it is a WebLite url, it may be * overridden if the Data Reduction Proxy is using Lo-Fi previews. */ private String getUrlToLoad() { String url = IntentHandler.getUrlFromIntent(getIntent()); // Intents fired for media viewers have an additional file:// URI passed along so that the // tab can display the actual filename to the user when it is loaded. if (mIntentDataProvider.isMediaViewer()) { String mediaViewerUrl = mIntentDataProvider.getMediaViewerUrl(); if (!TextUtils.isEmpty(mediaViewerUrl)) { Uri mediaViewerUri = Uri.parse(mediaViewerUrl); if (UrlConstants.FILE_SCHEME.equals(mediaViewerUri.getScheme())) { url = mediaViewerUrl; } } } if (!TextUtils.isEmpty(url)) { url = DataReductionProxySettings.getInstance().maybeRewriteWebliteUrl(url); } return url; }
Example #7
Source File: DataReductionPreferences.java From delion with Apache License 2.0 | 6 votes |
private static NetworkStatsHistory getNetworkStatsHistory(long[] history, int days) { if (days > history.length) days = history.length; NetworkStatsHistory networkStatsHistory = new NetworkStatsHistory( DateUtils.DAY_IN_MILLIS, days, NetworkStatsHistory.FIELD_RX_BYTES); DataReductionProxySettings config = DataReductionProxySettings.getInstance(); long time = config.getDataReductionLastUpdateTime() - days * DateUtils.DAY_IN_MILLIS; for (int i = history.length - days, bucket = 0; i < history.length; i++, bucket++) { NetworkStats.Entry entry = new NetworkStats.Entry(); entry.rxBytes = history[i]; long startTime = time + (DateUtils.DAY_IN_MILLIS * bucket); // Spread each day's record over the first hour of the day. networkStatsHistory.recordData( startTime, startTime + DateUtils.HOUR_IN_MILLIS, entry); } return networkStatsHistory; }
Example #8
Source File: WarmupManager.java From 365browser with Apache License 2.0 | 6 votes |
/** Asynchronously preconnects to a given URL if the data reduction proxy is not in use. * * @param profile The profile to use for the preconnection. * @param url The URL we want to preconnect to. */ public void maybePreconnectUrlAndSubResources(Profile profile, String url) { ThreadUtils.assertOnUiThread(); if (!DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) { // If there is already a DNS request in flight for this URL, then // the preconnection will start by issuing a DNS request for the // same domain, as the result is not cached. However, such a DNS // request has already been sent from this class, so it is better to // wait for the answer to come back before preconnecting. Otherwise, // the preconnection logic will wait for the result of the second // DNS request, which should arrive after the result of the first // one. Note that we however need to wait for the main thread to be // available in this case, since the preconnection will be sent from // AsyncTask.onPostExecute(), which may delay it. if (mDnsRequestsInFlight.contains(url)) { // Note that if two requests come for the same URL with two // different profiles, the last one will win. mPendingPreconnectWithProfile.put(url, profile); } else { nativePreconnectUrlAndSubresources(profile, url); } } }
Example #9
Source File: DataReductionPreferences.java From 365browser with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PreferenceUtils.addPreferencesFromResource(this, R.xml.data_reduction_preferences); getActivity().setTitle(R.string.data_reduction_title); boolean isEnabled = DataReductionProxySettings.getInstance().isDataReductionProxyEnabled(); mIsEnabled = !isEnabled; mWasEnabledAtCreation = isEnabled; updatePreferences(isEnabled); setHasOptionsMenu(true); if (getActivity() != null) { mFromPromo = IntentUtils.safeGetBooleanExtra(getActivity().getIntent(), DataReductionPromoSnackbarController.FROM_PROMO, false); mFromMainMenu = IntentUtils.safeGetBooleanExtra( getActivity().getIntent(), FROM_MAIN_MENU, false); } }
Example #10
Source File: DataReductionStatsPreference.java From 365browser with Apache License 2.0 | 6 votes |
/** * Updates the preference screen to convey current statistics on data reduction. */ public void updateReductionStatistics() { long original[] = DataReductionProxySettings.getInstance().getOriginalNetworkStatsHistory(); long received[] = DataReductionProxySettings.getInstance().getReceivedNetworkStatsHistory(); mCurrentTime = DataReductionProxySettings.getInstance().getDataReductionLastUpdateTime(); mRightPosition = mCurrentTime + DateUtils.HOUR_IN_MILLIS - TimeZone.getDefault().getOffset(mCurrentTime); mLeftPosition = mCurrentTime - DateUtils.DAY_IN_MILLIS * DAYS_IN_CHART; mOriginalNetworkStatsHistory = getNetworkStatsHistory(original, DAYS_IN_CHART); mReceivedNetworkStatsHistory = getNetworkStatsHistory(received, DAYS_IN_CHART); if (mDataReductionBreakdownView != null) { DataReductionProxySettings.getInstance().queryDataUsage( DAYS_IN_CHART, new Callback<List<DataReductionDataUseItem>>() { @Override public void onResult(List<DataReductionDataUseItem> result) { mDataReductionBreakdownView.onQueryDataUsageComplete(result); } }); } }
Example #11
Source File: WarmupManager.java From delion with Apache License 2.0 | 6 votes |
/** Asynchronously preconnects to a given URL if the data reduction proxy is not in use. * * @param profile The profile to use for the preconnection. * @param url The URL we want to preconnect to. */ public void maybePreconnectUrlAndSubResources(Profile profile, String url) { ThreadUtils.assertOnUiThread(); if (!DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) { // If there is already a DNS request in flight for this URL, then // the preconnection will start by issuing a DNS request for the // same domain, as the result is not cached. However, such a DNS // request has already been sent from this class, so it is better to // wait for the answer to come back before preconnecting. Otherwise, // the preconnection logic will wait for the result of the second // DNS request, which should arrive after the result of the first // one. Note that we however need to wait for the main thread to be // available in this case, since the preconnection will be sent from // AsyncTask.onPostExecute(), which may delay it. if (mDnsRequestsInFlight.contains(url)) { // Note that if two requests come for the same URL with two // different profiles, the last one will win. mPendingPreconnectWithProfile.put(url, profile); } else { nativePreconnectUrlAndSubresources(profile, url); } } }
Example #12
Source File: CustomTabsConnection.java From delion with Apache License 2.0 | 6 votes |
/** * High confidence mayLaunchUrl() call, that is: * - Tries to prerender if possible. * - An empty URL cancels the current prerender if any. * - If prerendering is not possible, makes sure that there is a spare renderer. */ private void highConfidenceMayLaunchUrl(CustomTabsSessionToken session, int uid, String url, Bundle extras, List<Bundle> otherLikelyBundles) { ThreadUtils.assertOnUiThread(); if (TextUtils.isEmpty(url)) { cancelPrerender(session); return; } url = DataReductionProxySettings.getInstance().maybeRewriteWebliteUrl(url); boolean noPrerendering = extras != null ? extras.getBoolean(NO_PRERENDERING_KEY, false) : false; WarmupManager.getInstance().maybePreconnectUrlAndSubResources( Profile.getLastUsedProfile(), url); boolean didStartPrerender = false; if (!noPrerendering && mayPrerender(session)) { didStartPrerender = prerenderUrl(session, url, extras, uid); } preconnectUrls(otherLikelyBundles); if (!didStartPrerender) createSpareWebContents(); }
Example #13
Source File: DataReductionStatsPreference.java From 365browser with Apache License 2.0 | 6 votes |
private static NetworkStatsHistory getNetworkStatsHistory(long[] history, int days) { if (days > history.length) days = history.length; NetworkStatsHistory networkStatsHistory = new NetworkStatsHistory( DateUtils.DAY_IN_MILLIS, days, NetworkStatsHistory.FIELD_RX_BYTES); DataReductionProxySettings config = DataReductionProxySettings.getInstance(); long time = config.getDataReductionLastUpdateTime() - days * DateUtils.DAY_IN_MILLIS; for (int i = history.length - days, bucket = 0; i < history.length; i++, bucket++) { NetworkStats.Entry entry = new NetworkStats.Entry(); entry.rxBytes = history[i]; long startTime = time + (DateUtils.DAY_IN_MILLIS * bucket); // Spread each day's record over the first hour of the day. networkStatsHistory.recordData(startTime, startTime + DateUtils.HOUR_IN_MILLIS, entry); } return networkStatsHistory; }
Example #14
Source File: ChromeTabbedActivity.java From 365browser with Apache License 2.0 | 5 votes |
@Override protected AppMenuPropertiesDelegate createAppMenuPropertiesDelegate() { return new AppMenuPropertiesDelegate(this) { private boolean showDataSaverFooter() { return getBottomSheet() == null && DataReductionProxySettings.getInstance() .shouldUseDataReductionMainMenuItem(); } @Override public int getFooterResourceId() { if (getBottomSheet() != null) { boolean isPageMenu = !isTablet() && !isInOverviewMode(); return isPageMenu ? R.layout.icon_row_menu_footer : 0; } return showDataSaverFooter() ? R.layout.data_reduction_main_menu_footer : 0; } @Override public boolean shouldShowFooter(int maxMenuHeight) { if (showDataSaverFooter()) { return maxMenuHeight >= getResources().getDimension( R.dimen.data_saver_menu_footer_min_show_height); } return super.shouldShowFooter(maxMenuHeight); } }; }
Example #15
Source File: DataReductionPromoInfoBarDelegate.java From 365browser with Apache License 2.0 | 5 votes |
/** * When the infobar closes and the data reduction proxy is not enabled, record that the infobar * was dismissed. */ @CalledByNative private static void onNativeDestroyed() { if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) return; DataReductionProxyUma .dataReductionProxyUIAction(DataReductionProxyUma.ACTION_INFOBAR_DISMISSED); }
Example #16
Source File: DataReductionPreferences.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Updates the preference screen to convey current statistics on data reduction. */ public void updateReductionStatistics() { DataReductionProxySettings config = DataReductionProxySettings.getInstance(); DataReductionStatsPreference statsPref = (DataReductionStatsPreference) getPreferenceScreen().findPreference(PREF_DATA_REDUCTION_STATS); long original[] = config.getOriginalNetworkStatsHistory(); long received[] = config.getReceivedNetworkStatsHistory(); statsPref.setReductionStats( config.getDataReductionLastUpdateTime(), getNetworkStatsHistory(original, DAYS_IN_CHART), getNetworkStatsHistory(received, DAYS_IN_CHART)); }
Example #17
Source File: DataReductionPreferences.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Returns summary string. */ public static String generateSummary(Resources resources) { if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) { String percent = DataReductionProxySettings.getInstance() .getContentLengthPercentSavings(); return resources.getString( R.string.data_reduction_menu_item_summary, percent); } else { return (String) resources.getText(R.string.text_off); } }
Example #18
Source File: DataReductionPromoInfoBarDelegate.java From 365browser with Apache License 2.0 | 5 votes |
/** * Enables the data reduction proxy, records uma, and shows a confirmation toast. * * @param isPrimaryButton Whether the primary infobar button was clicked. * @param context An Android context. */ @CalledByNative private static void accept() { Context context = ContextUtils.getApplicationContext(); DataReductionProxyUma .dataReductionProxyUIAction(DataReductionProxyUma.ACTION_INFOBAR_ENABLED); DataReductionProxySettings.getInstance().setDataReductionProxyEnabled( context, true); Toast.makeText(context, context.getString(R.string.data_reduction_enabled_toast), Toast.LENGTH_LONG).show(); }
Example #19
Source File: DataReductionStatsPreference.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Sets up a data usage chart and text views containing data reduction statistics. * @oaram view The current view. */ @Override protected void onBindView(View view) { super.onBindView(view); if (mOriginalTotalPhrase == null) updateDetailData(); mOriginalSizeTextView = (TextView) view.findViewById(R.id.data_reduction_original_size); mOriginalSizeTextView.setText(mOriginalTotalPhrase); mReceivedSizeTextView = (TextView) view.findViewById(R.id.data_reduction_compressed_size); mReceivedSizeTextView.setText(mReceivedTotalPhrase); mPercentReductionTextView = (TextView) view.findViewById(R.id.data_reduction_percent); mPercentReductionTextView.setText(mPercentReductionPhrase); mStartDateTextView = (TextView) view.findViewById(R.id.data_reduction_start_date); mStartDateTextView.setText(mStartDatePhrase); mEndDateTextView = (TextView) view.findViewById(R.id.data_reduction_end_date); mEndDateTextView.setText(mEndDatePhrase); mChartDataUsageView = (ChartDataUsageView) view.findViewById(R.id.chart); mChartDataUsageView.bindOriginalNetworkStats(mOriginalNetworkStatsHistory); mChartDataUsageView.bindCompressedNetworkStats(mReceivedNetworkStatsHistory); mChartDataUsageView.setVisibleRange( mCurrentTime - DateUtils.DAY_IN_MILLIS * DAYS_IN_CHART, mCurrentTime + DateUtils.HOUR_IN_MILLIS, mLeftPosition, mRightPosition); View dataReductionProxyUnreachableWarning = view.findViewById(R.id.data_reduction_proxy_unreachable); if (DataReductionProxySettings.getInstance().isDataReductionProxyUnreachable()) { dataReductionProxyUnreachableWarning.setVisibility(View.VISIBLE); } else { dataReductionProxyUnreachableWarning.setVisibility(View.GONE); } }
Example #20
Source File: DataReductionPromoUtils.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Returns whether any of the data reduction proxy promotions can be displayed. Checks if the * proxy is allowed by the DataReductionProxyConfig, already on, or if the user is managed. If * the data reduction proxy is managed by an administrator's policy, the user should not be * given a promotion to enable it. * * @return Whether the any data reduction proxy promotion has been displayed. */ public static boolean canShowPromos() { if (!DataReductionProxySettings.getInstance().isDataReductionProxyPromoAllowed()) { return false; } if (DataReductionProxySettings.getInstance().isDataReductionProxyManaged()) return false; if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) return false; return true; }
Example #21
Source File: DataReductionPromoInfoBarDelegate.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Enables the data reduction proxy, records uma, and shows a confirmation toast. * * @param isPrimaryButton Whether the primary infobar button was clicked. * @param context An Android context. */ @CalledByNative private static void accept() { Context context = ContextUtils.getApplicationContext(); DataReductionProxyUma .dataReductionProxyUIAction(DataReductionProxyUma.ACTION_INFOBAR_ENABLED); DataReductionProxySettings.getInstance().setDataReductionProxyEnabled( context, true); Toast.makeText(context, context.getString(R.string.data_reduction_enabled_toast), Toast.LENGTH_LONG).show(); }
Example #22
Source File: DataReductionPromoInfoBarDelegate.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * When the infobar closes and the data reduction proxy is not enabled, record that the infobar * was dismissed. */ @CalledByNative private static void onNativeDestroyed() { if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) return; DataReductionProxyUma .dataReductionProxyUIAction(DataReductionProxyUma.ACTION_INFOBAR_DISMISSED); }
Example #23
Source File: DataReductionPreferences.java From 365browser with Apache License 2.0 | 5 votes |
/** * Returns summary string. */ public static String generateSummary(Resources resources) { if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) { String percent = DataReductionProxySettings.getInstance() .getContentLengthPercentSavings(); return resources.getString( R.string.data_reduction_menu_item_summary, percent); } else { return (String) resources.getText(R.string.text_off); } }
Example #24
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 #25
Source File: DataReductionPromoUtils.java From 365browser with Apache License 2.0 | 5 votes |
/** * Returns whether any of the data reduction proxy promotions can be displayed. Checks if the * proxy is allowed by the DataReductionProxyConfig, already on, or if the user is managed. If * the data reduction proxy is managed by an administrator's policy, the user should not be * given a promotion to enable it. * * @return Whether the any data reduction proxy promotion has been displayed. */ public static boolean canShowPromos() { if (!DataReductionProxySettings.getInstance().isDataReductionProxyPromoAllowed()) { return false; } if (DataReductionProxySettings.getInstance().isDataReductionProxyManaged()) return false; if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) return false; return true; }
Example #26
Source File: CustomTabsConnection.java From 365browser with Apache License 2.0 | 5 votes |
@VisibleForTesting boolean maySpeculate(CustomTabsSessionToken session) { if (!DeviceClassManager.enablePrerendering()) return false; PrefServiceBridge prefs = PrefServiceBridge.getInstance(); if (prefs.isBlockThirdPartyCookiesEnabled()) return false; // TODO(yusufo): The check for prerender in PrivacyManager now checks for the network // connection type as well, we should either change that or add another check for custom // tabs. Then PrivacyManager should be used to make the below check. if (!prefs.getNetworkPredictionEnabled()) return false; if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) return false; ConnectivityManager cm = (ConnectivityManager) mApplication.getApplicationContext().getSystemService( Context.CONNECTIVITY_SERVICE); return !cm.isActiveNetworkMetered() || shouldPrerenderOnCellularForSession(session); }
Example #27
Source File: WarmupManager.java From 365browser with Apache License 2.0 | 5 votes |
/** Launches a background DNS query for a given URL if the data reduction proxy is not in use. * * @param context The Application context. * @param url URL from which the domain to query is extracted. */ public void maybePrefetchDnsForUrlInBackground(Context context, String url) { ThreadUtils.assertOnUiThread(); if (!DataReductionProxySettings.isEnabledBeforeNativeLoad(context)) { prefetchDnsForUrlInBackground(url); } }
Example #28
Source File: TabContextMenuItemDelegate.java From 365browser with Apache License 2.0 | 5 votes |
/** * Checks if spdy proxy is enabled for input url. * @param url Input url to check for spdy setting. * @return true if url is enabled for spdy proxy. */ private boolean isSpdyProxyEnabledForUrl(String url) { if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled() && url != null && !url.toLowerCase(Locale.US).startsWith( UrlConstants.HTTPS_URL_PREFIX) && !isIncognito()) { return true; } return false; }
Example #29
Source File: DataReductionPromoScreen.java From 365browser with Apache License 2.0 | 5 votes |
private void handleEnableButtonPressed() { DataReductionProxySettings.getInstance().setDataReductionProxyEnabled( getContext(), true); dismiss(); Toast.makeText(getContext(), getContext().getString(R.string.data_reduction_enabled_toast), Toast.LENGTH_LONG).show(); }
Example #30
Source File: WarmupManager.java From delion with Apache License 2.0 | 5 votes |
/** Launches a background DNS query for a given URL if the data reduction proxy is not in use. * * @param context The Application context. * @param url URL from which the domain to query is extracted. */ public void maybePrefetchDnsForUrlInBackground(Context context, String url) { ThreadUtils.assertOnUiThread(); if (!DataReductionProxySettings.isEnabledBeforeNativeLoad(context)) { prefetchDnsForUrlInBackground(url); } }