Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: chrome/browser/resources/options/chromeos/third_party_ime_confirm_overlay.js

Issue 325633003: Add confirmation dialog when enabling a 3rd party IME. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WS fixes. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 cr.define('options', function() {
6 /** @const */ var OptionsPage = options.OptionsPage;
7 /** @const */ var SettingsDialog = options.SettingsDialog;
8
9 /**
10 * HomePageOverlay class
11 * Dialog that allows users to set the home page.
12 * @extends {SettingsDialog}
13 */
14 function ThirdPartyImeConfirmOverlay() {
15 SettingsDialog.call(
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'));
21 }
22
23 cr.addSingletonGetter(ThirdPartyImeConfirmOverlay);
24
25 ThirdPartyImeConfirmOverlay.prototype = {
26 __proto__: SettingsDialog.prototype,
27
28 /**
29 * Callback to authorize use of an input method.
30 * @type {Function}
31 * @private
32 */
33 confirmationCallback_: null,
34
35 /**
36 * Callback to cancel enabling an input method.
37 * @type {Function}
38 * @private
39 */
40 cancellationCallback_: null,
41
42 /**
43 * Confirms enabling of a third party IME.
44 */
45 handleConfirm: function() {
46 this.confirmationCallback_();
47 SettingsDialog.prototype.handleConfirm.call(this);
Dan Beam 2014/06/10 18:08:17 if the order doesn't matter, put the super first (
kevers 2014/06/10 23:02:35 Done.
48 },
49
50 /**
51 * Resets state of the checkobx.
52 */
53 handleCancel: function() {
54 this.cancellationCallback_();
55 SettingsDialog.prototype.handleCancel.call(this);
56 },
57
58 /**
59 * Displays a confirmation dialog indicating the risk fo enabling
60 * a third party IME.
61 * @param {{extension: string, confirm: Function, cancel: Function}} data
62 * Options for the confirmation dialog.
63 * @private
64 */
65 showConfirmationDialog_: function(data) {
66 this.confirmationCallback_ = data.confirm;
67 this.cancellationCallback_ = data.cancel;
68 var message = loadTimeData.getStringF('thirdPartyImeConfirmMessage',
69 data.extension);
70 $('third-party-ime-confirm-text').textContent = message;
71 OptionsPage.showPageByName(this.name, false);
72 },
73 };
74
75 /**
76 * Displays a confirmation dialog indicating the risk fo enabling
77 * a third party IME.
78 * @param {{extension: string, confirm: Function, cancel: Function}} data
79 * Options for the confirmation dialog.
80 */
81 ThirdPartyImeConfirmOverlay.showConfirmationDialog = function(data) {
82 ThirdPartyImeConfirmOverlay.getInstance().showConfirmationDialog_(data);
83 };
84
85 // Export
86 return {
87 ThirdPartyImeConfirmOverlay: ThirdPartyImeConfirmOverlay
88 };
89 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698