forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hangout remote desktop part I - It2Me mode
This CL enables the user to launch the chrome remote desktop app directly into an immersive it2me helper session. In the immersive session, the app will 1. hide the home screen 2. create an hrd_helper_session object to communicate with the it2me_background service. Review URL: https://codereview.chromium.org/439923002 Cr-Commit-Position: refs/heads/master@{#288466} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288466 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
kelvinp@chromium.org
committed
Aug 8, 2014
1 parent
93630da
commit 06ce0d6
Showing
7 changed files
with
107 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
/** | ||
* @fileoverview | ||
* Class to communicate with the background scripts via chrome runtime | ||
* messages to | ||
* 1. Forward session state notifications | ||
* 2. Closes the window when the session terminates | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/** @suppress {duplicate} */ | ||
var remoting = remoting || {}; | ||
|
||
/** | ||
* @constructor | ||
*/ | ||
remoting.HangoutSession = function() { | ||
/** | ||
* @private | ||
* @type {chrome.extension.Port} | ||
*/ | ||
this.port_ = null; | ||
}; | ||
|
||
remoting.HangoutSession.prototype.init = function() { | ||
this.port_ = chrome.runtime.connect({name: 'it2me.helper.webapp'}); | ||
|
||
remoting.hangoutSessionEvents.addEventListener( | ||
remoting.hangoutSessionEvents.sessionStateChanged, | ||
this.onSessionStateChanged_.bind(this)); | ||
}; | ||
|
||
/** | ||
* @param {remoting.ClientSession.State} state | ||
*/ | ||
remoting.HangoutSession.prototype.onSessionStateChanged_ = function(state) { | ||
var State = remoting.ClientSession.State; | ||
try { | ||
this.port_.postMessage({method: 'sessionStateChanged', state: state}); | ||
} catch (e) { | ||
// postMessage will throw an exception if the port is disconnected. | ||
// We can safely ignore this exception. | ||
} finally { | ||
if (state === State.FAILED || state === State.CLOSED) { | ||
// close the current window | ||
if (remoting.isAppsV2) { | ||
chrome.app.window.current().close(); | ||
} else { | ||
window.close(); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
|
||
/** | ||
* remoting.clientSession does not exist until the session is connected. | ||
* hangoutSessionEvents serves as a global event source to plumb session | ||
* state changes until we cleanup clientSession and sessionConnector. | ||
* @type {base.EventSource} | ||
*/ | ||
remoting.hangoutSessionEvents = new base.EventSource(); | ||
|
||
/** @type {string} */ | ||
remoting.hangoutSessionEvents.sessionStateChanged = "sessionStateChanged"; | ||
|
||
remoting.hangoutSessionEvents.defineEvents( | ||
[remoting.hangoutSessionEvents.sessionStateChanged]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters