コード例 #1
0
 /**
  * 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();
 }
コード例 #2
0
 /**
  * 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);
 }