| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 default: | 78 default: |
| 79 return 'undefined-' + state; | 79 return 'undefined-' + state; |
| 80 } | 80 } |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 /** @private */ | 83 /** @private */ |
| 84 remoting.ServerLogEntry.KEY_CONNECTION_ERROR_ = 'connection-error'; | 84 remoting.ServerLogEntry.KEY_CONNECTION_ERROR_ = 'connection-error'; |
| 85 | 85 |
| 86 /** | 86 /** |
| 87 * @private | 87 * @private |
| 88 * @param {remoting.Error} connectionError | 88 * @param {!remoting.Error} connectionError |
| 89 * @return {string} | 89 * @return {string} |
| 90 */ | 90 */ |
| 91 remoting.ServerLogEntry.getValueForError_ = function(connectionError) { | 91 remoting.ServerLogEntry.getValueForError_ = function(connectionError) { |
| 92 // 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 |
| 93 // 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). |
| 94 switch(connectionError) { | 94 switch (connectionError.tag) { |
| 95 case remoting.Error.NONE: | 95 case remoting.Error.Tag.NONE: |
| 96 return 'none'; | 96 return 'none'; |
| 97 case remoting.Error.INVALID_ACCESS_CODE: | 97 case remoting.Error.Tag.INVALID_ACCESS_CODE: |
| 98 return 'invalid-access-code'; | 98 return 'invalid-access-code'; |
| 99 case remoting.Error.MISSING_PLUGIN: | 99 case remoting.Error.Tag.MISSING_PLUGIN: |
| 100 return 'missing_plugin'; | 100 return 'missing_plugin'; |
| 101 case remoting.Error.AUTHENTICATION_FAILED: | 101 case remoting.Error.Tag.AUTHENTICATION_FAILED: |
| 102 return 'authentication-failed'; | 102 return 'authentication-failed'; |
| 103 case remoting.Error.HOST_IS_OFFLINE: | 103 case remoting.Error.Tag.HOST_IS_OFFLINE: |
| 104 return 'host-is-offline'; | 104 return 'host-is-offline'; |
| 105 case remoting.Error.INCOMPATIBLE_PROTOCOL: | 105 case remoting.Error.Tag.INCOMPATIBLE_PROTOCOL: |
| 106 return 'incompatible-protocol'; | 106 return 'incompatible-protocol'; |
| 107 case remoting.Error.BAD_PLUGIN_VERSION: | 107 case remoting.Error.Tag.BAD_PLUGIN_VERSION: |
| 108 return 'bad-plugin-version'; | 108 return 'bad-plugin-version'; |
| 109 case remoting.Error.NETWORK_FAILURE: | 109 case remoting.Error.Tag.NETWORK_FAILURE: |
| 110 return 'network-failure'; | 110 return 'network-failure'; |
| 111 case remoting.Error.HOST_OVERLOAD: | 111 case remoting.Error.Tag.HOST_OVERLOAD: |
| 112 return 'host-overload'; | 112 return 'host-overload'; |
| 113 case remoting.Error.P2P_FAILURE: | 113 case remoting.Error.Tag.P2P_FAILURE: |
| 114 return 'p2p-failure'; | 114 return 'p2p-failure'; |
| 115 case remoting.Error.UNEXPECTED: | 115 case remoting.Error.Tag.UNEXPECTED: |
| 116 return 'unexpected'; | 116 return 'unexpected'; |
| 117 default: | 117 default: |
| 118 return 'unknown-' + connectionError; | 118 return 'unknown-' + connectionError; |
| 119 } | 119 } |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 | 122 |
| 123 /** @private */ | 123 /** @private */ |
| 124 remoting.ServerLogEntry.VALUE_EVENT_NAME_CONNECTION_STATISTICS_ = | 124 remoting.ServerLogEntry.VALUE_EVENT_NAME_CONNECTION_STATISTICS_ = |
| 125 "connection-statistics"; | 125 "connection-statistics"; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 for (var key in this.dict) { | 211 for (var key in this.dict) { |
| 212 fields.push(key + ': ' + this.dict[key]); | 212 fields.push(key + ': ' + this.dict[key]); |
| 213 } | 213 } |
| 214 console.log(Array(indentLevel+1).join(" ") + fields.join(', ')); | 214 console.log(Array(indentLevel+1).join(" ") + fields.join(', ')); |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 /** | 217 /** |
| 218 * Makes a log entry for a change of client session state. | 218 * Makes a log entry for a change of client session state. |
| 219 * | 219 * |
| 220 * @param {remoting.ClientSession.State} state | 220 * @param {remoting.ClientSession.State} state |
| 221 * @param {remoting.Error} connectionError | 221 * @param {!remoting.Error} connectionError |
| 222 * @param {remoting.DesktopConnectedView.Mode} mode | 222 * @param {remoting.DesktopConnectedView.Mode} mode |
| 223 * @return {remoting.ServerLogEntry} | 223 * @return {remoting.ServerLogEntry} |
| 224 */ | 224 */ |
| 225 remoting.ServerLogEntry.makeClientSessionStateChange = function(state, | 225 remoting.ServerLogEntry.makeClientSessionStateChange = function(state, |
| 226 connectionError, mode) { | 226 connectionError, mode) { |
| 227 var entry = new remoting.ServerLogEntry(); | 227 var entry = new remoting.ServerLogEntry(); |
| 228 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, | 228 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
| 229 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); | 229 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); |
| 230 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, | 230 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, |
| 231 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_); | 231 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_); |
| 232 entry.set_(remoting.ServerLogEntry.KEY_SESSION_STATE_, | 232 entry.set_(remoting.ServerLogEntry.KEY_SESSION_STATE_, |
| 233 remoting.ServerLogEntry.getValueForSessionState_(state)); | 233 remoting.ServerLogEntry.getValueForSessionState_(state)); |
| 234 if (connectionError != remoting.Error.NONE) { | 234 if (connectionError.tag != remoting.Error.NONE) { |
| 235 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, | 235 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, |
| 236 remoting.ServerLogEntry.getValueForError_(connectionError)); | 236 remoting.ServerLogEntry.getValueForError_(connectionError)); |
| 237 } | 237 } |
| 238 entry.addModeField(mode); | 238 entry.addModeField(mode); |
| 239 return entry; | 239 return entry; |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 /** | 242 /** |
| 243 * Makes a log entry for a set of connection statistics. | 243 * Makes a log entry for a set of connection statistics. |
| 244 * Returns null if all the statistics were zero. | 244 * Returns null if all the statistics were zero. |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 case remoting.DesktopConnectedView.Mode.IT2ME: | 504 case remoting.DesktopConnectedView.Mode.IT2ME: |
| 505 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; | 505 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; |
| 506 case remoting.DesktopConnectedView.Mode.ME2ME: | 506 case remoting.DesktopConnectedView.Mode.ME2ME: |
| 507 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; | 507 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; |
| 508 case remoting.DesktopConnectedView.Mode.APP_REMOTING: | 508 case remoting.DesktopConnectedView.Mode.APP_REMOTING: |
| 509 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; | 509 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; |
| 510 default: | 510 default: |
| 511 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; | 511 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; |
| 512 } | 512 } |
| 513 }; | 513 }; |
| OLD | NEW |