Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
[Chromoting] Fix telemetry error in remoting.It2MeActivity
Browse files Browse the repository at this point in the history
1. Excludes the access code entry time from the session duration.
2. Reports cancellation/error to the telemetry service if the
   main promise in It2meActivity.start() rejects.
3. Disposes DesktopRemotingActivity if the session fails to connect.

BUG=549658

Review URL: https://codereview.chromium.org/1413923015

Cr-Commit-Position: refs/heads/master@{#358874}
  • Loading branch information
kelvinp authored and Commit bot committed Nov 10, 2015
1 parent b016a6d commit cb61f37
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions remoting/webapp/crd/js/it2me_activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,41 @@ remoting.It2MeActivity.prototype.dispose = function() {

remoting.It2MeActivity.prototype.start = function() {
var that = this;
var SessionState = remoting.ChromotingEvent.SessionState;

this.logger_ = this.createLogger_();
this.logger_.logSessionStateChange(
remoting.ChromotingEvent.SessionState.STARTED);
this.logger_.logSessionStateChange(SessionState.STARTED);

console.assert(
!this.desktopActivity_, 'Zombie DesktopActivity from previous session');
base.dispose(this.desktopActivity_);
this.desktopActivity_ =
new remoting.DesktopRemotingActivity(this, this.logger_);

function onError(/** remoting.Error */ error) {
if (error.isCancel()) {
that.logger_.logSessionStateChange(SessionState.CONNECTION_CANCELED);
remoting.setMode(remoting.AppMode.HOME);
} else {
that.logger_.logSessionStateChange(SessionState.CONNECTION_FAILED, error);
that.showErrorMessage_(error);
}

base.dispose(that.desktopActivity_);
that.desktopActivity_ = null;
}

var sessionStart = Date.now();

this.accessCodeDialog_.show().then(function(/** string */ accessCode) {
that.logger_.setAuthTotalTime(Date.now() - sessionStart);
that.desktopActivity_.getConnectingDialog().show();
return that.verifyAccessCode_(accessCode);
}).then(function() {
return remoting.HostListApi.getInstance().getSupportHost(that.hostId_);
}).then(function(/** remoting.Host */ host) {
that.connect_(host);
}).catch(remoting.Error.handler(function(/** remoting.Error */ error) {
if (error.hasTag(remoting.Error.Tag.CANCELLED)) {
remoting.setMode(remoting.AppMode.HOME);
} else {
that.showErrorMessage_(error);
}
}));
}).catch(remoting.Error.handler(onError));
};


Expand Down

0 comments on commit cb61f37

Please sign in to comment.