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

Unified Diff: chrome/browser/resources/options/language_options.js

Issue 325633003: Add confirmation dialog when enabling a 3rd party IME. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/options/language_options.js
diff --git a/chrome/browser/resources/options/language_options.js b/chrome/browser/resources/options/language_options.js
index c0826ebaad165f80077501ec4cb1cf266767486e..bd0a5af5a5e0c5695fc938c9946ef231dd1dd78d 100644
--- a/chrome/browser/resources/options/language_options.js
+++ b/chrome/browser/resources/options/language_options.js
@@ -8,6 +8,8 @@
cr.define('options', function() {
/** @const */ var OptionsPage = options.OptionsPage;
/** @const */ var LanguageList = options.LanguageList;
+ /** @const */ var ThirdPartyImeConfirmOverlay =
+ options.ThirdPartyImeConfirmOverlay;
/**
* Spell check dictionary download status.
@@ -318,6 +320,7 @@ cr.define('options', function() {
var input = element.querySelector('input');
input.inputMethodId = inputMethod.id;
+ input.imeProvider = inputMethod.extensionName;
var span = element.querySelector('span');
span.textContent = inputMethod.displayName;
@@ -823,6 +826,33 @@ cr.define('options', function() {
handleCheckboxClick_: function(e) {
var checkbox = e.target;
+ // Third party IMEs require additional confirmation prior to enabling due
+ // to privacy risk.
+ if (!!checkbox.imeProvider && checkbox.checked) {
Dan Beam 2014/06/09 21:37:36 you don't need the !!
Shu Chen 2014/06/10 01:02:18 I think it would be safer to check IME ID instead
kevers 2014/06/10 17:56:44 Done.
+ var self = this;
+ var confirmationCallback = function() {
+ self.handleCheckboxUpdate_(checkbox);
+ };
Dan Beam 2014/06/09 21:37:36 nit: var confirmationCallback = this.handleCheckbo
kevers 2014/06/10 17:56:44 Done.
+ var cancellationCallback = function() {
+ checkbox.checked = false;
+ }
Dan Beam 2014/06/09 21:37:36 };
kevers 2014/06/10 17:56:44 Done.
+ ThirdPartyImeConfirmOverlay.showConfirmationDialog({
+ extension: checkbox.imeProvider,
+ confirm: confirmationCallback,
+ cancel: cancellationCallback
+ });
+ } else {
+ this.handleCheckboxUpdate_(checkbox);
+ }
+ },
+
+ /**
+ * Updates active IMEs based on change in state of a checkbox for an input
+ * method.
+ * @param {!Element} checkbox Updated checkbox element.
+ * @private
+ */
+ handleCheckboxUpdate_: function(checkbox) {
if (checkbox.inputMethodId.match(/^_ext_ime_/)) {
this.updateEnabledExtensionsFromCheckboxes_();
this.saveEnabledExtensionPref_();

Powered by Google App Engine
This is Rietveld 408576698