Chromium Code Reviews| Index: remoting/webapp/me2mom/remoting.js |
| diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js |
| index 8947e59d0ac58e9b66f97a42ecf007097efbb800..27213b8893ce7255de3007a0c697a10f7bdea9f3 100644 |
| --- a/remoting/webapp/me2mom/remoting.js |
| +++ b/remoting/webapp/me2mom/remoting.js |
| @@ -189,7 +189,15 @@ remoting.setMode = function(mode) { |
| element.hidden = hidden; |
| } |
| remoting.debug.log('App mode: ' + mode); |
| - remoting.currentMode = modes[0]; |
| + remoting.currentMode = mode; |
| +} |
| + |
| +/** |
| + * Get the major mode that the app is running in. |
| + * @return {remoting.Mode} The app's current major mode. |
| + */ |
| +remoting.getMajorMode = function(mode) { |
| + return remoting.currentMode.split('.')[0]; |
| } |
| remoting.tryShare = function() { |
| @@ -520,7 +528,7 @@ remoting.tryConnect = function() { |
| remoting.cancelPendingOperation = function() { |
| document.getElementById('cancel-button').disabled = true; |
| - if (remoting.currentMode == remoting.AppMode.HOST) { |
| + if (remoting.getMajorMode() == remoting.AppMode.HOST) { |
| remoting.cancelShare(); |
| } |
| } |
| @@ -590,4 +598,23 @@ remoting.disconnect = function() { |
| } |
| } |
| +/** If the client is connected, or the host is shared, prompt before closing. |
| + * |
| + * @return {string|void} The prompt string if a connection is active. |
| + */ |
| +remoting.promptClose = function() { |
| + var token = null; |
|
awong
2011/08/05 23:17:25
How about messageId instead of token
Jamie
2011/08/05 23:36:51
Done.
|
| + if (remoting.getMajorMode() == remoting.AppMode.HOST && |
| + remoting.currentMode != remoting.AppMode.HOST_UNSHARED) { |
| + token = 'closePromptHost'; |
| + } else if (remoting.getMajorMode() == remoting.AppMode.IN_SESSION || |
| + remoting.currentMode == remoting.AppMode.CLIENT_CONNECTING) { |
| + token = 'closePromptClient'; |
| + } |
| + if (token) { |
| + var result = chrome.i18n.getMessage(token); |
| + return result; |
| + } |
| +} |
| + |
| }()); |