/**
  * 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;
 }
 /**
  * For extending classes to carry out tasks that initialize the browser process. Should be called
  * almost immediately after the native library has loaded to initialize things that really, really
  * have to be set up early. Avoid putting any long tasks here.
  */
 public void initializeProcess() {
   DataReductionProxySettings.reconcileDataReductionProxyEnabledState(getApplicationContext());
 }
 /**
  * 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);
 }
Пример #5
0
 protected boolean shouldShowDataReductionPage() {
   return !DataReductionProxySettings.getInstance().isDataReductionProxyManaged()
       && FieldTrialList.findFullName("DataReductionProxyFREPromo").startsWith("Enabled");
 }