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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
543 new base.RepeatingTimer(this.reportStatistics.bind(this), 1000)); | 543 new base.RepeatingTimer(this.reportStatistics.bind(this), 1000)); |
544 if (this.plugin_.hasCapability( | 544 if (this.plugin_.hasCapability( |
545 remoting.ClientSession.Capability.TOUCH_EVENTS)) { | 545 remoting.ClientSession.Capability.TOUCH_EVENTS)) { |
546 this.plugin_.enableTouchEvents(true); | 546 this.plugin_.enableTouchEvents(true); |
547 } | 547 } |
548 } else if (this.isFinished()) { | 548 } else if (this.isFinished()) { |
549 base.dispose(this.connectedDisposables_); | 549 base.dispose(this.connectedDisposables_); |
550 this.connectedDisposables_ = null; | 550 this.connectedDisposables_ = null; |
551 } | 551 } |
552 | 552 |
553 this.logAuthMethod_(); | |
553 this.notifyStateChanges_(oldState, this.state_); | 554 this.notifyStateChanges_(oldState, this.state_); |
554 // Record state count in an UMA enumerated histogram. | 555 // Record state count in an UMA enumerated histogram. |
555 recordState(this.state_); | 556 recordState(this.state_); |
556 this.logger_.logClientSessionStateChange( | 557 this.logger_.logClientSessionStateChange( |
557 this.state_, this.error_, this.xmppErrorCache_.getFirstError()); | 558 this.state_, this.error_, this.xmppErrorCache_.getFirstError()); |
558 }; | 559 }; |
559 | 560 |
561 /** @private */ | |
562 remoting.ClientSession.prototype.logAuthMethod_ = function() { | |
563 // The AuthMethod is undefined before the AUTHENTICATED stage for a | |
564 // successful connection or the FAILED stage for a failed connection. | |
565 if (this.state_ == remoting.ClientSession.State.AUTHENTICATED || | |
566 this.state_ == remoting.ClientSession.State.FAILED) { | |
Jamie
2015/10/09 01:17:21
Rather than relying on this, couldn't you have get
kelvinp
2015/10/09 18:00:34
The scenario that I am trying to cover is the foll
| |
567 var authMethod = this.credentialsProvider_.getAuthMethod(); | |
568 if (authMethod != null) { | |
569 this.logger_.setAuthMethod(authMethod); | |
570 } | |
571 } | |
572 }; | |
573 | |
560 /** | 574 /** |
561 * Records a Chromoting Connection State, stored in an UMA enumerated histogram. | 575 * Records a Chromoting Connection State, stored in an UMA enumerated histogram. |
562 * @param {remoting.ClientSession.State} state State identifier. | 576 * @param {remoting.ClientSession.State} state State identifier. |
563 */ | 577 */ |
564 function recordState(state) { | 578 function recordState(state) { |
565 // According to src/base/metrics/histogram.h, for a UMA enumerated histogram, | 579 // According to src/base/metrics/histogram.h, for a UMA enumerated histogram, |
566 // the upper limit should be 1 above the max-enum. | 580 // the upper limit should be 1 above the max-enum. |
567 var histogram_max = remoting.ClientSession.State.MAX_STATE_ENUM - | 581 var histogram_max = remoting.ClientSession.State.MAX_STATE_ENUM - |
568 remoting.ClientSession.State.MIN_STATE_ENUM + 1; | 582 remoting.ClientSession.State.MIN_STATE_ENUM + 1; |
569 | 583 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
653 } else if (previous == State.CONNECTED && current == State.FAILED) { | 667 } else if (previous == State.CONNECTED && current == State.FAILED) { |
654 return State.CONNECTION_DROPPED; | 668 return State.CONNECTION_DROPPED; |
655 } | 669 } |
656 return current; | 670 return current; |
657 }; | 671 }; |
658 | 672 |
659 /** @private */ | 673 /** @private */ |
660 remoting.ClientSession.prototype.reportStatistics = function() { | 674 remoting.ClientSession.prototype.reportStatistics = function() { |
661 this.logger_.logStatistics(this.plugin_.getPerfStats()); | 675 this.logger_.logStatistics(this.plugin_.getPerfStats()); |
662 }; | 676 }; |
OLD | NEW |