Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1981)

Unified Diff: ash/common/system/chromeos/ime_menu/ime_menu_tray.cc

Issue 2600173002: Add metrics to track buttons clicked in IME menu tray. (Closed)
Patch Set: sync Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
diff --git a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
index db6d2a0a6d772bcb04292a40f902ad5ffbadc3ff..d005e1e6cfe5bd63f59962337cc9e46529793a4f 100644
--- a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
+++ b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
@@ -26,6 +26,7 @@
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window.h"
#include "ash/public/cpp/shell_window_ids.h"
+#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
@@ -68,6 +69,28 @@ void ShowIMESettings() {
WmShell::Get()->system_tray_controller()->ShowIMESettings();
}
+// Records the number of times users click buttons in opt-in IME menu.
+void RecordButtonsClicked(const std::string& button_name) {
+ enum {
+ UNKNOWN = 0,
+ EMOJI = 1,
+ HANDWRITING = 2,
+ VOICE = 3,
+ // SETTINGS is not used for now.
+ SETTINGS = 4,
+ BUTTON_MAX
+ } button = UNKNOWN;
+ if (button_name == "emoji") {
+ button = EMOJI;
+ } else if (button_name == "hwt") {
+ button = HANDWRITING;
+ } else if (button_name == "voice") {
+ button = VOICE;
+ }
+ UMA_HISTOGRAM_ENUMERATION("InputMethod.ImeMenu.EmojiHandwritingVoiceButton",
+ button, BUTTON_MAX);
+}
+
// Returns true if the current screen is login or lock screen.
bool IsInLoginOrLockScreen() {
LoginStatus login =
@@ -202,14 +225,18 @@ class ImeButtonsView : public views::View,
// extensions. InputMethodManager::ShowKeyboardWithKeyset() will deal with
// the |keyset| string to generate the right input view url.
std::string keyset;
- if (sender == emoji_button_)
+ if (sender == emoji_button_) {
keyset = "emoji";
- else if (sender == voice_button_)
+ RecordButtonsClicked(keyset);
+ } else if (sender == voice_button_) {
keyset = "voice";
- else if (sender == handwriting_button_)
+ RecordButtonsClicked(keyset);
+ } else if (sender == handwriting_button_) {
keyset = "hwt";
- else
+ RecordButtonsClicked(keyset);
+ } else {
NOTREACHED();
+ }
ime_menu_tray_->ShowKeyboardWithKeyset(keyset);
}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698