| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
| 8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return 'Failed to get product version. Corrupt manifest?'; | 80 return 'Failed to get product version. Corrupt manifest?'; |
| 81 } | 81 } |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * If an IT2Me client or host is active then prompt the user before closing. | 85 * If an IT2Me client or host is active then prompt the user before closing. |
| 86 * If a Me2Me client is active then don't bother, since closing the window is | 86 * If a Me2Me client is active then don't bother, since closing the window is |
| 87 * the more intuitive way to end a Me2Me session, and re-connecting is easy. | 87 * the more intuitive way to end a Me2Me session, and re-connecting is easy. |
| 88 */ | 88 */ |
| 89 remoting.promptClose = function() { | 89 remoting.promptClose = function() { |
| 90 if (remoting.desktopConnectedView && | 90 var sessionConnector = remoting.app.getSessionConnector(); |
| 91 remoting.desktopConnectedView.getMode() == | 91 if (sessionConnector && |
| 92 sessionConnector.getConnectionMode() === |
| 92 remoting.DesktopConnectedView.Mode.IT2ME) { | 93 remoting.DesktopConnectedView.Mode.IT2ME) { |
| 93 switch (remoting.currentMode) { | 94 switch (remoting.currentMode) { |
| 94 case remoting.AppMode.CLIENT_CONNECTING: | 95 case remoting.AppMode.CLIENT_CONNECTING: |
| 95 case remoting.AppMode.HOST_WAITING_FOR_CODE: | 96 case remoting.AppMode.HOST_WAITING_FOR_CODE: |
| 96 case remoting.AppMode.HOST_WAITING_FOR_CONNECTION: | 97 case remoting.AppMode.HOST_WAITING_FOR_CONNECTION: |
| 97 case remoting.AppMode.HOST_SHARED: | 98 case remoting.AppMode.HOST_SHARED: |
| 98 case remoting.AppMode.IN_SESSION: | 99 case remoting.AppMode.IN_SESSION: |
| 99 return chrome.i18n.getMessage(/*i18n-content*/'CLOSE_PROMPT'); | 100 return chrome.i18n.getMessage(/*i18n-content*/'CLOSE_PROMPT'); |
| 100 default: | 101 default: |
| 101 return null; | 102 return null; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } else { | 209 } else { |
| 209 chrome.windows.get(tab.windowId, null, windowCallback); | 210 chrome.windows.get(tab.windowId, null, windowCallback); |
| 210 } | 211 } |
| 211 }; | 212 }; |
| 212 if (chrome.tabs) { | 213 if (chrome.tabs) { |
| 213 chrome.tabs.getCurrent(tabCallback); | 214 chrome.tabs.getCurrent(tabCallback); |
| 214 } else { | 215 } else { |
| 215 console.error('chome.tabs is not available.'); | 216 console.error('chome.tabs is not available.'); |
| 216 } | 217 } |
| 217 } | 218 } |
| OLD | NEW |