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 693e18979b7f27ea428e316dfc06a1a89831619f..2ec93aa8e2794d2f3585c564d702934bfef0e409 100644 |
--- a/third_party/google_input_tools/src/chrome/os/statistics.js |
+++ b/third_party/google_input_tools/src/chrome/os/statistics.js |
@@ -231,37 +231,39 @@ Statistics.prototype.recordCommit = function( |
if (!this.inputMethodId_) { |
return; |
} |
- var length = target.length; |
- // Increment to include space. |
- if (triggerType == TriggerType.RESET) { |
- length++; |
- } else if (triggerType == TriggerType.REVERT) { |
- length -= this.lastCommitLength_; |
- } |
- this.lastCommitLength_ = length; |
- this.charactersCommitted_ += length; |
- |
var CommitTypes = Statistics.CommitTypes; |
var commitType = -1; |
- if (targetIndex == 0 && source == target) { |
- commitType = CommitTypes.X_X0; |
- } else if (targetIndex == 0 && source != target) { |
- commitType = CommitTypes.X_Y0; |
- } else if (targetIndex == 1 && source == target) { |
- commitType = CommitTypes.X_X1; |
- } else if (targetIndex == 1 && source != target) { |
- commitType = CommitTypes.X_Y1; |
- } else if (targetIndex > 1 && source == target) { |
- commitType = CommitTypes.X_X2; |
- } else if (targetIndex > 1 && source != target) { |
- commitType = CommitTypes.X_Y2; |
- } else if (!source && source != target) { |
- commitType = CommitTypes.PREDICTION; |
- } else if (triggerType == TriggerType.REVERT) { |
+ var length = target.length; |
+ |
+ if (triggerType == TriggerType.REVERT) { |
+ length -= this.lastCommitLength_; |
commitType = CommitTypes.REVERT; |
} else if (triggerType == TriggerType.VOICE) { |
commitType = CommitTypes.VOICE; |
+ } else if (triggerType == TriggerType.RESET) { |
+ // Increment to include space. |
+ length++; |
+ } else if (triggerType == TriggerType.CANDIDATE || |
+ triggerType == TriggerType.SPACE) { |
+ if (!source && target) { |
+ commitType = CommitTypes.PREDICTION; |
+ } else if (targetIndex == 0 && source == target) { |
+ commitType = CommitTypes.X_X0; |
+ } else if (targetIndex == 0 && source != target) { |
+ commitType = CommitTypes.X_Y0; |
+ } else if (targetIndex == 1 && source == target) { |
+ commitType = CommitTypes.X_X1; |
+ } else if (targetIndex == 1 && source != target) { |
+ commitType = CommitTypes.X_Y1; |
+ } else if (targetIndex > 1 && source == target) { |
+ commitType = CommitTypes.X_X2; |
+ } else if (targetIndex > 1 && source != target) { |
+ commitType = CommitTypes.X_Y2; |
+ } |
} |
+ this.lastCommitLength_ = length; |
+ this.charactersCommitted_ += length; |
+ |
if (commitType < 0) { |
return; |
} |