| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview A helper object used from the languages section | 6 * @fileoverview A helper object used from the languages section |
| 7 * to interact with the browser. | 7 * to interact with the browser. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 cr.define('settings', function() { | 10 cr.define('settings', function() { |
| 11 /** @interface */ | 11 /** @interface */ |
| 12 function LanguagesBrowserProxy() {} | 12 function LanguagesBrowserProxy() {} |
| 13 | 13 |
| 14 LanguagesBrowserProxy.prototype = { | 14 LanguagesBrowserProxy.prototype = { |
| 15 // <if expr="chromeos or is_win"> | 15 // <if expr="chromeos or is_win"> |
| 16 /** | 16 /** |
| 17 * Sets the prospective UI language to the chosen language. This won't | 17 * Sets the prospective UI language to the chosen language. This won't |
| 18 * affect the actual UI language until a restart. | 18 * affect the actual UI language until a restart. |
| 19 * @param {string} languageCode | 19 * @param {string} languageCode |
| 20 */ | 20 */ |
| 21 setProspectiveUILanguage: function(languageCode) {}, | 21 setProspectiveUILanguage: function(languageCode) {}, |
| 22 | 22 |
| 23 /** @return {!Promise<string>} */ | 23 /** @return {!Promise<string>} */ |
| 24 getProspectiveUILanguage: function() {}, | 24 getProspectiveUILanguage: function() {}, |
| 25 // </if> | 25 // </if> |
| 26 | 26 |
| 27 /** @return {!LanguageSettingsPrivate} */ | 27 /** @return {!LanguageSettingsPrivate} */ |
| 28 getLanguageSettingsPrivate: function() {}, | 28 getLanguageSettingsPrivate: function() {}, |
| 29 | 29 |
| 30 // <if expr="chromeos"> | 30 // <if expr="chromeos"> |
| 31 /** @return {!InputMethodPrivate} */ | 31 /** @return {!InputMethodPrivate} */ |
| 32 getInputMethodPrivate: function() {}, | 32 getInputMethodPrivate: function() {}, |
| 33 // </if> | 33 // </if> |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * @constructor | 37 * @constructor |
| 38 * @implements {settings.LanguagesBrowserProxy} | 38 * @implements {settings.LanguagesBrowserProxy} |
| 39 */ | 39 */ |
| 40 function LanguagesBrowserProxyImpl() {} | 40 function LanguagesBrowserProxyImpl() {} |
| 41 // The singleton instance_ is replaced with a test version of this wrapper | 41 // The singleton instance_ is replaced with a test version of this wrapper |
| 42 // during testing. | 42 // during testing. |
| 43 cr.addSingletonGetter(LanguagesBrowserProxyImpl); | 43 cr.addSingletonGetter(LanguagesBrowserProxyImpl); |
| 44 | 44 |
| 45 LanguagesBrowserProxyImpl.prototype = { | 45 LanguagesBrowserProxyImpl.prototype = { |
| 46 // <if expr="chromeos or is_win"> | 46 // <if expr="chromeos or is_win"> |
| 47 /** @override */ | 47 /** @override */ |
| 48 setProspectiveUILanguage: function(languageCode) { | 48 setProspectiveUILanguage: function(languageCode) { |
| 49 chrome.send('setProspectiveUILanguage', [languageCode]); | 49 chrome.send('setProspectiveUILanguage', [languageCode]); |
| 50 }, | 50 }, |
| 51 | 51 |
| 52 /** @override */ | 52 /** @override */ |
| 53 getProspectiveUILanguage: function() { | 53 getProspectiveUILanguage: function() { |
| 54 return cr.sendWithPromise('getProspectiveUILanguage'); | 54 return cr.sendWithPromise('getProspectiveUILanguage'); |
| 55 }, | 55 }, |
| 56 // </if> | 56 // </if> |
| 57 | 57 |
| 58 /** @override */ | 58 /** @override */ |
| 59 getLanguageSettingsPrivate: function() { | 59 getLanguageSettingsPrivate: function() { |
| 60 return /** @type {!LanguageSettingsPrivate} */ ( | 60 return /** @type {!LanguageSettingsPrivate} */ ( |
| 61 chrome.languageSettingsPrivate); | 61 chrome.languageSettingsPrivate); |
| 62 }, | 62 }, |
| 63 | 63 |
| 64 // <if expr="chromeos"> | 64 // <if expr="chromeos"> |
| 65 /** @override */ | 65 /** @override */ |
| 66 getInputMethodPrivate: function() { | 66 getInputMethodPrivate: function() { |
| 67 return /** @type {!InputMethodPrivate} */ (chrome.inputMethodPrivate); | 67 return /** @type {!InputMethodPrivate} */ (chrome.inputMethodPrivate); |
| 68 }, | 68 }, |
| 69 // </if> | 69 // </if> |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 return { | 72 return { |
| 73 LanguagesBrowserProxy: LanguagesBrowserProxy, | 73 LanguagesBrowserProxy: LanguagesBrowserProxy, |
| 74 LanguagesBrowserProxyImpl: LanguagesBrowserProxyImpl, | 74 LanguagesBrowserProxyImpl: LanguagesBrowserProxyImpl, |
| 75 }; | 75 }; |
| 76 }); | 76 }); |
| OLD | NEW |