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

Unified Diff: third_party/google_input_tools/src/chrome/os/statistics.js

Issue 975453003: Update Google Input Tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « third_party/google_input_tools/src/chrome/os/message/name.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/google_input_tools/src/chrome/os/statistics.js
diff --git a/third_party/google_input_tools/src/chrome/os/statistics.js b/third_party/google_input_tools/src/chrome/os/statistics.js
index af1d9f89cf1a71d6fb65d923262ab5752ae1c7ae..d08a0040e71053419d5831e5b0e4ad387e20e0f7 100644
--- a/third_party/google_input_tools/src/chrome/os/statistics.js
+++ b/third_party/google_input_tools/src/chrome/os/statistics.js
@@ -95,6 +95,22 @@ Statistics.prototype.isPhysicalKeyboard_ = false;
/**
+ * The length of the last text commit.
+ *
+ * @private {number}
+ */
+Statistics.prototype.lastCommitLength_ = 0;
+
+
+/**
+ * The number of characters typed in this session.
+ *
+ * @private {number}
+ */
+Statistics.prototype.charactersCommitted_ = 0;
+
+
+/**
* Sets whether recording for physical keyboard.
*
* @param {boolean} isPhysicalKeyboard .
@@ -152,6 +168,22 @@ Statistics.prototype.getTargetType_ = function(
/**
+ * Records that the controller session ended.
+ */
+Statistics.prototype.recordSessionEnd = function() {
+ // Do not record cases where we gain and immediately lose focus. This also
+ // excudes the focus loss-gain on the new tab page from being counted.
+ if (this.charactersCommitted_ > 0) {
+ this.recordValue('InputMethod.VirtualKeyboard.CharactersCommitted',
+ this.charactersCommitted_, 16384, 50);
+ // TODO: Add WPM metrics.
+ }
+ this.charactersCommitted_ = 0;
+ this.lastCommitLength_ = 0;
+};
+
+
+/**
* Records the metrics for each commit.
*
* @param {string} source .
@@ -166,6 +198,16 @@ Statistics.prototype.recordCommit = function(
if (!this.inputMethodId_) {
return;
}
+ var length = target.length;
+ // Increment to include space.
+ if (triggerType == 0) {
+ length++;
+ } else if (triggerType == 5) {
+ length -= this.lastCommitLength_;
+ }
+ this.lastCommitLength_ = length;
+ this.charactersCommitted_ += length;
+
var CommitTypes = Statistics.CommitTypes;
var commitType = -1;
if (targetIndex == 0 && source == target) {
« no previous file with comments | « third_party/google_input_tools/src/chrome/os/message/name.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698