Bug 1212363 - Add Telemetry to |Bookmark Added| Dialog and its actions, r=mfinkle

This commit is contained in:
Mark Capella 2015-10-13 17:46:55 -04:00
Родитель 20babcff4f
Коммит e6110504b2
1 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -571,6 +571,8 @@ public class BrowserApp extends GeckoApp
new ButtonToast.ToastListener() { new ButtonToast.ToastListener() {
@Override @Override
public void onButtonClicked() { public void onButtonClicked() {
Telemetry.sendUIEvent(TelemetryContract.Event.SHOW,
TelemetryContract.Method.TOAST, "bookmark_options");
showBookmarkDialog(); showBookmarkDialog();
} }
@ -1192,7 +1194,9 @@ public class BrowserApp extends GeckoApp
} }
private void showBookmarkDialog() { private void showBookmarkDialog() {
final Resources res = getResources();
final Tab tab = Tabs.getInstance().getSelectedTab(); final Tab tab = Tabs.getInstance().getSelectedTab();
final Prompt ps = new Prompt(this, new Prompt.PromptCallback() { final Prompt ps = new Prompt(this, new Prompt.PromptCallback() {
@Override @Override
public void onPromptFinished(String result) { public void onPromptFinished(String result) {
@ -1203,12 +1207,21 @@ public class BrowserApp extends GeckoApp
Log.e(LOGTAG, "Exception reading bookmark prompt result", ex); Log.e(LOGTAG, "Exception reading bookmark prompt result", ex);
} }
if (tab == null) if (tab == null) {
return; return;
}
if (itemId == 0) { if (itemId == 0) {
final String extrasId = res.getResourceEntryName(R.string.contextmenu_edit_bookmark);
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION,
TelemetryContract.Method.DIALOG, extrasId);
new EditBookmarkDialog(BrowserApp.this).show(tab.getURL()); new EditBookmarkDialog(BrowserApp.this).show(tab.getURL());
} else if (itemId == 1) { } else if (itemId == 1) {
final String extrasId = res.getResourceEntryName(R.string.contextmenu_add_to_launcher);
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION,
TelemetryContract.Method.DIALOG, extrasId);
String url = tab.getURL(); String url = tab.getURL();
String title = tab.getDisplayTitle(); String title = tab.getDisplayTitle();
Bitmap favicon = tab.getFavicon(); Bitmap favicon = tab.getFavicon();
@ -1220,7 +1233,6 @@ public class BrowserApp extends GeckoApp
}); });
final PromptListItem[] items = new PromptListItem[2]; final PromptListItem[] items = new PromptListItem[2];
Resources res = getResources();
items[0] = new PromptListItem(res.getString(R.string.contextmenu_edit_bookmark)); items[0] = new PromptListItem(res.getString(R.string.contextmenu_edit_bookmark));
items[1] = new PromptListItem(res.getString(R.string.contextmenu_add_to_launcher)); items[1] = new PromptListItem(res.getString(R.string.contextmenu_add_to_launcher));
@ -1367,6 +1379,8 @@ public class BrowserApp extends GeckoApp
LoadFaviconTask.FLAG_PERSIST, LoadFaviconTask.FLAG_PERSIST,
listener); listener);
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU,
getResources().getResourceEntryName(itemId));
return true; return true;
} }