| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Interface abstracting the Application functionality. | 7 * Interface abstracting the Application functionality. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * Set the connection mode (Me2Me, IT2Me or AppRemoting). | 52 * Set the connection mode (Me2Me, IT2Me or AppRemoting). |
| 53 * | 53 * |
| 54 * @param {remoting.Application.Mode} mode | 54 * @param {remoting.Application.Mode} mode |
| 55 */ | 55 */ |
| 56 remoting.Application.prototype.setConnectionMode = function(mode) { | 56 remoting.Application.prototype.setConnectionMode = function(mode) { |
| 57 this.connectionMode_ = mode; | 57 this.connectionMode_ = mode; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 /* Disconnect the remoting client. */ | |
| 61 remoting.Application.prototype.disconnect = function() { | |
| 62 if (remoting.clientSession) { | |
| 63 remoting.clientSession.disconnect(remoting.Error.none()); | |
| 64 console.log('Disconnected.'); | |
| 65 } | |
| 66 }; | |
| 67 | |
| 68 /* Public method to exit the application. */ | 60 /* Public method to exit the application. */ |
| 69 remoting.Application.prototype.quit = function() { | 61 remoting.Application.prototype.quit = function() { |
| 70 this.exitApplication_(); | 62 this.exitApplication_(); |
| 71 }; | 63 }; |
| 72 | 64 |
| 73 /** | 65 /** |
| 74 * Close the main window when quitting the application. This should be called | 66 * Close the main window when quitting the application. This should be called |
| 75 * by exitApplication() in the subclass. | 67 * by exitApplication() in the subclass. |
| 76 * @protected | 68 * @protected |
| 77 */ | 69 */ |
| (...skipping 26 matching lines...) Expand all Loading... |
| 104 } | 96 } |
| 105 }); | 97 }); |
| 106 }; | 98 }; |
| 107 | 99 |
| 108 /** | 100 /** |
| 109 * These functions must be overridden in the subclass. | 101 * These functions must be overridden in the subclass. |
| 110 */ | 102 */ |
| 111 | 103 |
| 112 /** @return {string} */ | 104 /** @return {string} */ |
| 113 remoting.Application.prototype.getApplicationName = function() { | 105 remoting.Application.prototype.getApplicationName = function() { |
| 114 base.debug.assert(false, "Subclass must override"); | 106 base.debug.assert(false, 'Subclass must override'); |
| 115 }; | 107 }; |
| 116 | 108 |
| 117 /** | 109 /** |
| 110 * @return {remoting.Activity} The Current activity. |
| 111 */ |
| 112 remoting.Application.prototype.getActivity = function() { |
| 113 base.debug.assert(false, 'Subclass must override'); |
| 114 }; |
| 115 |
| 116 /** |
| 118 * @param {!remoting.Error} error | 117 * @param {!remoting.Error} error |
| 119 * @protected | 118 * @protected |
| 120 */ | 119 */ |
| 121 remoting.Application.prototype.signInFailed_ = function(error) { | 120 remoting.Application.prototype.signInFailed_ = function(error) { |
| 122 base.debug.assert(false, "Subclass must override"); | 121 base.debug.assert(false, 'Subclass must override'); |
| 123 }; | 122 }; |
| 124 | 123 |
| 125 /** @protected */ | 124 /** @protected */ |
| 126 remoting.Application.prototype.initApplication_ = function() { | 125 remoting.Application.prototype.initApplication_ = function() { |
| 127 base.debug.assert(false, "Subclass must override"); | 126 base.debug.assert(false, 'Subclass must override'); |
| 128 }; | 127 }; |
| 129 | 128 |
| 130 /** | 129 /** |
| 131 * @param {string} token | 130 * @param {string} token |
| 132 * @protected | 131 * @protected |
| 133 */ | 132 */ |
| 134 remoting.Application.prototype.startApplication_ = function(token) { | 133 remoting.Application.prototype.startApplication_ = function(token) { |
| 135 base.debug.assert(false, "Subclass must override"); | 134 base.debug.assert(false, 'Subclass must override'); |
| 136 }; | 135 }; |
| 137 | 136 |
| 138 /** @protected */ | 137 /** @protected */ |
| 139 remoting.Application.prototype.exitApplication_ = function() { | 138 remoting.Application.prototype.exitApplication_ = function() { |
| 140 base.debug.assert(false, "Subclass must override"); | 139 base.debug.assert(false, 'Subclass must override'); |
| 141 }; | 140 }; |
| 142 | 141 |
| 143 /** | 142 /** |
| 144 * The interface specifies the methods that a subclass of remoting.Application | 143 * The interface specifies the methods that a subclass of remoting.Application |
| 145 * is required implement to override the default behavior. | 144 * is required implement to override the default behavior. |
| 146 * | 145 * |
| 147 * @interface | 146 * @interface |
| 148 */ | 147 */ |
| 149 remoting.ApplicationInterface = function() {}; | 148 remoting.ApplicationInterface = function() {}; |
| 150 | 149 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 180 */ | 179 */ |
| 181 remoting.ApplicationInterface.prototype.startApplication_ = function(token) {}; | 180 remoting.ApplicationInterface.prototype.startApplication_ = function(token) {}; |
| 182 | 181 |
| 183 /** | 182 /** |
| 184 * Close down the application before exiting. | 183 * Close down the application before exiting. |
| 185 */ | 184 */ |
| 186 remoting.ApplicationInterface.prototype.exitApplication_ = function() {}; | 185 remoting.ApplicationInterface.prototype.exitApplication_ = function() {}; |
| 187 | 186 |
| 188 /** @type {remoting.Application} */ | 187 /** @type {remoting.Application} */ |
| 189 remoting.app = null; | 188 remoting.app = null; |
| OLD | NEW |