Bug 1007130 - Add UI telemetry for 'Adding a new search engine' button. r=mfinkle

This commit is contained in:
Chenxia Liu 2014-06-25 09:29:07 -07:00
parent 2a1ed8f696
commit 4d1a7dd2b9
2 changed files with 7 additions and 1 deletions

View File

@ -13,9 +13,9 @@ import java.util.List;
import java.util.Locale;
import java.util.Vector;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.mozilla.gecko.DynamicToolbar.PinReason;
import org.mozilla.gecko.DynamicToolbar.VisibilityTransition;
import org.mozilla.gecko.GeckoProfileDirectories.NoMozillaDirectoryException;
@ -790,6 +790,7 @@ public class BrowserApp extends GeckoApp
}
if (itemId == R.id.add_search_engine) {
// This can be selected from either the browser menu or the contextmenu, depending on the size and version (v11+) of the phone.
Tab tab = Tabs.getInstance().getSelectedTab();
if (tab != null && tab.hasOpenSearch()) {
JSONObject args = new JSONObject();
@ -800,6 +801,10 @@ public class BrowserApp extends GeckoApp
return true;
}
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:Add", args.toString()));
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "add_search_engine");
}
}
return true;
}

View File

@ -6820,6 +6820,7 @@ var SearchEngines = {
icon: "drawable://ab_add_search_engine",
selector: filter,
action: function(aElement) {
UITelemetry.addEvent("action.1", "actionbar", null, "add_search_engine");
SearchEngines.addEngine(aElement);
}
});