Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2164)

Side by Side Diff: remoting/webapp/me2mom/log_to_server.js

Issue 8558034: Disable logging from the chromoting client to the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * Module for sending log entries to the server. 7 * Module for sending log entries to the server.
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 * @constructor 16 * @constructor
17 */ 17 */
18 remoting.LogToServer = function() { 18 remoting.LogToServer = function() {
19 /** @type Array.<string> */ this.pendingEntries = []; 19 /** @type Array.<string> */ this.pendingEntries = [];
20 /** @type boolean */ this.enabled = false;
20 }; 21 };
21 22
22 /** 23 /**
23 * Logs a client session state change. 24 * Logs a client session state change.
24 * 25 *
25 * @param {remoting.ClientSession.State} state 26 * @param {remoting.ClientSession.State} state
26 * @param {remoting.ClientSession.ConnectionError} connectionError 27 * @param {remoting.ClientSession.ConnectionError} connectionError
27 */ 28 */
28 remoting.LogToServer.prototype.logClientSessionStateChange = 29 remoting.LogToServer.prototype.logClientSessionStateChange =
29 function(state, connectionError) { 30 function(state, connectionError) {
30 var entry = remoting.ServerLogEntry.prototype.makeClientSessionStateChange( 31 var entry = remoting.ServerLogEntry.prototype.makeClientSessionStateChange(
31 state, connectionError); 32 state, connectionError);
32 entry.addHostFields(); 33 entry.addHostFields();
33 entry.addChromeVersionField(); 34 entry.addChromeVersionField();
34 entry.addWebappVersionField(); 35 entry.addWebappVersionField();
35 this.log(entry); 36 this.log(entry);
36 }; 37 };
37 38
38 /** 39 /**
39 * Sends a log entry to the server. 40 * Sends a log entry to the server.
40 * 41 *
41 * @private 42 * @private
42 * @param {remoting.ServerLogEntry} entry 43 * @param {remoting.ServerLogEntry} entry
43 */ 44 */
44 remoting.LogToServer.prototype.log = function(entry) { 45 remoting.LogToServer.prototype.log = function(entry) {
46 if (!this.enabled) {
47 return;
48 }
45 // Store a stanza for the entry 49 // Store a stanza for the entry
46 this.pendingEntries.push(entry.toStanza()); 50 this.pendingEntries.push(entry.toStanza());
47 // Stop if there's no connection to the server. 51 // Stop if there's no connection to the server.
48 if (!remoting.wcs) { 52 if (!remoting.wcs) {
49 return; 53 return;
50 } 54 }
51 // Send all pending entries to the server. 55 // Send all pending entries to the server.
52 var stanza = '<cli:iq to="remoting@bot.talk.google.com" type="set" ' + 56 var stanza = '<cli:iq to="remoting@bot.talk.google.com" type="set" ' +
53 'xmlns:cli="jabber:client"><gr:log xmlns:gr="google:remoting">'; 57 'xmlns:cli="jabber:client"><gr:log xmlns:gr="google:remoting">';
54 while (this.pendingEntries.length > 0) { 58 while (this.pendingEntries.length > 0) {
55 stanza += /** @type string */ this.pendingEntries.shift(); 59 stanza += /** @type string */ this.pendingEntries.shift();
56 } 60 }
57 stanza += '</gr:log></cli:iq>'; 61 stanza += '</gr:log></cli:iq>';
58 remoting.debug.logIq(true, stanza); 62 remoting.debug.logIq(true, stanza);
59 remoting.wcs.sendIq(stanza); 63 remoting.wcs.sendIq(stanza);
60 }; 64 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698