| 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 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 'cpu': match[1] | 414 'cpu': match[1] |
| 415 }; | 415 }; |
| 416 } | 416 } |
| 417 return null; | 417 return null; |
| 418 }; | 418 }; |
| 419 | 419 |
| 420 /** | 420 /** |
| 421 * Adds a field specifying the browser version to this log entry. | 421 * Adds a field specifying the browser version to this log entry. |
| 422 */ | 422 */ |
| 423 remoting.ServerLogEntry.prototype.addChromeVersionField = function() { | 423 remoting.ServerLogEntry.prototype.addChromeVersionField = function() { |
| 424 var version = remoting.ServerLogEntry.getChromeVersion(); | 424 var version = remoting.getChromeVersion(); |
| 425 if (version != null) { | 425 if (version != null) { |
| 426 this.set(remoting.ServerLogEntry.KEY_BROWSER_VERSION_, version); | 426 this.set(remoting.ServerLogEntry.KEY_BROWSER_VERSION_, version); |
| 427 } | 427 } |
| 428 }; | 428 }; |
| 429 | 429 |
| 430 /** | 430 /** |
| 431 * Extracts the Chrome version from the userAgent string. | |
| 432 * | |
| 433 * @private | |
| 434 * @return {string | null} | |
| 435 */ | |
| 436 remoting.ServerLogEntry.getChromeVersion = function() { | |
| 437 return remoting.ServerLogEntry.extractChromeVersionFrom(navigator.userAgent); | |
| 438 }; | |
| 439 | |
| 440 /** | |
| 441 * Extracts the Chrome version from the given userAgent string. | |
| 442 * | |
| 443 * @private | |
| 444 * @param {string} s | |
| 445 * @return {string | null} | |
| 446 */ | |
| 447 remoting.ServerLogEntry.extractChromeVersionFrom = function(s) { | |
| 448 var match = new RegExp('Chrome/([0-9.]*)').exec(s); | |
| 449 if (match && (match.length >= 2)) { | |
| 450 return match[1]; | |
| 451 } | |
| 452 return null; | |
| 453 }; | |
| 454 | |
| 455 /** | |
| 456 * Adds a field specifying the webapp version to this log entry. | 431 * Adds a field specifying the webapp version to this log entry. |
| 457 */ | 432 */ |
| 458 remoting.ServerLogEntry.prototype.addWebappVersionField = function() { | 433 remoting.ServerLogEntry.prototype.addWebappVersionField = function() { |
| 459 var manifest = chrome.runtime.getManifest(); | 434 var manifest = chrome.runtime.getManifest(); |
| 460 if (manifest && manifest.version) { | 435 if (manifest && manifest.version) { |
| 461 this.set(remoting.ServerLogEntry.KEY_WEBAPP_VERSION_, manifest.version); | 436 this.set(remoting.ServerLogEntry.KEY_WEBAPP_VERSION_, manifest.version); |
| 462 } | 437 } |
| 463 }; | 438 }; |
| 464 | 439 |
| 465 /** | 440 /** |
| (...skipping 16 matching lines...) Expand all Loading... |
| 482 remoting.ServerLogEntry.getModeField = function(mode) { | 457 remoting.ServerLogEntry.getModeField = function(mode) { |
| 483 switch(mode) { | 458 switch(mode) { |
| 484 case remoting.ClientSession.Mode.IT2ME: | 459 case remoting.ClientSession.Mode.IT2ME: |
| 485 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; | 460 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; |
| 486 case remoting.ClientSession.Mode.ME2ME: | 461 case remoting.ClientSession.Mode.ME2ME: |
| 487 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; | 462 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; |
| 488 default: | 463 default: |
| 489 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; | 464 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; |
| 490 } | 465 } |
| 491 }; | 466 }; |
| OLD | NEW |