Bug 1029834 - Make contextmenu/menu telemetry more consistent. r=mfinkle

This commit is contained in:
Chenxia Liu 2014-06-25 14:10:49 -07:00
parent ffcfa7099c
commit bca561954a
2 changed files with 19 additions and 1 deletions

View File

@ -758,12 +758,17 @@ public class BrowserApp extends GeckoApp
if (!TextUtils.isEmpty(text)) {
Tabs.getInstance().loadUrl(text);
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.CONTEXT_MENU);
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "pasteandgo");
}
return true;
}
if (itemId == R.id.site_settings) {
// This can be selected from either the browser menu or the contextmenu, depending on the size and version (v11+) of the phone.
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Permissions:Get", null));
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "site_settings");
}
return true;
}
@ -771,11 +776,13 @@ public class BrowserApp extends GeckoApp
String text = Clipboard.getText();
if (!TextUtils.isEmpty(text)) {
enterEditingMode(text);
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "paste");
}
return true;
}
if (itemId == R.id.subscribe) {
// 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.hasFeeds()) {
JSONObject args = new JSONObject();
@ -785,6 +792,9 @@ public class BrowserApp extends GeckoApp
Log.e(LOGTAG, "error building json arguments");
}
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Feeds:Subscribe", args.toString()));
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "subscribe");
}
}
return true;
}
@ -815,6 +825,7 @@ public class BrowserApp extends GeckoApp
String url = tab.getURL();
if (url != null) {
Clipboard.setText(url);
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "copyurl");
}
}
return true;

View File

@ -518,7 +518,8 @@ var SelectionHandler = {
id: "selectall_action",
icon: "drawable://ab_select_all",
action: function(aElement) {
SelectionHandler.startSelection(aElement)
SelectionHandler.startSelection(aElement);
UITelemetry.addEvent("action.1", "actionbar", null, "select_all");
},
order: 5,
selector: {
@ -541,6 +542,7 @@ var SelectionHandler = {
// copySelection closes the selection. Show a caret where we just cut the text.
SelectionHandler.attachCaret(aElement);
UITelemetry.addEvent("action.1", "actionbar", null, "cut");
},
order: 4,
selector: {
@ -557,6 +559,7 @@ var SelectionHandler = {
icon: "drawable://ab_copy",
action: function() {
SelectionHandler.copySelection();
UITelemetry.addEvent("action.1", "actionbar", null, "copy");
},
order: 3,
selector: {
@ -581,6 +584,7 @@ var SelectionHandler = {
target.editor.paste(Ci.nsIClipboard.kGlobalClipboard);
target.focus();
SelectionHandler._closeSelection();
UITelemetry.addEvent("action.1", "actionbar", null, "paste");
}
},
order: 2,
@ -601,6 +605,7 @@ var SelectionHandler = {
icon: "drawable://ic_menu_share",
action: function() {
SelectionHandler.shareSelection();
UITelemetry.addEvent("action.1", "actionbar", null, "share");
},
selector: {
matches: function() {
@ -618,6 +623,7 @@ var SelectionHandler = {
action: function() {
SelectionHandler.searchSelection();
SelectionHandler._closeSelection();
UITelemetry.addEvent("action.1", "actionbar", null, "search");
},
order: 1,
selector: {
@ -633,6 +639,7 @@ var SelectionHandler = {
icon: "drawable://phone",
action: function() {
SelectionHandler.callSelection();
UITelemetry.addEvent("action.1", "actionbar", null, "call");
},
order: 1,
selector: {