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