Commit c378166d authored by ramyasharma's avatar ramyasharma Committed by Commit bot

Adds translate infobar impression in the old Translate UI on Android

This is added so that we can compare the impressions in old UI and
the new one.

BUG=720231

Review-Url: https://codereview.chromium.org/2897233002
Cr-Commit-Position: refs/heads/master@{#474961}
parent 417a58a0
......@@ -14,6 +14,7 @@ import android.text.style.ClickableSpan;
import android.view.View;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.R;
import org.chromium.ui.base.DeviceFormFactor;
......@@ -42,6 +43,8 @@ public class TranslateInfoBar extends InfoBar implements SubPanelListener {
private TranslateSubPanel mSubPanel;
private final boolean mShouldShowNeverBar;
private static final String INFOBAR_IMPRESSION_HISTOGRAM = "Translate.InfobarShown";
@CalledByNative
private static InfoBar show(int translateBarType, String sourceLanguageCode,
String targetLanguageCode, boolean alwaysTranslate, boolean showNeverInfobar,
......@@ -173,6 +176,16 @@ public class TranslateInfoBar extends InfoBar implements SubPanelListener {
@Override
public void createContent(InfoBarLayout layout) {
// Log infobar impression only when the infobar shown is either in step: before translate
// or in step: translating and always enabled is true. This is to remove duplicate
// impressions.
int infoBarType = getInfoBarType();
if (infoBarType == BEFORE_TRANSLATE_INFOBAR
|| (mOptions.alwaysTranslateLanguageState()
&& infoBarType == TRANSLATING_INFOBAR)) {
RecordHistogram.recordBooleanHistogram(INFOBAR_IMPRESSION_HISTOGRAM, true);
}
if (mOptionsPanelViewType == NO_PANEL) {
mSubPanel = null;
} else {
......
......@@ -77039,6 +77039,14 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>
<histogram name="Translate.InfobarShown" enum="BooleanHit">
<owner>ramyasharma@google.com</owner>
<summary>
The number of times the translate infobar was shown in the UI on Android.
Only true is recorded.
</summary>
</histogram>
<histogram name="Translate.InitiationStatus" enum="TranslateInitiationStatus">
<obsolete>
Deprecated as of 11/2013, and replaced by Translate.InitiationStatus.v2.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment