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
3 // found in the LICENSE file.
5 cr.define('options', function() {
6 /** @const */ var OptionsPage = options.OptionsPage;
7 /** @const */ var SettingsDialog = options.SettingsDialog;
10 * HomePageOverlay class
11 * Dialog that allows users to set the home page.
12 * @extends {SettingsDialog}
14 function ThirdPartyImeConfirmOverlay() {
16 this, 'thirdPartyImeConfirm',
17 loadTimeData.getString('thirdPartyImeConfirmOverlayTabTitle'),
18 'third-party-ime-confirm-overlay',
19 $('third-party-ime-confirm-ok'),
20 $('third-party-ime-confirm-cancel'));
23 cr.addSingletonGetter(ThirdPartyImeConfirmOverlay);
25 ThirdPartyImeConfirmOverlay.prototype = {
26 __proto__: SettingsDialog.prototype,
29 * Callback to authorize use of an input method.
33 confirmationCallback_: null,
36 * Callback to cancel enabling an input method.
40 cancellationCallback_: null,
43 * Confirms enabling of a third party IME.
45 handleConfirm: function() {
46 SettingsDialog.prototype.handleConfirm.call(this);
47 this.confirmationCallback_();
51 * Resets state of the checkobx.
53 handleCancel: function() {
54 SettingsDialog.prototype.handleCancel.call(this);
55 this.cancellationCallback_();
59 * Displays a confirmation dialog indicating the risk fo enabling
61 * @param {{extension: string, confirm: Function, cancel: Function}} data
62 * Options for the confirmation dialog.
65 showConfirmationDialog_: function(data) {
66 this.confirmationCallback_ = data.confirm;
67 this.cancellationCallback_ = data.cancel;
68 var message = loadTimeData.getStringF('thirdPartyImeConfirmMessage',
70 $('third-party-ime-confirm-text').textContent = message;
71 OptionsPage.showPageByName(this.name, false);
76 * Displays a confirmation dialog indicating the risk fo enabling
78 * @param {{extension: string, confirm: Function, cancel: Function}} data
79 * Options for the confirmation dialog.
81 ThirdPartyImeConfirmOverlay.showConfirmationDialog = function(data) {
82 ThirdPartyImeConfirmOverlay.getInstance().showConfirmationDialog_(data);
87 ThirdPartyImeConfirmOverlay: ThirdPartyImeConfirmOverlay