OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 // Use the <code>chrome.languageSettingsPrivate</code> API to get or change |
| 6 // language and input method settings. |
| 7 namespace languageSettingsPrivate { |
| 8 // Status of a spell check dictionary download. |
| 9 enum DownloadStatus { DOWNLOADED, DOWNLOADING, FAILURE }; |
| 10 |
| 11 dictionary Language { |
| 12 // The unique code identifying the language. |
| 13 DOMString code; |
| 14 // The name of the language, in the current UI language. |
| 15 DOMString displayName; |
| 16 // The name of the language as it is in its own language. |
| 17 DOMString nativeDisplayName; |
| 18 // Whether the directionality is RTL. Defaults to false. |
| 19 boolean? rtl; |
| 20 // Whether the UI can be displayed in this language. Defaults to false. |
| 21 boolean? supportsUI; |
| 22 // Whether this language can be used for spell checking. Defaults to false. |
| 23 boolean? supportsSpellCheck; |
| 24 // Whether this language has translations for the current target language. |
| 25 // Defaults to false. |
| 26 boolean? supportsTranslate; |
| 27 }; |
| 28 |
| 29 dictionary SpellCheckDictionaryStatus { |
| 30 // The language code of the dictionary that the status describes. |
| 31 DOMString languageCode; |
| 32 |
| 33 // The download status of the dictionary. |
| 34 DownloadStatus status; |
| 35 }; |
| 36 |
| 37 dictionary InputMethod { |
| 38 // The ID of the input method descriptor. |
| 39 DOMString id; |
| 40 |
| 41 // The human-readable name of the input method. |
| 42 DOMString displayName; |
| 43 |
| 44 // The language codes this input method supports. |
| 45 DOMString[] languageCodes; |
| 46 |
| 47 // True if the input method is enabled. |
| 48 boolean enabled; |
| 49 }; |
| 50 |
| 51 dictionary InputMethodLists { |
| 52 // The list of built-in input methods. |
| 53 InputMethod[] inputMethods; |
| 54 |
| 55 // The list of component extension input methods. |
| 56 InputMethod[] componentExtensionIMEs; |
| 57 |
| 58 // The list of third-party extension input methods. |
| 59 InputMethod[] thirdPartyExtensionIMEs; |
| 60 }; |
| 61 |
| 62 callback GetLanguageListCallback = void (Language[] languages); |
| 63 callback GetInputMethodListsCallback = void (InputMethodLists lists); |
| 64 callback GetSpellCheckWordsCallback = void (DOMString[] words); |
| 65 callback GetTranslateTargetLanguageCallback = void (DOMString languageCode); |
| 66 callback GetSpellCheckDictionaryStatusCallback = |
| 67 void (SpellCheckDictionaryStatus status); |
| 68 callback InputMethodAddedRemovedCallback = void (DOMString inputMethodId); |
| 69 |
| 70 interface Functions { |
| 71 // Gets languages available for translate, spell checking, input and locale. |
| 72 static void getLanguageList(GetLanguageListCallback callback); |
| 73 |
| 74 // Sets the accepted languages, used to decide which languages to translate, |
| 75 // generate the Accept-Language header, etc. |
| 76 static void setLanguageList(DOMString[] languageCodes); |
| 77 |
| 78 // Gets the current status of the spell check dictionary. |
| 79 static void getSpellCheckDictionaryStatus( |
| 80 GetSpellCheckDictionaryStatusCallback callback); |
| 81 |
| 82 // Gets the custom spell check words. |
| 83 static void getSpellCheckWords(GetSpellCheckWordsCallback callback); |
| 84 |
| 85 // Gets the translate target language (in most cases, the display locale). |
| 86 static void getTranslateTargetLanguage( |
| 87 GetTranslateTargetLanguageCallback callback); |
| 88 |
| 89 // Gets all supported input methods, including IMEs. Chrome OS only. |
| 90 static void getInputMethodLists(GetInputMethodListsCallback callback); |
| 91 |
| 92 // Adds the input method to the current user's list of enabled input |
| 93 // methods, enabling the input method for the current user. Chrome OS only. |
| 94 static void addInputMethod(DOMString inputMethodId); |
| 95 |
| 96 // Removes the input method from the current user's list of enabled input |
| 97 // methods, disabling the input method for the current user. Chrome OS only. |
| 98 static void removeInputMethod(DOMString inputMethodId); |
| 99 }; |
| 100 |
| 101 interface Events { |
| 102 // Called when the language used for spell checking changes or the |
| 103 // dictionary download status changes. |
| 104 static void onSpellCheckDictionaryChanged( |
| 105 GetSpellCheckDictionaryStatusCallback callback); |
| 106 |
| 107 // Called when an input method is added. |
| 108 static void onInputMethodAdded( |
| 109 InputMethodAddedRemovedCallback callback); |
| 110 |
| 111 // Called when an input method is removed. |
| 112 static void onInputMethodRemoved( |
| 113 InputMethodAddedRemovedCallback callback); |
| 114 }; |
| 115 }; |
OLD | NEW |