OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * A class of server log entries. | 7 * A class of server log entries. |
8 * | 8 * |
9 * Any changes to the values here need to be coordinated with the host and | 9 * Any changes to the values here need to be coordinated with the host and |
10 * server/log proto code. | 10 * server/log proto code. |
(...skipping 11 matching lines...) Expand all Loading... |
22 */ | 22 */ |
23 remoting.ServerLogEntry = function() { | 23 remoting.ServerLogEntry = function() { |
24 /** @type Object.<string, string> */ this.dict = {}; | 24 /** @type Object.<string, string> */ this.dict = {}; |
25 }; | 25 }; |
26 | 26 |
27 /** @private */ | 27 /** @private */ |
28 remoting.ServerLogEntry.KEY_EVENT_NAME_ = 'event-name'; | 28 remoting.ServerLogEntry.KEY_EVENT_NAME_ = 'event-name'; |
29 /** @private */ | 29 /** @private */ |
30 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_ = 'session-state'; | 30 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_ = 'session-state'; |
31 /** @private */ | 31 /** @private */ |
| 32 remoting.ServerLogEntry.VALUE_EVENT_NAME_SIGNAL_STRATEGY_PROGRESS_ = |
| 33 'signal-strategy-progress'; |
| 34 /** @private */ |
32 remoting.ServerLogEntry.KEY_SESSION_ID_ = 'session-id'; | 35 remoting.ServerLogEntry.KEY_SESSION_ID_ = 'session-id'; |
33 /** @private */ | 36 /** @private */ |
34 remoting.ServerLogEntry.KEY_ROLE_ = 'role'; | 37 remoting.ServerLogEntry.KEY_ROLE_ = 'role'; |
35 /** @private */ | 38 /** @private */ |
36 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_ = 'client'; | 39 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_ = 'client'; |
37 /** @private */ | 40 /** @private */ |
38 remoting.ServerLogEntry.KEY_SESSION_STATE_ = 'session-state'; | 41 remoting.ServerLogEntry.KEY_SESSION_STATE_ = 'session-state'; |
39 /** @private */ | 42 /** @private */ |
40 remoting.ServerLogEntry.KEY_CONNECTION_TYPE_ = 'connection-type'; | 43 remoting.ServerLogEntry.KEY_CONNECTION_TYPE_ = 'connection-type'; |
| 44 /** @private */ |
| 45 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_ = 'signal-strategy-type'; |
| 46 /** @private */ |
| 47 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_ = |
| 48 'signal-strategy-progress'; |
| 49 /** @private */ |
| 50 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_ELAPSED_TIME_ = |
| 51 'signal-strategy-elapsed-time'; |
41 | 52 |
42 /** | 53 /** |
43 * @private | 54 * @private |
44 * @param {remoting.ClientSession.State} state | 55 * @param {remoting.ClientSession.State} state |
45 * @return {string} | 56 * @return {string} |
46 */ | 57 */ |
47 remoting.ServerLogEntry.getValueForSessionState = function(state) { | 58 remoting.ServerLogEntry.getValueForSessionState_ = function(state) { |
48 switch(state) { | 59 switch(state) { |
49 case remoting.ClientSession.State.UNKNOWN: | 60 case remoting.ClientSession.State.UNKNOWN: |
50 return 'unknown'; | 61 return 'unknown'; |
51 case remoting.ClientSession.State.CREATED: | 62 case remoting.ClientSession.State.CREATED: |
52 return 'created'; | 63 return 'created'; |
53 case remoting.ClientSession.State.CONNECTING: | 64 case remoting.ClientSession.State.CONNECTING: |
54 return 'connecting'; | 65 return 'connecting'; |
55 case remoting.ClientSession.State.INITIALIZING: | 66 case remoting.ClientSession.State.INITIALIZING: |
56 return 'initializing'; | 67 return 'initializing'; |
57 case remoting.ClientSession.State.CONNECTED: | 68 case remoting.ClientSession.State.CONNECTED: |
(...skipping 12 matching lines...) Expand all Loading... |
70 }; | 81 }; |
71 | 82 |
72 /** @private */ | 83 /** @private */ |
73 remoting.ServerLogEntry.KEY_CONNECTION_ERROR_ = 'connection-error'; | 84 remoting.ServerLogEntry.KEY_CONNECTION_ERROR_ = 'connection-error'; |
74 | 85 |
75 /** | 86 /** |
76 * @private | 87 * @private |
77 * @param {remoting.Error} connectionError | 88 * @param {remoting.Error} connectionError |
78 * @return {string} | 89 * @return {string} |
79 */ | 90 */ |
80 remoting.ServerLogEntry.getValueForError = | 91 remoting.ServerLogEntry.getValueForError_ = function(connectionError) { |
81 function(connectionError) { | |
82 // Directory service should be updated if a new string is added here as | 92 // Directory service should be updated if a new string is added here as |
83 // otherwise the error code will be ignored (i.e. recorded as 0 instead). | 93 // otherwise the error code will be ignored (i.e. recorded as 0 instead). |
84 switch(connectionError) { | 94 switch(connectionError) { |
85 case remoting.Error.NONE: | 95 case remoting.Error.NONE: |
86 return 'none'; | 96 return 'none'; |
87 case remoting.Error.INVALID_ACCESS_CODE: | 97 case remoting.Error.INVALID_ACCESS_CODE: |
88 return 'invalid-access-code'; | 98 return 'invalid-access-code'; |
89 case remoting.Error.MISSING_PLUGIN: | 99 case remoting.Error.MISSING_PLUGIN: |
90 return 'missing_plugin'; | 100 return 'missing_plugin'; |
91 case remoting.Error.AUTHENTICATION_FAILED: | 101 case remoting.Error.AUTHENTICATION_FAILED: |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 /** @private */ | 178 /** @private */ |
169 remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_ = 'unknown'; | 179 remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_ = 'unknown'; |
170 | 180 |
171 /** | 181 /** |
172 * Sets one field in this log entry. | 182 * Sets one field in this log entry. |
173 * | 183 * |
174 * @private | 184 * @private |
175 * @param {string} key | 185 * @param {string} key |
176 * @param {string} value | 186 * @param {string} value |
177 */ | 187 */ |
178 remoting.ServerLogEntry.prototype.set = function(key, value) { | 188 remoting.ServerLogEntry.prototype.set_ = function(key, value) { |
179 this.dict[key] = value; | 189 this.dict[key] = value; |
180 }; | 190 }; |
181 | 191 |
182 /** | 192 /** |
183 * Converts this object into an XML stanza. | 193 * Converts this object into an XML stanza. |
184 * | 194 * |
185 * @return {string} | 195 * @return {string} |
186 */ | 196 */ |
187 remoting.ServerLogEntry.prototype.toStanza = function() { | 197 remoting.ServerLogEntry.prototype.toStanza = function() { |
188 var stanza = '<gr:entry '; | 198 var stanza = '<gr:entry '; |
(...skipping 21 matching lines...) Expand all Loading... |
210 * Makes a log entry for a change of client session state. | 220 * Makes a log entry for a change of client session state. |
211 * | 221 * |
212 * @param {remoting.ClientSession.State} state | 222 * @param {remoting.ClientSession.State} state |
213 * @param {remoting.Error} connectionError | 223 * @param {remoting.Error} connectionError |
214 * @param {remoting.ClientSession.Mode} mode | 224 * @param {remoting.ClientSession.Mode} mode |
215 * @return {remoting.ServerLogEntry} | 225 * @return {remoting.ServerLogEntry} |
216 */ | 226 */ |
217 remoting.ServerLogEntry.makeClientSessionStateChange = function(state, | 227 remoting.ServerLogEntry.makeClientSessionStateChange = function(state, |
218 connectionError, mode) { | 228 connectionError, mode) { |
219 var entry = new remoting.ServerLogEntry(); | 229 var entry = new remoting.ServerLogEntry(); |
220 entry.set(remoting.ServerLogEntry.KEY_ROLE_, | 230 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
221 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); | 231 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); |
222 entry.set(remoting.ServerLogEntry.KEY_EVENT_NAME_, | 232 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, |
223 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_); | 233 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_); |
224 entry.set(remoting.ServerLogEntry.KEY_SESSION_STATE_, | 234 entry.set_(remoting.ServerLogEntry.KEY_SESSION_STATE_, |
225 remoting.ServerLogEntry.getValueForSessionState(state)); | 235 remoting.ServerLogEntry.getValueForSessionState_(state)); |
226 if (connectionError != remoting.Error.NONE) { | 236 if (connectionError != remoting.Error.NONE) { |
227 entry.set(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, | 237 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, |
228 remoting.ServerLogEntry.getValueForError(connectionError)); | 238 remoting.ServerLogEntry.getValueForError_(connectionError)); |
229 } | 239 } |
230 entry.addModeField(mode); | 240 entry.addModeField(mode); |
231 return entry; | 241 return entry; |
232 }; | 242 }; |
233 | 243 |
234 /** | 244 /** |
235 * Adds a session duration to a log entry. | 245 * Adds a session duration to a log entry. |
236 * | 246 * |
237 * @param {number} sessionDuration | 247 * @param {number} sessionDuration |
238 */ | 248 */ |
239 remoting.ServerLogEntry.prototype.addSessionDurationField = function( | 249 remoting.ServerLogEntry.prototype.addSessionDurationField = function( |
240 sessionDuration) { | 250 sessionDuration) { |
241 this.set(remoting.ServerLogEntry.KEY_SESSION_DURATION_, | 251 this.set_(remoting.ServerLogEntry.KEY_SESSION_DURATION_, |
242 sessionDuration.toString()); | 252 sessionDuration.toString()); |
243 }; | 253 }; |
244 | 254 |
245 /** | 255 /** |
246 * Makes a log entry for a set of connection statistics. | 256 * Makes a log entry for a set of connection statistics. |
247 * Returns null if all the statistics were zero. | 257 * Returns null if all the statistics were zero. |
248 * | 258 * |
249 * @param {remoting.StatsAccumulator} statsAccumulator | 259 * @param {remoting.StatsAccumulator} statsAccumulator |
250 * @param {string} connectionType | 260 * @param {string} connectionType |
251 * @param {remoting.ClientSession.Mode} mode | 261 * @param {remoting.ClientSession.Mode} mode |
252 * @return {?remoting.ServerLogEntry} | 262 * @return {?remoting.ServerLogEntry} |
253 */ | 263 */ |
254 remoting.ServerLogEntry.makeStats = function(statsAccumulator, | 264 remoting.ServerLogEntry.makeStats = function(statsAccumulator, |
255 connectionType, | 265 connectionType, |
256 mode) { | 266 mode) { |
257 var entry = new remoting.ServerLogEntry(); | 267 var entry = new remoting.ServerLogEntry(); |
258 entry.set(remoting.ServerLogEntry.KEY_ROLE_, | 268 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
259 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); | 269 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); |
260 entry.set(remoting.ServerLogEntry.KEY_EVENT_NAME_, | 270 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, |
261 remoting.ServerLogEntry.VALUE_EVENT_NAME_CONNECTION_STATISTICS_); | 271 remoting.ServerLogEntry.VALUE_EVENT_NAME_CONNECTION_STATISTICS_); |
262 if (connectionType) { | 272 if (connectionType) { |
263 entry.set(remoting.ServerLogEntry.KEY_CONNECTION_TYPE_, | 273 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_TYPE_, |
264 connectionType); | 274 connectionType); |
265 } | 275 } |
266 entry.addModeField(mode); | 276 entry.addModeField(mode); |
267 var nonZero = false; | 277 var nonZero = false; |
268 nonZero |= entry.addStatsField( | 278 nonZero |= entry.addStatsField_( |
269 remoting.ServerLogEntry.KEY_VIDEO_BANDWIDTH_, | 279 remoting.ServerLogEntry.KEY_VIDEO_BANDWIDTH_, |
270 remoting.ClientSession.STATS_KEY_VIDEO_BANDWIDTH, statsAccumulator); | 280 remoting.ClientSession.STATS_KEY_VIDEO_BANDWIDTH, statsAccumulator); |
271 nonZero |= entry.addStatsField( | 281 nonZero |= entry.addStatsField_( |
272 remoting.ServerLogEntry.KEY_CAPTURE_LATENCY_, | 282 remoting.ServerLogEntry.KEY_CAPTURE_LATENCY_, |
273 remoting.ClientSession.STATS_KEY_CAPTURE_LATENCY, statsAccumulator); | 283 remoting.ClientSession.STATS_KEY_CAPTURE_LATENCY, statsAccumulator); |
274 nonZero |= entry.addStatsField( | 284 nonZero |= entry.addStatsField_( |
275 remoting.ServerLogEntry.KEY_ENCODE_LATENCY_, | 285 remoting.ServerLogEntry.KEY_ENCODE_LATENCY_, |
276 remoting.ClientSession.STATS_KEY_ENCODE_LATENCY, statsAccumulator); | 286 remoting.ClientSession.STATS_KEY_ENCODE_LATENCY, statsAccumulator); |
277 nonZero |= entry.addStatsField( | 287 nonZero |= entry.addStatsField_( |
278 remoting.ServerLogEntry.KEY_DECODE_LATENCY_, | 288 remoting.ServerLogEntry.KEY_DECODE_LATENCY_, |
279 remoting.ClientSession.STATS_KEY_DECODE_LATENCY, statsAccumulator); | 289 remoting.ClientSession.STATS_KEY_DECODE_LATENCY, statsAccumulator); |
280 nonZero |= entry.addStatsField( | 290 nonZero |= entry.addStatsField_( |
281 remoting.ServerLogEntry.KEY_RENDER_LATENCY_, | 291 remoting.ServerLogEntry.KEY_RENDER_LATENCY_, |
282 remoting.ClientSession.STATS_KEY_RENDER_LATENCY, statsAccumulator); | 292 remoting.ClientSession.STATS_KEY_RENDER_LATENCY, statsAccumulator); |
283 nonZero |= entry.addStatsField( | 293 nonZero |= entry.addStatsField_( |
284 remoting.ServerLogEntry.KEY_ROUNDTRIP_LATENCY_, | 294 remoting.ServerLogEntry.KEY_ROUNDTRIP_LATENCY_, |
285 remoting.ClientSession.STATS_KEY_ROUNDTRIP_LATENCY, statsAccumulator); | 295 remoting.ClientSession.STATS_KEY_ROUNDTRIP_LATENCY, statsAccumulator); |
286 if (nonZero) { | 296 if (nonZero) { |
287 return entry; | 297 return entry; |
288 } | 298 } |
289 return null; | 299 return null; |
290 }; | 300 }; |
291 | 301 |
292 /** | 302 /** |
293 * Adds one connection statistic to a log entry. | 303 * Adds one connection statistic to a log entry. |
294 * | 304 * |
295 * @private | 305 * @private |
296 * @param {string} entryKey | 306 * @param {string} entryKey |
297 * @param {string} statsKey | 307 * @param {string} statsKey |
298 * @param {remoting.StatsAccumulator} statsAccumulator | 308 * @param {remoting.StatsAccumulator} statsAccumulator |
299 * @return {boolean} whether the statistic is non-zero | 309 * @return {boolean} whether the statistic is non-zero |
300 */ | 310 */ |
301 remoting.ServerLogEntry.prototype.addStatsField = function( | 311 remoting.ServerLogEntry.prototype.addStatsField_ = function( |
302 entryKey, statsKey, statsAccumulator) { | 312 entryKey, statsKey, statsAccumulator) { |
303 var val = statsAccumulator.calcMean(statsKey); | 313 var val = statsAccumulator.calcMean(statsKey); |
304 this.set(entryKey, val.toFixed(2)); | 314 this.set_(entryKey, val.toFixed(2)); |
305 return (val != 0); | 315 return (val != 0); |
306 }; | 316 }; |
307 | 317 |
308 /** | 318 /** |
309 * Makes a log entry for a "this session ID is old" event. | 319 * Makes a log entry for a "this session ID is old" event. |
310 * | 320 * |
311 * @param {string} sessionId | 321 * @param {string} sessionId |
312 * @param {remoting.ClientSession.Mode} mode | 322 * @param {remoting.ClientSession.Mode} mode |
313 * @return {remoting.ServerLogEntry} | 323 * @return {remoting.ServerLogEntry} |
314 */ | 324 */ |
315 remoting.ServerLogEntry.makeSessionIdOld = function(sessionId, mode) { | 325 remoting.ServerLogEntry.makeSessionIdOld = function(sessionId, mode) { |
316 var entry = new remoting.ServerLogEntry(); | 326 var entry = new remoting.ServerLogEntry(); |
317 entry.set(remoting.ServerLogEntry.KEY_ROLE_, | 327 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
318 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); | 328 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); |
319 entry.set(remoting.ServerLogEntry.KEY_EVENT_NAME_, | 329 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, |
320 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_ID_OLD_); | 330 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_ID_OLD_); |
321 entry.addSessionIdField(sessionId); | 331 entry.addSessionIdField(sessionId); |
322 entry.addModeField(mode); | 332 entry.addModeField(mode); |
323 return entry; | 333 return entry; |
324 }; | 334 }; |
325 | 335 |
326 /** | 336 /** |
327 * Makes a log entry for a "this session ID is new" event. | 337 * Makes a log entry for a "this session ID is new" event. |
328 * | 338 * |
329 * @param {string} sessionId | 339 * @param {string} sessionId |
330 * @param {remoting.ClientSession.Mode} mode | 340 * @param {remoting.ClientSession.Mode} mode |
331 * @return {remoting.ServerLogEntry} | 341 * @return {remoting.ServerLogEntry} |
332 */ | 342 */ |
333 remoting.ServerLogEntry.makeSessionIdNew = function(sessionId, mode) { | 343 remoting.ServerLogEntry.makeSessionIdNew = function(sessionId, mode) { |
334 var entry = new remoting.ServerLogEntry(); | 344 var entry = new remoting.ServerLogEntry(); |
335 entry.set(remoting.ServerLogEntry.KEY_ROLE_, | 345 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
336 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); | 346 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); |
337 entry.set(remoting.ServerLogEntry.KEY_EVENT_NAME_, | 347 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, |
338 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_ID_NEW_); | 348 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_ID_NEW_); |
339 entry.addSessionIdField(sessionId); | 349 entry.addSessionIdField(sessionId); |
340 entry.addModeField(mode); | 350 entry.addModeField(mode); |
341 return entry; | 351 return entry; |
342 }; | 352 }; |
343 | 353 |
344 /** | 354 /** |
| 355 * Makes a log entry for a "signal strategy fallback" event. |
| 356 * |
| 357 * @param {string} sessionId |
| 358 * @param {remoting.SignalStrategy.Type} strategyType |
| 359 * @param {remoting.FallbackSignalStrategy.Progress} progress |
| 360 * @param {number} elapsedTimeInMs |
| 361 * @return {remoting.ServerLogEntry} |
| 362 */ |
| 363 remoting.ServerLogEntry.makeSignalStrategyProgress = |
| 364 function(sessionId, strategyType, progress, elapsedTimeInMs) { |
| 365 var entry = new remoting.ServerLogEntry(); |
| 366 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
| 367 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); |
| 368 entry.set_( |
| 369 remoting.ServerLogEntry.KEY_EVENT_NAME_, |
| 370 remoting.ServerLogEntry.VALUE_EVENT_NAME_SIGNAL_STRATEGY_PROGRESS_); |
| 371 entry.addSessionIdField(sessionId); |
| 372 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_, strategyType); |
| 373 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_, progress); |
| 374 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_ELAPSED_TIME_, |
| 375 String(elapsedTimeInMs)); |
| 376 |
| 377 return entry; |
| 378 }; |
| 379 |
| 380 /** |
345 * Adds a session ID field to this log entry. | 381 * Adds a session ID field to this log entry. |
346 * | 382 * |
347 * @param {string} sessionId | 383 * @param {string} sessionId |
348 */ | 384 */ |
349 remoting.ServerLogEntry.prototype.addSessionIdField = function(sessionId) { | 385 remoting.ServerLogEntry.prototype.addSessionIdField = function(sessionId) { |
350 this.set(remoting.ServerLogEntry.KEY_SESSION_ID_, sessionId); | 386 this.set_(remoting.ServerLogEntry.KEY_SESSION_ID_, sessionId); |
351 } | 387 } |
352 | 388 |
353 /** | 389 /** |
354 * Adds fields describing the host to this log entry. | 390 * Adds fields describing the host to this log entry. |
355 */ | 391 */ |
356 remoting.ServerLogEntry.prototype.addHostFields = function() { | 392 remoting.ServerLogEntry.prototype.addHostFields = function() { |
357 var host = remoting.ServerLogEntry.getHostData(); | 393 var host = remoting.ServerLogEntry.getHostData_(); |
358 if (host) { | 394 if (host) { |
359 if (host.os_name.length > 0) { | 395 if (host.os_name.length > 0) { |
360 this.set(remoting.ServerLogEntry.KEY_OS_NAME_, host.os_name); | 396 this.set_(remoting.ServerLogEntry.KEY_OS_NAME_, host.os_name); |
361 } | 397 } |
362 if (host.os_version.length > 0) { | 398 if (host.os_version.length > 0) { |
363 this.set(remoting.ServerLogEntry.KEY_OS_VERSION_, host.os_version); | 399 this.set_(remoting.ServerLogEntry.KEY_OS_VERSION_, host.os_version); |
364 } | 400 } |
365 if (host.cpu.length > 0) { | 401 if (host.cpu.length > 0) { |
366 this.set(remoting.ServerLogEntry.KEY_CPU_, host.cpu); | 402 this.set_(remoting.ServerLogEntry.KEY_CPU_, host.cpu); |
367 } | 403 } |
368 } | 404 } |
369 }; | 405 }; |
370 | 406 |
371 /** | 407 /** |
372 * Extracts host data from the userAgent string. | 408 * Extracts host data from the userAgent string. |
373 * | 409 * |
374 * @private | 410 * @private |
375 * @return {{os_name:string, os_version:string, cpu:string} | null} | 411 * @return {{os_name:string, os_version:string, cpu:string} | null} |
376 */ | 412 */ |
377 remoting.ServerLogEntry.getHostData = function() { | 413 remoting.ServerLogEntry.getHostData_ = function() { |
378 return remoting.ServerLogEntry.extractHostDataFrom(navigator.userAgent); | 414 return remoting.ServerLogEntry.extractHostDataFrom_(navigator.userAgent); |
379 }; | 415 }; |
380 | 416 |
381 /** | 417 /** |
382 * Extracts host data from the given userAgent string. | 418 * Extracts host data from the given userAgent string. |
383 * | 419 * |
384 * @private | 420 * @private |
385 * @param {string} s | 421 * @param {string} s |
386 * @return {{os_name:string, os_version:string, cpu:string} | null} | 422 * @return {{os_name:string, os_version:string, cpu:string} | null} |
387 */ | 423 */ |
388 remoting.ServerLogEntry.extractHostDataFrom = function(s) { | 424 remoting.ServerLogEntry.extractHostDataFrom_ = function(s) { |
389 // Sample userAgent strings: | 425 // Sample userAgent strings: |
390 // 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 ' + | 426 // 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 ' + |
391 // '(KHTML, like Gecko) Chrome/15.0.874.106 Safari/535.2' | 427 // '(KHTML, like Gecko) Chrome/15.0.874.106 Safari/535.2' |
392 // 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.8 ' + | 428 // 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.8 ' + |
393 // '(KHTML, like Gecko) Chrome/17.0.933.0 Safari/535.8' | 429 // '(KHTML, like Gecko) Chrome/17.0.933.0 Safari/535.8' |
394 // 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 ' + | 430 // 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 ' + |
395 // '(KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1' | 431 // '(KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1' |
396 // 'Mozilla/5.0 (X11; CrOS i686 14.811.154) AppleWebKit/535.1 ' + | 432 // 'Mozilla/5.0 (X11; CrOS i686 14.811.154) AppleWebKit/535.1 ' + |
397 // '(KHTML, like Gecko) Chrome/14.0.835.204 Safari/535.1' | 433 // '(KHTML, like Gecko) Chrome/14.0.835.204 Safari/535.1' |
398 var match = new RegExp('Windows NT ([0-9\\.]*)').exec(s); | 434 var match = new RegExp('Windows NT ([0-9\\.]*)').exec(s); |
(...skipping 30 matching lines...) Expand all Loading... |
429 } | 465 } |
430 return null; | 466 return null; |
431 }; | 467 }; |
432 | 468 |
433 /** | 469 /** |
434 * Adds a field specifying the browser version to this log entry. | 470 * Adds a field specifying the browser version to this log entry. |
435 */ | 471 */ |
436 remoting.ServerLogEntry.prototype.addChromeVersionField = function() { | 472 remoting.ServerLogEntry.prototype.addChromeVersionField = function() { |
437 var version = remoting.getChromeVersion(); | 473 var version = remoting.getChromeVersion(); |
438 if (version != null) { | 474 if (version != null) { |
439 this.set(remoting.ServerLogEntry.KEY_BROWSER_VERSION_, version); | 475 this.set_(remoting.ServerLogEntry.KEY_BROWSER_VERSION_, version); |
440 } | 476 } |
441 }; | 477 }; |
442 | 478 |
443 /** | 479 /** |
444 * Adds a field specifying the webapp version to this log entry. | 480 * Adds a field specifying the webapp version to this log entry. |
445 */ | 481 */ |
446 remoting.ServerLogEntry.prototype.addWebappVersionField = function() { | 482 remoting.ServerLogEntry.prototype.addWebappVersionField = function() { |
447 var manifest = chrome.runtime.getManifest(); | 483 var manifest = chrome.runtime.getManifest(); |
448 if (manifest && manifest.version) { | 484 if (manifest && manifest.version) { |
449 this.set(remoting.ServerLogEntry.KEY_WEBAPP_VERSION_, manifest.version); | 485 this.set_(remoting.ServerLogEntry.KEY_WEBAPP_VERSION_, manifest.version); |
450 } | 486 } |
451 }; | 487 }; |
452 | 488 |
453 /** | 489 /** |
454 * Adds a field specifying the mode to this log entry. | 490 * Adds a field specifying the mode to this log entry. |
455 * | 491 * |
456 * @param {remoting.ClientSession.Mode} mode | 492 * @param {remoting.ClientSession.Mode} mode |
457 */ | 493 */ |
458 remoting.ServerLogEntry.prototype.addModeField = function(mode) { | 494 remoting.ServerLogEntry.prototype.addModeField = function(mode) { |
459 this.set(remoting.ServerLogEntry.KEY_MODE_, | 495 this.set_(remoting.ServerLogEntry.KEY_MODE_, |
460 remoting.ServerLogEntry.getModeField(mode)); | 496 remoting.ServerLogEntry.getModeField_(mode)); |
461 }; | 497 }; |
462 | 498 |
463 /** | 499 /** |
464 * Gets the value of the mode field to be put in a log entry. | 500 * Gets the value of the mode field to be put in a log entry. |
465 * | 501 * |
466 * @private | 502 * @private |
467 * @param {remoting.ClientSession.Mode} mode | 503 * @param {remoting.ClientSession.Mode} mode |
468 * @return {string} | 504 * @return {string} |
469 */ | 505 */ |
470 remoting.ServerLogEntry.getModeField = function(mode) { | 506 remoting.ServerLogEntry.getModeField_ = function(mode) { |
471 switch(mode) { | 507 switch(mode) { |
472 case remoting.ClientSession.Mode.IT2ME: | 508 case remoting.ClientSession.Mode.IT2ME: |
473 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; | 509 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; |
474 case remoting.ClientSession.Mode.ME2ME: | 510 case remoting.ClientSession.Mode.ME2ME: |
475 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; | 511 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; |
476 case remoting.ClientSession.Mode.APP_REMOTING: | 512 case remoting.ClientSession.Mode.APP_REMOTING: |
477 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; | 513 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; |
478 default: | 514 default: |
479 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; | 515 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; |
480 } | 516 } |
481 }; | 517 }; |
OLD | NEW |