| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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'; |
| 11 | 11 |
| 12 /** @suppress {duplicate} */ | 12 /** @suppress {duplicate} */ |
| 13 var remoting = remoting || {}; | 13 var remoting = remoting || {}; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * @private | 16 * @private |
| 17 * @constructor | 17 * @constructor |
| 18 */ | 18 */ |
| 19 remoting.ServerLogEntry = function() { | 19 remoting.ServerLogEntry = function() { |
| 20 /** @type Object.<string, string> */ this.dict = {}; | 20 /** @type Object.<string, string> */ this.dict = {}; |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 /** @private */ | 23 /** @private */ |
| 24 remoting.ServerLogEntry.prototype.KEY_EVENT_NAME_ = 'event-name'; | 24 remoting.ServerLogEntry.prototype.KEY_EVENT_NAME_ = 'event-name'; |
| 25 /** @private */ | 25 /** @private */ |
| 26 remoting.ServerLogEntry.prototype.VALUE_EVENT_NAME_SESSION_STATE_ = | 26 remoting.ServerLogEntry.prototype.VALUE_EVENT_NAME_SESSION_STATE_ = |
| 27 'session-state'; | 27 'session-state'; |
| 28 | 28 |
| 29 /** @private */ | 29 /** @private */ |
| 30 remoting.ServerLogEntry.prototype.KEY_ID_ = 'id'; |
| 31 |
| 32 /** @private */ |
| 30 remoting.ServerLogEntry.prototype.KEY_ROLE_ = 'role'; | 33 remoting.ServerLogEntry.prototype.KEY_ROLE_ = 'role'; |
| 31 /** @private */ | 34 /** @private */ |
| 32 remoting.ServerLogEntry.prototype.VALUE_ROLE_CLIENT_ = 'client'; | 35 remoting.ServerLogEntry.prototype.VALUE_ROLE_CLIENT_ = 'client'; |
| 33 | 36 |
| 34 /** @private */ | 37 /** @private */ |
| 35 remoting.ServerLogEntry.prototype.KEY_SESSION_STATE_ = 'session-state'; | 38 remoting.ServerLogEntry.prototype.KEY_SESSION_STATE_ = 'session-state'; |
| 36 | 39 |
| 37 /** | 40 /** |
| 38 * @private | 41 * @private |
| 39 * @param {remoting.ClientSession.State} state | 42 * @param {remoting.ClientSession.State} state |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 entry.set(this.KEY_EVENT_NAME_, this.VALUE_EVENT_NAME_SESSION_STATE_); | 155 entry.set(this.KEY_EVENT_NAME_, this.VALUE_EVENT_NAME_SESSION_STATE_); |
| 153 entry.set(this.KEY_SESSION_STATE_, this.getValueForSessionState(state)); | 156 entry.set(this.KEY_SESSION_STATE_, this.getValueForSessionState(state)); |
| 154 if (connectionError != remoting.ClientSession.ConnectionError.NONE) { | 157 if (connectionError != remoting.ClientSession.ConnectionError.NONE) { |
| 155 entry.set(this.KEY_CONNECTION_ERROR_, | 158 entry.set(this.KEY_CONNECTION_ERROR_, |
| 156 this.getValueForConnectionError(connectionError)); | 159 this.getValueForConnectionError(connectionError)); |
| 157 } | 160 } |
| 158 return entry; | 161 return entry; |
| 159 }; | 162 }; |
| 160 | 163 |
| 161 /** | 164 /** |
| 165 * Adds an ID field to this log entry. |
| 166 * |
| 167 * @param {string} id |
| 168 */ |
| 169 remoting.ServerLogEntry.prototype.addIdField = function(id) { |
| 170 this.set(this.KEY_ID_, id); |
| 171 } |
| 172 |
| 173 /** |
| 162 * Adds fields describing the host to this log entry. | 174 * Adds fields describing the host to this log entry. |
| 163 */ | 175 */ |
| 164 remoting.ServerLogEntry.prototype.addHostFields = function() { | 176 remoting.ServerLogEntry.prototype.addHostFields = function() { |
| 165 var host = this.getHostData(); | 177 var host = this.getHostData(); |
| 166 if (host) { | 178 if (host) { |
| 167 if (host.os_name.length > 0) { | 179 if (host.os_name.length > 0) { |
| 168 this.set(this.KEY_OS_NAME_, host.os_name); | 180 this.set(this.KEY_OS_NAME_, host.os_name); |
| 169 } | 181 } |
| 170 if (host.os_version.length > 0) { | 182 if (host.os_version.length > 0) { |
| 171 this.set(this.KEY_OS_VERSION_, host.os_version); | 183 this.set(this.KEY_OS_VERSION_, host.os_version); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 284 } |
| 273 return null; | 285 return null; |
| 274 }; | 286 }; |
| 275 | 287 |
| 276 /** | 288 /** |
| 277 * Adds a field specifying the webapp version to this log entry. | 289 * Adds a field specifying the webapp version to this log entry. |
| 278 */ | 290 */ |
| 279 remoting.ServerLogEntry.prototype.addWebappVersionField = function() { | 291 remoting.ServerLogEntry.prototype.addWebappVersionField = function() { |
| 280 this.set(this.KEY_WEBAPP_VERSION_, chrome.app.getDetails().version); | 292 this.set(this.KEY_WEBAPP_VERSION_, chrome.app.getDetails().version); |
| 281 }; | 293 }; |
| OLD | NEW |