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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 if (match && (match.length >= 2)) { | 444 if (match && (match.length >= 2)) { |
445 return match[1]; | 445 return match[1]; |
446 } | 446 } |
447 return null; | 447 return null; |
448 }; | 448 }; |
449 | 449 |
450 /** | 450 /** |
451 * Adds a field specifying the webapp version to this log entry. | 451 * Adds a field specifying the webapp version to this log entry. |
452 */ | 452 */ |
453 remoting.ServerLogEntry.prototype.addWebappVersionField = function() { | 453 remoting.ServerLogEntry.prototype.addWebappVersionField = function() { |
454 this.set(remoting.ServerLogEntry.KEY_WEBAPP_VERSION_, | 454 var manifest = chrome.runtime.getManifest(); |
455 chrome.app.getDetails().version); | 455 if (manifest && manifest.version) { |
| 456 this.set(remoting.ServerLogEntry.KEY_WEBAPP_VERSION_, manifest.version); |
| 457 } |
456 }; | 458 }; |
457 | 459 |
458 /** | 460 /** |
459 * Adds a field specifying the mode to this log entry. | 461 * Adds a field specifying the mode to this log entry. |
460 * | 462 * |
461 * @param {remoting.ClientSession.Mode} mode | 463 * @param {remoting.ClientSession.Mode} mode |
462 */ | 464 */ |
463 remoting.ServerLogEntry.prototype.addModeField = function(mode) { | 465 remoting.ServerLogEntry.prototype.addModeField = function(mode) { |
464 this.set(remoting.ServerLogEntry.KEY_MODE_, | 466 this.set(remoting.ServerLogEntry.KEY_MODE_, |
465 remoting.ServerLogEntry.getModeField(mode)); | 467 remoting.ServerLogEntry.getModeField(mode)); |
466 }; | 468 }; |
467 | 469 |
468 /** | 470 /** |
469 * Gets the value of the mode field to be put in a log entry. | 471 * Gets the value of the mode field to be put in a log entry. |
470 * | 472 * |
471 * @private | 473 * @private |
472 * @param {remoting.ClientSession.Mode} mode | 474 * @param {remoting.ClientSession.Mode} mode |
473 * @return {string} | 475 * @return {string} |
474 */ | 476 */ |
475 remoting.ServerLogEntry.getModeField = function(mode) { | 477 remoting.ServerLogEntry.getModeField = function(mode) { |
476 switch(mode) { | 478 switch(mode) { |
477 case remoting.ClientSession.Mode.IT2ME: | 479 case remoting.ClientSession.Mode.IT2ME: |
478 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; | 480 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; |
479 case remoting.ClientSession.Mode.ME2ME: | 481 case remoting.ClientSession.Mode.ME2ME: |
480 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; | 482 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; |
481 default: | 483 default: |
482 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; | 484 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; |
483 } | 485 } |
484 }; | 486 }; |
OLD | NEW |