Chromium Code Reviews| Index: chrome/browser/resources/options/chromeos/third_party_ime_confirm_overlay.js |
| diff --git a/chrome/browser/resources/options/chromeos/third_party_ime_confirm_overlay.js b/chrome/browser/resources/options/chromeos/third_party_ime_confirm_overlay.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..51ca7a5a2d8d34571ed7945ee16084b3052acf0b |
| --- /dev/null |
| +++ b/chrome/browser/resources/options/chromeos/third_party_ime_confirm_overlay.js |
| @@ -0,0 +1,90 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +cr.define('options', function() { |
| + /** @const */ var OptionsPage = options.OptionsPage; |
| + /** @const */ var SettingsDialog = options.SettingsDialog; |
| + |
| + /** |
| + * HomePageOverlay class |
| + * Dialog that allows users to set the home page. |
| + * @extends {SettingsDialog} |
| + */ |
| + function ThirdPartyImeConfirmOverlay() { |
| + SettingsDialog.call( |
| + this, 'thirdPartyImeConfirm', |
| + loadTimeData.getString('thirdPartyImeConfirmOverlayTabTitle'), |
| + 'third-party-ime-confirm-overlay', |
| + $('third-party-ime-confirm-ok'), |
| + $('third-party-ime-confirm-cancel')); |
| + } |
| + |
| + cr.addSingletonGetter(ThirdPartyImeConfirmOverlay); |
| + |
| + ThirdPartyImeConfirmOverlay.prototype = { |
| + __proto__: SettingsDialog.prototype, |
| + |
| + /** |
| + * Callback to authorize use of an input method. |
| + * @type {Function} |
| + * @private |
| + */ |
| + confirmationCallback_: null, |
| + |
| + /** |
| + * Callback to cancel enabling an input method. |
| + * @type {Function} |
| + * @private |
| + */ |
| + cancellationCallback_: null, |
| + |
| + /** |
| + * Confirms enabling of a third party IME. |
| + */ |
| + handleConfirm: function() { |
| + this.confirmationCallback_(); |
| + SettingsDialog.prototype.handleConfirm.call(this); |
|
Dan Beam
2014/06/09 21:37:36
why are you calling into the super second?
kevers
2014/06/10 17:56:44
Either order is fine since there is no preference
|
| + }, |
| + |
| + /** |
| + * Resets state of the checkobx. |
| + */ |
| + handleCancel: function() { |
| + this.cancellationCallback_(); |
| + SettingsDialog.prototype.handleCancel.call(this); |
| + }, |
| + |
| + /** |
| + * Displays a confirmation dialog indicating the risk fo enabling |
| + * a third party IME. |
| + * @param {{extension: string, confirm: Function, cancel: Function}} data |
| + * Options for the confirmation dialog. |
| + * @private |
| + */ |
| + showConfirmationDialog_: function(data) { |
| + this.confirmationCallback_ = data.confirm; |
| + this.cancellationCallback_ = data.cancel; |
| + var message = loadTimeData.getStringF('thirdPartyImeConfirmMessage', |
| + data.extension); |
| + $('third-party-ime-confirm-text').textContent = message; |
| + OptionsPage.showPageByName(this.name, false); |
| + }, |
| + }; |
| + |
| + /** |
| + * Displays a confirmation dialog indicating the risk fo enabling |
| + * a third party IME. |
| + * @param {{extension: string, confirm: Function, cancel: Function}} data |
| + * Options for the confirmation dialog. |
| + */ |
| + ThirdPartyImeConfirmOverlay.showConfirmationDialog = function(data) { |
| + var instance = ThirdPartyImeConfirmOverlay.getInstance(); |
| + instance.showConfirmationDialog_.apply(instance, arguments); |
|
Dan Beam
2014/06/09 21:37:35
ThirdPartyImeConfirmOverlay.getInstance().showConf
kevers
2014/06/10 17:56:44
Done.
|
| + } |
|
Dan Beam
2014/06/09 21:37:35
};
kevers
2014/06/10 17:56:44
Done.
|
| + |
| + // Export |
| + return { |
| + ThirdPartyImeConfirmOverlay: ThirdPartyImeConfirmOverlay |
| + }; |
| +}); |