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 /** @private */ | 122 /** @private */ |
123 remoting.ServerLogEntry.KEY_SESSION_DURATION_ = 'session-duration'; | 123 remoting.ServerLogEntry.KEY_SESSION_DURATION_ = 'session-duration'; |
124 | 124 |
125 /** @private */ | 125 /** @private */ |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 for (var key in this.dict) { | 213 for (var key in this.dict) { |
214 fields.push(key + ': ' + this.dict[key]); | 214 fields.push(key + ': ' + this.dict[key]); |
215 } | 215 } |
216 console.log(Array(indentLevel+1).join(" ") + fields.join(', ')); | 216 console.log(Array(indentLevel+1).join(" ") + fields.join(', ')); |
217 }; | 217 }; |
218 | 218 |
219 /** | 219 /** |
220 * Makes a log entry for a change of client session state. | 220 * Makes a log entry for a change of client session state. |
221 * | 221 * |
222 * @param {remoting.ClientSession.State} state | 222 * @param {remoting.ClientSession.State} state |
223 * @param {remoting.Error} connectionError | 223 * @param {!remoting.Error} connectionError |
224 * @param {remoting.DesktopConnectedView.Mode} mode | 224 * @param {remoting.DesktopConnectedView.Mode} mode |
225 * @return {remoting.ServerLogEntry} | 225 * @return {remoting.ServerLogEntry} |
226 */ | 226 */ |
227 remoting.ServerLogEntry.makeClientSessionStateChange = function(state, | 227 remoting.ServerLogEntry.makeClientSessionStateChange = function(state, |
228 connectionError, mode) { | 228 connectionError, mode) { |
229 var entry = new remoting.ServerLogEntry(); | 229 var entry = new remoting.ServerLogEntry(); |
230 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, | 230 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
231 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); | 231 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); |
232 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, | 232 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, |
233 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_); | 233 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_); |
234 entry.set_(remoting.ServerLogEntry.KEY_SESSION_STATE_, | 234 entry.set_(remoting.ServerLogEntry.KEY_SESSION_STATE_, |
235 remoting.ServerLogEntry.getValueForSessionState_(state)); | 235 remoting.ServerLogEntry.getValueForSessionState_(state)); |
236 if (connectionError != remoting.Error.NONE) { | 236 if (connectionError.tag != remoting.Error.NONE) { |
237 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, | 237 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, |
238 remoting.ServerLogEntry.getValueForError_(connectionError)); | 238 remoting.ServerLogEntry.getValueForError_(connectionError)); |
239 } | 239 } |
240 entry.addModeField(mode); | 240 entry.addModeField(mode); |
241 return entry; | 241 return entry; |
242 }; | 242 }; |
243 | 243 |
244 /** | 244 /** |
245 * Adds a session duration to a log entry. | 245 * Adds a session duration to a log entry. |
246 * | 246 * |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 case remoting.DesktopConnectedView.Mode.IT2ME: | 508 case remoting.DesktopConnectedView.Mode.IT2ME: |
509 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; | 509 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; |
510 case remoting.DesktopConnectedView.Mode.ME2ME: | 510 case remoting.DesktopConnectedView.Mode.ME2ME: |
511 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; | 511 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; |
512 case remoting.DesktopConnectedView.Mode.APP_REMOTING: | 512 case remoting.DesktopConnectedView.Mode.APP_REMOTING: |
513 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; | 513 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; |
514 default: | 514 default: |
515 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; | 515 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; |
516 } | 516 } |
517 }; | 517 }; |
OLD | NEW |