/**
  * 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();
 }
 /**
  * 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("https://")
       && !isIncognito()) {
     return true;
   }
   return false;
 }
 /**
  * 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);
 }
Ejemplo n.º 4
0
 protected boolean shouldShowDataReductionPage() {
   return !DataReductionProxySettings.getInstance().isDataReductionProxyManaged()
       && FieldTrialList.findFullName("DataReductionProxyFREPromo").startsWith("Enabled");
 }