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

Side by Side Diff: third_party/google_input_tools/src/chrome/os/statistics.js

Issue 899673003: Uprev 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 unified diff | Download patch
« no previous file with comments | « third_party/google_input_tools/src/chrome/os/sounds.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved. 1 // Copyright 2014 The ChromeOS IME Authors. All Rights Reserved.
2 // limitations under the License. 2 // limitations under the License.
3 // See the License for the specific language governing permissions and 3 // See the License for the specific language governing permissions and
4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5 // distributed under the License is distributed on an "AS-IS" BASIS, 5 // distributed under the License is distributed on an "AS-IS" BASIS,
6 // Unless required by applicable law or agreed to in writing, software 6 // Unless required by applicable law or agreed to in writing, software
7 // 7 //
8 // http://www.apache.org/licenses/LICENSE-2.0 8 // http://www.apache.org/licenses/LICENSE-2.0
9 // 9 //
10 // You may obtain a copy of the License at 10 // You may obtain a copy of the License at
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 /** 73 /**
74 * The current auto correct level. 74 * The current auto correct level.
75 * 75 *
76 * @type {number} 76 * @type {number}
77 * @private 77 * @private
78 */ 78 */
79 Statistics.prototype.autoCorrectLevel_ = 0; 79 Statistics.prototype.autoCorrectLevel_ = 0;
80 80
81 81
82 /** 82 /**
83 * Whether recording for physical keyboard specially.
84 *
85 * @private {boolean}
86 */
87 Statistics.prototype.isPhysicalKeyboard_ = false;
88
89
90 /**
91 * Sets whether recording for physical keyboard.
92 *
93 * @param {boolean} isPhysicalKeyboard .
94 */
95 Statistics.prototype.setPhysicalKeyboard = function(isPhysicalKeyboard) {
96 this.isPhysicalKeyboard_ = isPhysicalKeyboard;
97 };
98
99
100 /**
83 * Sets the current input method id. 101 * Sets the current input method id.
84 * 102 *
85 * @param {string} inputMethodId . 103 * @param {string} inputMethodId .
86 */ 104 */
87 Statistics.prototype.setInputMethodId = function( 105 Statistics.prototype.setInputMethodId = function(
88 inputMethodId) { 106 inputMethodId) {
89 this.inputMethodId_ = inputMethodId; 107 this.inputMethodId_ = inputMethodId;
90 }; 108 };
91 109
92 110
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 commitType = CommitTypes.X_Y1; 171 commitType = CommitTypes.X_Y1;
154 } else if (!source && this.getTargetType_(source, target) == 3) { 172 } else if (!source && this.getTargetType_(source, target) == 3) {
155 commitType = CommitTypes.PREDICTION; 173 commitType = CommitTypes.PREDICTION;
156 } else if (triggerType == 5) { 174 } else if (triggerType == 5) {
157 commitType = CommitTypes.REVERT; 175 commitType = CommitTypes.REVERT;
158 } 176 }
159 if (commitType < 0) { 177 if (commitType < 0) {
160 return; 178 return;
161 } 179 }
162 180
181 // For latin transliteration, record the logs under the name with 'Pk' which
182 // means Physical Keyboard.
183 var name = this.isPhysicalKeyboard_ ?
184 'InputMethod.PkCommit.' : 'InputMethod.Commit.';
185
163 var self = this; 186 var self = this;
164 var record = function(suffix) { 187 var record = function(suffix) {
165 self.recordEnum('InputMethod.Commit.Index' + suffix, 188 self.recordEnum(name + 'Index' + suffix, targetIndex + 1, 20);
166 targetIndex + 1, 20); 189 self.recordEnum(name + 'Type' + suffix, commitType, CommitTypes.MAX);
167 self.recordEnum('InputMethod.Commit.Type' + suffix,
168 commitType, CommitTypes.MAX);
169 }; 190 };
170 191
171 record(''); 192 record('');
172 193
173 if (/^pinyin/.test(this.inputMethodId_)) { 194 if (/^pinyin/.test(this.inputMethodId_)) {
174 record('.Pinyin'); 195 record('.Pinyin');
175 } else if (/^xkb:us/.test(this.inputMethodId_)) { 196 } else if (/^xkb:us/.test(this.inputMethodId_)) {
176 record('.US'); 197 record('.US');
177 record('.US.AC' + this.autoCorrectLevel_); 198 record('.US.AC' + this.autoCorrectLevel_);
178 } else if (/^xkb:fr/.test(this.inputMethodId_)) { 199 } else if (/^xkb:fr/.test(this.inputMethodId_)) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 chrome.metricsPrivate.recordValue({ 300 chrome.metricsPrivate.recordValue({
280 'metricName': name, 301 'metricName': name,
281 'type': 'histogram-log', 302 'type': 'histogram-log',
282 'min': 0, 303 'min': 0,
283 'max': max, 304 'max': max,
284 'buckets': bucketCount 305 'buckets': bucketCount
285 }, count); 306 }, count);
286 } 307 }
287 }; 308 };
288 }); // goog.scope 309 }); // goog.scope
OLDNEW
« no previous file with comments | « third_party/google_input_tools/src/chrome/os/sounds.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698