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 downloading status. | |
stevenjb
2015/05/11 01:25:57
nit: The download status of the dictionary.
michaelpg
2015/07/07 00:12:30
Done.
| |
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 // Changes the prospective locale. Takes effect after restarting Chrome. | |
75 static void setUILanguage(DOMString languageCode); | |
stevenjb
2015/05/11 01:25:57
Question: How does the UI know what the current la
michaelpg
2015/05/11 08:16:01
navigator.language provides the actual current UI
stevenjb
2015/06/01 18:08:06
As long as we document that there, I am fine with
michaelpg
2015/07/07 00:12:30
Removed from here.
| |
76 | |
77 // Sets the accepted languages. | |
stevenjb
2015/05/11 01:25:57
Maybe elaborate? It's not obvious (to me) what 'ac
michaelpg
2015/07/07 00:12:29
Done. (tl;dr: a lot of things)
| |
78 static void setLanguageList(DOMString[] languageCodes); | |
79 | |
80 // Gets the current status of the spell check dictionary. | |
81 static void getSpellCheckDictionaryStatus( | |
82 GetSpellCheckDictionaryStatusCallback callback); | |
83 | |
84 // Attempts to download the spell check dictionary after a failure. | |
stevenjb
2015/05/11 01:25:57
Why do we need to expose this to the UI?
michaelpg
2015/05/11 08:16:01
Options currently shows a "Retry" button if the do
stevenjb
2015/06/01 18:08:06
Yes. IMHO, 'Retry' represents poor/lazy UI. Downlo
michaelpg
2015/07/07 00:12:29
Acknowledged.
| |
85 static void retrySpellCheckDictionaryDownload(); | |
86 | |
87 // Gets the custom spell check words. | |
88 static void getSpellCheckWords(GetSpellCheckWordsCallback callback); | |
89 | |
90 // Gets all supported input methods, including IMEs. | |
91 static void getInputMethodLists(GetInputMethodListsCallback callback); | |
92 | |
93 // Enables the input method for the current user. | |
94 static void addInputMethod(DOMString inputMethodId); | |
95 | |
96 // Disables the input method for the current user. | |
stevenjb
2015/05/11 01:25:57
Disable (implies it remains in the list but not en
michaelpg
2015/05/11 08:16:02
Both? The input method will be removed from the us
stevenjb
2015/06/01 18:08:06
"Removes the input method from the list of enabled
michaelpg
2015/07/07 00:12:30
Done.
| |
97 static void removeInputMethod(DOMString inputMethodId); | |
98 | |
99 // Gets the translate target language (in most cases, the display locale). | |
100 static void getTranslateTargetLangage( | |
101 GetTranslateTargetLanguageCallback callback); | |
102 }; | |
103 | |
104 interface Events { | |
105 // Called when the language used for spell checking changes or the | |
106 // dictionary download status changes. | |
107 static void onSpellCheckDictionaryChanged( | |
108 GetSpellCheckDictionaryStatusCallback callback); | |
109 | |
110 // Called when an input method is enabled. | |
111 static void onInputMethodEnabled( | |
112 InputMethodEnabledDisabledCallback callback); | |
113 | |
114 // Called when an input method is disabled. | |
115 static void onInputMethodDisabled( | |
116 InputMethodEnabledDisabledCallback callback); | |
117 }; | |
118 }; | |
OLD | NEW |