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 PageManager
= cr
.ui
.pageManager
.PageManager
;
7 /** @const */ var SettingsDialog
= options
.SettingsDialog
;
10 * HomePageOverlay class
11 * Dialog that allows users to set the home page.
13 * @extends {options.SettingsDialog}
15 function ThirdPartyImeConfirmOverlay() {
17 this, 'thirdPartyImeConfirm',
18 loadTimeData
.getString('thirdPartyImeConfirmOverlayTabTitle'),
19 'third-party-ime-confirm-overlay',
20 assertInstanceof($('third-party-ime-confirm-ok'), HTMLButtonElement
),
21 assertInstanceof($('third-party-ime-confirm-cancel'),
25 cr
.addSingletonGetter(ThirdPartyImeConfirmOverlay
);
27 ThirdPartyImeConfirmOverlay
.prototype = {
28 __proto__
: SettingsDialog
.prototype,
31 * Callback to authorize use of an input method.
35 confirmationCallback_
: null,
38 * Callback to cancel enabling an input method.
42 cancellationCallback_
: null,
45 * Confirms enabling of a third party IME.
47 handleConfirm: function() {
48 SettingsDialog
.prototype.handleConfirm
.call(this);
49 this.confirmationCallback_();
53 * Resets state of the checkobx.
55 handleCancel: function() {
56 SettingsDialog
.prototype.handleCancel
.call(this);
57 this.cancellationCallback_();
61 * Displays a confirmation dialog indicating the risk fo enabling
63 * @param {{extension: string, confirm: Function, cancel: Function}} data
64 * Options for the confirmation dialog.
67 showConfirmationDialog_: function(data
) {
68 this.confirmationCallback_
= data
.confirm
;
69 this.cancellationCallback_
= data
.cancel
;
70 var message
= loadTimeData
.getStringF('thirdPartyImeConfirmMessage',
72 $('third-party-ime-confirm-text').textContent
= message
;
73 PageManager
.showPageByName(this.name
, false);
78 * Displays a confirmation dialog indicating the risk fo enabling
80 * @param {{extension: string, confirm: Function, cancel: Function}} data
81 * Options for the confirmation dialog.
83 ThirdPartyImeConfirmOverlay
.showConfirmationDialog = function(data
) {
84 ThirdPartyImeConfirmOverlay
.getInstance().showConfirmationDialog_(data
);
89 ThirdPartyImeConfirmOverlay
: ThirdPartyImeConfirmOverlay