| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 var remoting = remoting || {}; | 5 var remoting = remoting || {}; |
| 6 | 6 |
| 7 (function() { | 7 (function() { |
| 8 'use strict'; | 8 'use strict'; |
| 9 | 9 |
| 10 window.addEventListener('blur', pluginLostFocus_, false); | 10 window.addEventListener('blur', pluginLostFocus_, false); |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 */ | 591 */ |
| 592 remoting.disconnect = function() { | 592 remoting.disconnect = function() { |
| 593 if (remoting.session) { | 593 if (remoting.session) { |
| 594 remoting.session.disconnect(); | 594 remoting.session.disconnect(); |
| 595 remoting.session = null; | 595 remoting.session = null; |
| 596 remoting.debug.log('Disconnected.'); | 596 remoting.debug.log('Disconnected.'); |
| 597 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED); | 597 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED); |
| 598 } | 598 } |
| 599 } | 599 } |
| 600 | 600 |
| 601 /** If the client is connected, or the host is shared, prompt before closing. | 601 /** |
| 602 * If the client is connected, or the host is shared, prompt before closing. |
| 602 * | 603 * |
| 603 * @return {(string|void)} The prompt string if a connection is active. | 604 * @return {(string|void)} The prompt string if a connection is active. |
| 604 */ | 605 */ |
| 605 remoting.promptClose = function() { | 606 remoting.promptClose = function() { |
| 606 var messageId = null; | 607 // Prompt to close if the host is in any state other than unshared, or if the |
| 607 if (remoting.getMajorMode() == remoting.AppMode.HOST && | 608 // client is connecting or has already connected. |
| 608 remoting.currentMode != remoting.AppMode.HOST_UNSHARED) { | 609 if ((remoting.getMajorMode() == remoting.AppMode.HOST && |
| 609 messageId = 'closePromptHost'; | 610 remoting.currentMode != remoting.AppMode.HOST_UNSHARED) || |
| 610 } else if (remoting.getMajorMode() == remoting.AppMode.IN_SESSION || | 611 remoting.getMajorMode() == remoting.AppMode.IN_SESSION || |
| 611 remoting.currentMode == remoting.AppMode.CLIENT_CONNECTING) { | 612 remoting.currentMode == remoting.AppMode.CLIENT_CONNECTING) { |
| 612 messageId = 'closePromptClient'; | 613 var result = chrome.i18n.getMessage('closePrompt'); |
| 613 } | |
| 614 if (messageId) { | |
| 615 var result = chrome.i18n.getMessage(messageId); | |
| 616 return result; | 614 return result; |
| 617 } | 615 } |
| 618 } | 616 } |
| 619 | 617 |
| 620 }()); | 618 }()); |
| OLD | NEW |