Add support for user actions to the metrics library and the metrics clients.
BUG=10696
TEST=unit tests, tested on the device through metrics_client and inspecting
the uma-events file.
Change-Id: Ie39dd8b5ab968c328993076369a4ba14cb7fcd81
Review URL: http://codereview.chromium.org/6094010
diff --git a/metrics/metrics_library.cc b/metrics/metrics_library.cc
index f720972..05e63ac 100644
--- a/metrics/metrics_library.cc
+++ b/metrics/metrics_library.cc
@@ -221,7 +221,6 @@
FormatChromeMessage(kBufferSize, message,
"histogram%c%s %d %d %d %d", '\0',
name.c_str(), sample, min, max, nbuckets);
-
if (message_length < 0)
return false;
@@ -237,7 +236,19 @@
FormatChromeMessage(kBufferSize, message,
"linearhistogram%c%s %d %d", '\0',
name.c_str(), sample, max);
+ if (message_length < 0)
+ return false;
+ // Send the message.
+ return SendMessageToChrome(message_length, message);
+}
+
+bool MetricsLibrary::SendUserActionToUMA(const std::string& action) {
+ // Format the message.
+ char message[kBufferSize];
+ int32_t message_length =
+ FormatChromeMessage(kBufferSize, message,
+ "useraction%c%s", '\0', action.c_str());
if (message_length < 0)
return false;