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 * Class handling creation and teardown of a remoting client session. | 7 * Class handling creation and teardown of a remoting client session. |
8 * | 8 * |
9 * The ClientSession class controls lifetime of the client plugin | 9 * The ClientSession class controls lifetime of the client plugin |
10 * object and provides the plugin with the functionality it needs to | 10 * object and provides the plugin with the functionality it needs to |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 * @param {remoting.ClientSession.State} oldState The new state for the session. | 574 * @param {remoting.ClientSession.State} oldState The new state for the session. |
575 * @param {remoting.ClientSession.State} newState The new state for the session. | 575 * @param {remoting.ClientSession.State} newState The new state for the session. |
576 * @private | 576 * @private |
577 */ | 577 */ |
578 remoting.ClientSession.prototype.notifyStateChanges_ = | 578 remoting.ClientSession.prototype.notifyStateChanges_ = |
579 function(oldState, newState) { | 579 function(oldState, newState) { |
580 /** @type {remoting.Error} */ | 580 /** @type {remoting.Error} */ |
581 var error; | 581 var error; |
582 switch (this.state_) { | 582 switch (this.state_) { |
583 case remoting.ClientSession.State.CONNECTED: | 583 case remoting.ClientSession.State.CONNECTED: |
584 chrome.metricsPrivate.recordUserAction( | |
585 'Chromoting.Connections.Connected'); | |
Sergey Ulanov
2015/08/20 21:05:19
Do we need to register the actions somewhere? I th
anandc
2015/08/20 23:12:01
Thanks, added.
I still don't see the actions metri
| |
584 console.log('Connection established.'); | 586 console.log('Connection established.'); |
585 var connectionInfo = new remoting.ConnectionInfo( | 587 var connectionInfo = new remoting.ConnectionInfo( |
586 this.host_, this.credentialsProvider_, this, this.plugin_); | 588 this.host_, this.credentialsProvider_, this, this.plugin_); |
587 this.listener_.onConnected(connectionInfo); | 589 this.listener_.onConnected(connectionInfo); |
588 break; | 590 break; |
589 | 591 |
590 case remoting.ClientSession.State.CONNECTING: | 592 case remoting.ClientSession.State.CONNECTING: |
593 chrome.metricsPrivate.recordUserAction( | |
594 'Chromoting.Connections.Connecting'); | |
591 remoting.identity.getEmail().then(function(/** string */ email) { | 595 remoting.identity.getEmail().then(function(/** string */ email) { |
592 console.log('Connecting as ' + email); | 596 console.log('Connecting as ' + email); |
593 }); | 597 }); |
594 break; | 598 break; |
595 | 599 |
596 case remoting.ClientSession.State.AUTHENTICATED: | 600 case remoting.ClientSession.State.AUTHENTICATED: |
601 chrome.metricsPrivate.recordUserAction( | |
602 'Chromoting.Connections.Authenticated'); | |
597 console.log('Connection authenticated.'); | 603 console.log('Connection authenticated.'); |
598 break; | 604 break; |
599 | 605 |
600 case remoting.ClientSession.State.INITIALIZING: | 606 case remoting.ClientSession.State.INITIALIZING: |
601 console.log('Connection initializing .'); | 607 console.log('Connection initializing .'); |
602 break; | 608 break; |
603 | 609 |
604 case remoting.ClientSession.State.CLOSED: | 610 case remoting.ClientSession.State.CLOSED: |
611 chrome.metricsPrivate.recordUserAction('Chromoting.Connections.Closed'); | |
605 console.log('Connection closed.'); | 612 console.log('Connection closed.'); |
606 this.listener_.onDisconnected(remoting.Error.none()); | 613 this.listener_.onDisconnected(remoting.Error.none()); |
607 break; | 614 break; |
608 | 615 |
609 case remoting.ClientSession.State.CONNECTION_CANCELED: | 616 case remoting.ClientSession.State.CONNECTION_CANCELED: |
610 case remoting.ClientSession.State.FAILED: | 617 case remoting.ClientSession.State.FAILED: |
611 error = this.getError(); | 618 error = this.getError(); |
612 if (!error.isNone()) { | 619 if (!error.isNone()) { |
620 chrome.metricsPrivate.recordUserAction('Chromoting.Connections.Failed'); | |
613 console.error('Connection failed: ' + error.toString()); | 621 console.error('Connection failed: ' + error.toString()); |
614 } | 622 } |
615 this.listener_.onConnectionFailed(error); | 623 this.listener_.onConnectionFailed(error); |
616 break; | 624 break; |
617 | 625 |
618 case remoting.ClientSession.State.CONNECTION_DROPPED: | 626 case remoting.ClientSession.State.CONNECTION_DROPPED: |
619 error = this.getError(); | 627 error = this.getError(); |
620 console.error('Connection dropped: ' + error.toString()); | 628 console.error('Connection dropped: ' + error.toString()); |
621 this.listener_.onDisconnected(error); | 629 this.listener_.onDisconnected(error); |
630 chrome.metricsPrivate.recordUserAction('Chromoting.Connections.Dropped'); | |
622 break; | 631 break; |
623 | 632 |
624 default: | 633 default: |
625 console.error('Unexpected client plugin state: ' + newState); | 634 console.error('Unexpected client plugin state: ' + newState); |
626 } | 635 } |
627 }; | 636 }; |
628 | 637 |
629 /** | 638 /** |
630 * @param {remoting.ClientSession.State} previous | 639 * @param {remoting.ClientSession.State} previous |
631 * @param {remoting.ClientSession.State} current | 640 * @param {remoting.ClientSession.State} current |
(...skipping 28 matching lines...) Expand all Loading... | |
660 * Enable or disable logging of connection errors due to a host being offline. | 669 * Enable or disable logging of connection errors due to a host being offline. |
661 * For example, if attempting a connection using a cached JID, host-offline | 670 * For example, if attempting a connection using a cached JID, host-offline |
662 * errors should not be logged because the JID will be refreshed and the | 671 * errors should not be logged because the JID will be refreshed and the |
663 * connection retried. | 672 * connection retried. |
664 * | 673 * |
665 * @param {boolean} enable True to log host-offline errors; false to suppress. | 674 * @param {boolean} enable True to log host-offline errors; false to suppress. |
666 */ | 675 */ |
667 remoting.ClientSession.prototype.logHostOfflineErrors = function(enable) { | 676 remoting.ClientSession.prototype.logHostOfflineErrors = function(enable) { |
668 this.logHostOfflineErrors_ = enable; | 677 this.logHostOfflineErrors_ = enable; |
669 }; | 678 }; |
OLD | NEW |