| 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 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 6 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
| 7 /** @const */ var SettingsDialog = options.SettingsDialog; | 7 /** @const */ var SettingsDialog = options.SettingsDialog; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * HomePageOverlay class | 10 * HomePageOverlay class |
| 11 * Dialog that allows users to set the home page. | 11 * Dialog that allows users to set the home page. |
| 12 * @constructor | 12 * @constructor |
| 13 * @extends {options.SettingsDialog} | 13 * @extends {options.SettingsDialog} |
| 14 */ | 14 */ |
| 15 function ThirdPartyImeConfirmOverlay() { | 15 function ThirdPartyImeConfirmOverlay() { |
| 16 SettingsDialog.call( | 16 SettingsDialog.call( |
| 17 this, 'thirdPartyImeConfirm', | 17 this, 'thirdPartyImeConfirm', |
| 18 loadTimeData.getString('thirdPartyImeConfirmOverlayTabTitle'), | 18 loadTimeData.getString('thirdPartyImeConfirmOverlayTabTitle'), |
| 19 'third-party-ime-confirm-overlay', | 19 'third-party-ime-confirm-overlay', |
| 20 assertInstanceof($('third-party-ime-confirm-ok'), HTMLButtonElement), | 20 assertInstanceof($('third-party-ime-confirm-ok'), HTMLButtonElement), |
| 21 assertInstanceof($('third-party-ime-confirm-cancel'), | 21 assertInstanceof( |
| 22 HTMLButtonElement)); | 22 $('third-party-ime-confirm-cancel'), HTMLButtonElement)); |
| 23 } | 23 } |
| 24 | 24 |
| 25 cr.addSingletonGetter(ThirdPartyImeConfirmOverlay); | 25 cr.addSingletonGetter(ThirdPartyImeConfirmOverlay); |
| 26 | 26 |
| 27 ThirdPartyImeConfirmOverlay.prototype = { | 27 ThirdPartyImeConfirmOverlay.prototype = { |
| 28 __proto__: SettingsDialog.prototype, | 28 __proto__: SettingsDialog.prototype, |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * Callback to authorize use of an input method. | 31 * Callback to authorize use of an input method. |
| 32 * @type {Function} | 32 * @type {Function} |
| 33 * @private | 33 * @private |
| 34 */ | 34 */ |
| 35 confirmationCallback_: null, | 35 confirmationCallback_: null, |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Callback to cancel enabling an input method. | 38 * Callback to cancel enabling an input method. |
| 39 * @type {Function} | 39 * @type {Function} |
| 40 * @private | 40 * @private |
| 41 */ | 41 */ |
| 42 cancellationCallback_: null, | 42 cancellationCallback_: null, |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * Confirms enabling of a third party IME. | 45 * Confirms enabling of a third party IME. |
| 46 */ | 46 */ |
| 47 handleConfirm: function() { | 47 handleConfirm: function() { |
| 48 SettingsDialog.prototype.handleConfirm.call(this); | 48 SettingsDialog.prototype.handleConfirm.call(this); |
| 49 this.confirmationCallback_(); | 49 this.confirmationCallback_(); |
| 50 }, | 50 }, |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * Resets state of the checkobx. | 53 * Resets state of the checkobx. |
| 54 */ | 54 */ |
| 55 handleCancel: function() { | 55 handleCancel: function() { |
| 56 SettingsDialog.prototype.handleCancel.call(this); | 56 SettingsDialog.prototype.handleCancel.call(this); |
| 57 this.cancellationCallback_(); | 57 this.cancellationCallback_(); |
| 58 }, | 58 }, |
| 59 | 59 |
| 60 /** | 60 /** |
| 61 * Displays a confirmation dialog indicating the risk fo enabling | 61 * Displays a confirmation dialog indicating the risk fo enabling |
| 62 * a third party IME. | 62 * a third party IME. |
| 63 * @param {{extension: string, confirm: Function, cancel: Function}} data | 63 * @param {{extension: string, confirm: Function, cancel: Function}} data |
| 64 * Options for the confirmation dialog. | 64 * Options for the confirmation dialog. |
| 65 * @private | 65 * @private |
| 66 */ | 66 */ |
| 67 showConfirmationDialog_: function(data) { | 67 showConfirmationDialog_: function(data) { |
| 68 this.confirmationCallback_ = data.confirm; | 68 this.confirmationCallback_ = data.confirm; |
| 69 this.cancellationCallback_ = data.cancel; | 69 this.cancellationCallback_ = data.cancel; |
| 70 var message = loadTimeData.getStringF('thirdPartyImeConfirmMessage', | 70 var message = loadTimeData.getStringF( |
| 71 data.extension); | 71 'thirdPartyImeConfirmMessage', data.extension); |
| 72 $('third-party-ime-confirm-text').textContent = message; | 72 $('third-party-ime-confirm-text').textContent = message; |
| 73 PageManager.showPageByName(this.name, false); | 73 PageManager.showPageByName(this.name, false); |
| 74 }, | 74 }, |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * Displays a confirmation dialog indicating the risk fo enabling | 78 * Displays a confirmation dialog indicating the risk fo enabling |
| 79 * a third party IME. | 79 * a third party IME. |
| 80 * @param {{extension: string, confirm: Function, cancel: Function}} data | 80 * @param {{extension: string, confirm: Function, cancel: Function}} data |
| 81 * Options for the confirmation dialog. | 81 * Options for the confirmation dialog. |
| 82 */ | 82 */ |
| 83 ThirdPartyImeConfirmOverlay.showConfirmationDialog = function(data) { | 83 ThirdPartyImeConfirmOverlay.showConfirmationDialog = function(data) { |
| 84 ThirdPartyImeConfirmOverlay.getInstance().showConfirmationDialog_(data); | 84 ThirdPartyImeConfirmOverlay.getInstance().showConfirmationDialog_(data); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 // Export | 87 // Export |
| 88 return { | 88 return {ThirdPartyImeConfirmOverlay: ThirdPartyImeConfirmOverlay}; |
| 89 ThirdPartyImeConfirmOverlay: ThirdPartyImeConfirmOverlay | |
| 90 }; | |
| 91 }); | 89 }); |
| OLD | NEW |