function createSessionEndEvent(sessionInfo) {
  var event =
      /** @type{remoting.ChromotingEvent} */ (base.deepCopy(sessionInfo.event));
  var SessionState = remoting.ChromotingEvent.SessionState;

  switch (event.session_state) {
    case SessionState.STARTED:
    case SessionState.SIGNALING:
    case SessionState.CREATING_PLUGIN:
    case SessionState.CONNECTING:
    case SessionState.AUTHENTICATED:
      event.session_state = SessionState.CONNECTION_CANCELED;
      break;
    default:
      event.session_state = SessionState.CLOSED;
  }
  var elapsed = (Date.now() - sessionInfo.timestamp) / 1000.0;
  event.session_duration +=  elapsed;
  return event;
}
/**
 * Inspects |sessionInfo| to generate a session termination state.  This is
 * called when the user closes the window using the context menu such that we
 * won't get a proper termination event.
 *
 * @param {SessionInfo} sessionInfo
 * @return {remoting.ChromotingEvent}
 */
Inspects |sessionInfo| to generate a session termination state.  This is
called when the user closes the window using the context menu such that we
won't get a proper termination event.


Inspects |sessionInfo| to generate a session termination state . This is called when the user closes the window using the context menu such that we won ' t get a proper termination event .
function createSessionEndEvent(sessionInfo) {
  var event =
       (base.deepCopy(sessionInfo.event));
  var SessionState = remoting.ChromotingEvent.SessionState;
  switch (event.session_state) {
    case SessionState.STARTED:
    case SessionState.SIGNALING:
    case SessionState.CREATING_PLUGIN:
    case SessionState.CONNECTING:
    case SessionState.AUTHENTICATED:
      event.session_state = SessionState.CONNECTION_CANCELED;
      break;
    default:
      event.session_state = SessionState.CLOSED;
  }
  var elapsed = (Date.now() - sessionInfo.timestamp) / 1000.0;
  event.session_duration +=  elapsed;
  return event;
}
function createSessionEndEvent ( sessionInfo ) { var event = ( base . deepCopy ( sessionInfo . event ) ) ; var SessionState = remoting . ChromotingEvent . SessionState ; switch ( event . session_state ) { case SessionState . STARTED : case SessionState . SIGNALING : case SessionState . CREATING_PLUGIN : case SessionState . CONNECTING : case SessionState . AUTHENTICATED : event . session_state = SessionState . CONNECTION_CANCELED ; break ; default : event . session_state = SessionState . CLOSED ; } var elapsed = ( Date . now ( ) - sessionInfo . timestamp ) / 1000.0 ; event . session_duration += elapsed ; return event ; }
Inspects |sessionInfo| to generate a session termination state.
Inspects |sessionInfo| to generate a session termination state .
/** @type{remoting.ChromotingEvent} */