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

Unified Diff: chrome/browser/resources/settings/languages_page/languages.js

Issue 2827553002: MD Settings: Use a browser proxy from the languages page. Re-enable test. (Closed)
Patch Set: Make inputMethodPrivate CrOS only Created 3 years, 8 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/settings/languages_page/languages.js
diff --git a/chrome/browser/resources/settings/languages_page/languages.js b/chrome/browser/resources/settings/languages_page/languages.js
index 1487392f811540e927dacdad94dc0563525ffd09..c9c9f0f00a576200c1c33a79c5045869c4562090 100644
--- a/chrome/browser/resources/settings/languages_page/languages.js
+++ b/chrome/browser/resources/settings/languages_page/languages.js
@@ -78,12 +78,6 @@ Polymer({
},
},
- /** @type {!LanguageSettingsPrivate} */
- languageSettingsPrivate: Object,
-
- /** @type {!InputMethodPrivate} */
- inputMethodPrivate: Object,
-
/**
* Hash map of supported languages by language codes for fast lookup.
* @private {!Map<string, !chrome.languageSettingsPrivate.Language>}
@@ -148,15 +142,17 @@ Polymer({
/** @private {?Function} */
boundOnInputMethodChanged_: null,
+ /** @private {?settings.LanguagesBrowserProxy} */
+ browserProxy_: null,
+
+ /** @type {?LanguageSettingsPrivate} */
+ languageSettingsPrivate: null,
+
/** @override */
attached: function() {
+ this.browserProxy_ = settings.LanguagesBrowserProxyImpl.getInstance();
this.languageSettingsPrivate =
- settings.languageSettingsPrivateApiForTest ||
- /** @type {!LanguageSettingsPrivate} */(chrome.languageSettingsPrivate);
-
- this.inputMethodPrivate =
- settings.inputMethodPrivateApiForTest ||
- /** @type {!InputMethodPrivate} */(chrome.inputMethodPrivate);
+ this.browserProxy_.getLanguageSettingsPrivate();
var promises = [];
@@ -183,14 +179,15 @@ Polymer({
}.bind(this));
promises[4] = new Promise(function(resolve) {
- this.inputMethodPrivate.getCurrentInputMethod(resolve);
+ this.browserProxy_.getInputMethodPrivate().
+ getCurrentInputMethod(resolve);
}.bind(this));
}
if (cr.isWindows || cr.isChromeOS) {
// Fetch the starting UI language, which affects which actions should be
// enabled.
- promises.push(cr.sendWithPromise('getProspectiveUILanguage').then(
+ promises.push(this.browserProxy_.getProspectiveUILanguage().then(
function(prospectiveUILanguage) {
this.originalProspectiveUILanguage_ =
prospectiveUILanguage || window.navigator.language;
@@ -210,7 +207,7 @@ Polymer({
if (cr.isChromeOS) {
this.boundOnInputMethodChanged_ = this.onInputMethodChanged_.bind(this);
- this.inputMethodPrivate.onChanged.addListener(
+ this.browserProxy_.getInputMethodPrivate().onChanged.addListener(
assert(this.boundOnInputMethodChanged_));
}
},
@@ -218,7 +215,7 @@ Polymer({
/** @override */
detached: function() {
if (cr.isChromeOS) {
- this.inputMethodPrivate.onChanged.removeListener(
+ this.browserProxy_.getInputMethodPrivate().onChanged.removeListener(
assert(this.boundOnInputMethodChanged_));
this.boundOnInputMethodChanged_ = null;
}
@@ -485,15 +482,6 @@ Polymer({
// <if expr="chromeos or is_win">
/**
- * Sets the prospective UI language to the chosen language. This won't affect
- * the actual UI language until a restart.
- * @param {string} languageCode
- */
- setProspectiveUILanguage: function(languageCode) {
- chrome.send('setProspectiveUILanguage', [languageCode]);
- },
-
- /**
* True if the prospective UI language was changed from its starting value.
* @return {boolean}
*/
@@ -742,11 +730,6 @@ Polymer({
this.languageSettingsPrivate.removeInputMethod(id);
},
- /** @param {string} id */
- setCurrentInputMethod: function(id) {
- this.inputMethodPrivate.setCurrentInputMethod(id);
- },
-
/**
* @param {string} languageCode
* @return {!Array<!chrome.languageSettingsPrivate.InputMethod>}
@@ -763,11 +746,6 @@ Polymer({
return inputMethod.id.startsWith('_comp_');
},
- /** @param {string} id Input method ID. */
- openInputMethodOptions: function(id) {
- this.inputMethodPrivate.openOptionsPage(id);
- },
-
/** @param {string} id New current input method ID. */
onInputMethodChanged_: function(id) {
this.set('languages.inputMethods.currentId', id);

Powered by Google App Engine
This is Rietveld 408576698