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.languagesPrivate</code> API to get or change language an d | |
6 // input method settings. | |
7 namespace languagesPrivate { | |
8 // Status of a spell check dictionary download. | |
9 enum DownloadStatus { DOWNLOADED, DOWNLOADING, FAILURE }; | |
10 | |
11 dictionary Language { | |
12 DOMString code; | |
13 DOMString displayName; | |
14 DOMString nativeDisplayName; | |
15 boolean rtl; | |
16 boolean supportsSpellCheck; | |
17 boolean supportsTranslate; | |
not at google - send to devlin
2015/04/24 16:53:43
consider making the booleans optional (and default
michaelpg
2015/05/09 01:12:29
Done.
| |
18 }; | |
19 | |
20 dictionary LanguagesInfo { | |
21 // All languages available for translate, spell checking, input and locale. | |
22 Language[] languages; | |
23 | |
24 // The language code for the current locale setting. | |
25 DOMString currentLocale; | |
stevenjb
2015/04/24 00:00:20
Does this match 'Language.code'? If so, maybe we s
not at google - send to devlin
2015/04/24 16:53:43
Is this something a web API can give you anyway? l
michaelpg
2015/05/09 01:12:29
I'll standardize this better.
Technically a local
michaelpg
2015/05/09 01:12:29
navigator.language corresponds to the value of int
| |
26 | |
27 // The language codes that can be used for the locale. | |
28 DOMString[] availableLocales; | |
29 | |
30 // The language to translate to. | |
31 DOMString translateTargetLanguage; | |
32 | |
33 // The language used for spell checking. | |
34 DOMString spellCheckLanguage; | |
not at google - send to devlin
2015/04/24 16:53:42
What does translate/spellcheck data have to do wit
michaelpg
2015/05/09 01:12:29
LanguagesInfo was a confusing construct. Removed.
| |
35 | |
36 // Whether spell check auto-correct is enabled. | |
37 boolean autoCorrectEnabled; | |
not at google - send to devlin
2015/04/24 16:53:43
Ditto(s)
michaelpg
2015/05/09 01:12:29
Acknowledged.
| |
38 }; | |
39 | |
40 dictionary SpellCheckDictionaryStatus { | |
41 // The language of the dictionary. | |
42 DOMString languageCode; | |
stevenjb
2015/04/24 00:00:20
Same as Language.code? or currentLocale? or differ
michaelpg
2015/04/24 19:08:03
No, you can use any language for spell checking. S
| |
43 | |
44 // The downloading status. | |
45 DownloadStatus status; | |
46 }; | |
47 | |
48 dictionary InputMethod { | |
49 // The ID of the input method descriptor. | |
50 DOMString id; | |
51 | |
52 // The human-readable name of the input method. | |
53 DOMString displayName; | |
54 | |
55 // The name of the extension providing the input method, if any. | |
56 DOMString? extensionName; | |
not at google - send to devlin
2015/04/24 16:53:43
You will probably want to fetch other things, like
michaelpg
2015/05/09 01:12:29
You're right, we can just use the ID with chrome.m
| |
57 | |
58 // The URL for the options page for the extension, if any. | |
59 DOMString? optionsPage; | |
60 | |
61 // The language codes this input method supports. | |
62 DOMString[] languages; | |
stevenjb
2015/04/24 00:00:20
code? locale?
| |
63 | |
64 // True if the input method is enabled. | |
65 boolean enabled; | |
66 }; | |
67 | |
68 dictionary InputMethodsInfo { | |
69 // The list of built-in input methods. | |
70 InputMethod[] inputMethods; | |
71 | |
72 // The list of component extension input methods. | |
73 InputMethod[] componentExtensionIMEs; | |
74 | |
75 // The list of third-party extension input methods. | |
76 InputMethod[] thirdPartyExtensionIMEs; | |
77 }; | |
78 | |
79 callback GetLanguagesInfoCallback = void (LanguagesInfo result); | |
80 callback SpellCheckDictionaryChangedCallback = | |
81 void (SpellCheckDictionaryStatus result); | |
82 callback GetInputMethodsCallback = void (InputMethodsInfo result); | |
83 callback InputMethodEnabledDisabledCallback = void (DOMString id); | |
stevenjb
2015/04/24 00:00:20
This name is a bit odd, see below.
| |
84 | |
85 interface Functions { | |
86 // Gets information about the available languages. | |
87 static void getLanguagesInfo(GetLanguagesInfoCallback callback); | |
88 | |
89 // Changes the prospective locale. Takes effect after restarting Chrome. | |
90 static void setUILanguage(DOMString languageCode); | |
91 | |
92 // Sets the accepted languages. | |
93 static void setLanguageList(DOMString[] languageCodes); | |
94 | |
95 // Attempts to download the spell check dictionary after a failure. | |
not at google - send to devlin
2015/04/24 16:53:43
what triggers the fetch in the first place?
michaelpg
2015/04/24 19:08:03
In current Settings, if a d/l fails there's a "Ret
not at google - send to devlin
2015/04/24 20:07:25
Not really what I asked, but it sounds like the an
michaelpg
2015/04/25 02:49:16
Sorry, I misread your question. The initial downlo
| |
96 static void retrySpellCheckDictionaryDownload(); | |
97 | |
98 // Gets all supported input methods, including IMEs. | |
99 static void getInputMethods(GetInputMethodsCallback callback); | |
100 | |
101 // Enables or disables the input method. | |
102 static void setInputMethodEnabled(DOMString inputMethodId, boolean enabled); | |
stevenjb
2015/04/24 00:00:20
Can more than one input method be enabled at once?
michaelpg
2015/04/24 19:08:03
Yes, any number of input methods can be enabled. F
michaelpg
2015/05/09 01:12:29
So I understand the confusion with the terms "enab
| |
103 }; | |
104 | |
105 interface Events { | |
106 // Called when the language used for spell checking changes or the | |
107 // dictionary download status changes. | |
108 static void onSpellCheckDictionaryChanged( | |
109 SpellCheckDictionaryChangedCallback callback); | |
110 | |
111 // Called when an input method is enabled. | |
112 static void onInputMethodEnabled( | |
113 InputMethodEnabledDisabledCallback callback); | |
114 | |
115 // Called when an input method is disabled. | |
116 static void onInputMethodDisabled( | |
117 InputMethodEnabledDisabledCallback callback); | |
stevenjb
2015/04/24 00:00:20
Might these be better as a single event with a boo
michaelpg
2015/04/24 19:08:03
I haven't found a single instance of a callback wi
not at google - send to devlin
2015/04/24 20:07:25
It might be possible, though we do prefer bundling
| |
118 }; | |
119 }; | |
OLD | NEW |