Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 // Use the <code>chrome.languageSettingsPrivate</code> API to get or change | 5 // Use the <code>chrome.languageSettingsPrivate</code> API to get or change |
| 6 // language and input method settings. | 6 // language and input method settings. |
| 7 namespace languageSettingsPrivate { | 7 namespace languageSettingsPrivate { |
| 8 // Status of a spell check dictionary download. | |
| 9 enum DownloadStatus { DOWNLOADED, DOWNLOADING, FAILURE }; | |
| 10 | |
| 11 dictionary Language { | 8 dictionary Language { |
| 12 // The unique code identifying the language. | 9 // The unique code identifying the language. |
| 13 DOMString code; | 10 DOMString code; |
| 14 | 11 |
| 15 // The name of the language, in the current UI language. | 12 // The name of the language, in the current UI language. |
| 16 DOMString displayName; | 13 DOMString displayName; |
| 17 | 14 |
| 18 // The name of the language as it is in its own language. | 15 // The name of the language as it is in its own language. |
| 19 DOMString nativeDisplayName; | 16 DOMString nativeDisplayName; |
| 20 | 17 |
| 21 // Whether the directionality is RTL. Defaults to false. | 18 // Whether the display name has RTL. Defaults to false. |
| 22 boolean? rtl; | 19 boolean? rtl; |
|
stevenjb
2015/08/10 15:57:20
As long as we are renaming things, I would rename
michaelpg
2015/08/10 22:35:06
Done.
| |
| 23 | 20 |
| 24 // Whether the UI can be displayed in this language. Defaults to false. | 21 // Whether the UI can be displayed in this language. Defaults to false. |
| 25 boolean? supportsUI; | 22 boolean? supportsUi; |
|
stevenjb
2015/08/10 15:57:20
I would leave this UI. With a TLA like RTL I could
not at google - send to devlin
2015/08/10 17:01:04
+1 and I don't see the point of this little bit of
michaelpg
2015/08/10 22:35:06
Done. I guess I was thinking of the C++ naming gui
| |
| 26 | 23 |
| 27 // Whether this language can be used for spell checking. Defaults to false. | 24 // Whether this language can be used for spell checking. Defaults to false. |
| 28 boolean? supportsSpellCheck; | 25 boolean? supportsSpellcheck; |
| 29 | 26 |
| 30 // Whether this language has translations for the current target language. | 27 // Whether this language has translations for the current target language. |
| 31 // Defaults to false. | 28 // Defaults to false. |
| 32 boolean? supportsTranslate; | 29 boolean? supportsTranslate; |
| 33 }; | 30 }; |
| 34 | 31 |
| 35 dictionary SpellCheckDictionaryStatus { | 32 dictionary SpellcheckDictionaryStatus { |
| 36 // The language code of the dictionary that the status describes. | 33 // The language code of the dictionary that the status describes. |
| 37 DOMString languageCode; | 34 DOMString languageCode; |
| 38 | 35 |
| 39 // The download status of the dictionary. | 36 // Whether the dictionary is ready (has been loaded from disk or |
| 40 DownloadStatus status; | 37 // successfully downloaded). |
| 38 boolean isReady; | |
| 39 | |
| 40 // Whether the dictionary is being downloaded. Defaults to false. | |
| 41 boolean? isDownloading; | |
| 42 | |
| 43 // Whether the dictionary download failed. Defaults to false. | |
| 44 boolean? downloadFailed; | |
| 41 }; | 45 }; |
| 42 | 46 |
| 43 dictionary InputMethod { | 47 dictionary InputMethod { |
| 44 // The ID of the input method descriptor. | 48 // The ID of the input method descriptor. |
| 45 DOMString id; | 49 DOMString id; |
| 46 | 50 |
| 47 // The human-readable name of the input method. | 51 // The human-readable name of the input method. |
| 48 DOMString displayName; | 52 DOMString displayName; |
| 49 | 53 |
| 50 // The language codes this input method supports. | 54 // The language codes this input method supports. |
| 51 DOMString[] languageCodes; | 55 DOMString[] languageCodes; |
| 52 | 56 |
| 53 // True if the input method is enabled. | 57 // True if the input method is enabled. |
| 54 boolean enabled; | 58 boolean enabled; |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 dictionary InputMethodLists { | 61 dictionary InputMethodLists { |
| 58 // The list of built-in input methods. | 62 // The list of built-in input methods. |
| 59 InputMethod[] inputMethods; | 63 InputMethod[] inputMethods; |
| 60 | 64 |
| 61 // The list of component extension input methods. | 65 // The list of component extension input methods. |
| 62 InputMethod[] componentExtensionIMEs; | 66 InputMethod[] componentExtensionIMEs; |
| 63 | 67 |
| 64 // The list of third-party extension input methods. | 68 // The list of third-party extension input methods. |
| 65 InputMethod[] thirdPartyExtensionIMEs; | 69 InputMethod[] thirdPartyExtensionIMEs; |
| 66 }; | 70 }; |
| 67 | 71 |
| 68 callback GetLanguageListCallback = void (Language[] languages); | 72 callback GetLanguageListCallback = void (Language[] languages); |
| 69 callback GetInputMethodListsCallback = void (InputMethodLists lists); | 73 callback GetInputMethodListsCallback = void (InputMethodLists lists); |
| 70 callback GetSpellCheckWordsCallback = void (DOMString[] words); | 74 callback GetSpellcheckWordsCallback = void (DOMString[] words); |
| 71 callback GetTranslateTargetLanguageCallback = void (DOMString languageCode); | 75 callback GetTranslateTargetLanguageCallback = void (DOMString languageCode); |
| 72 callback GetSpellCheckDictionaryStatusCallback = | 76 callback GetSpellcheckDictionaryStatusesCallback = |
| 73 void (SpellCheckDictionaryStatus status); | 77 void (SpellcheckDictionaryStatus[] status); |
| 74 callback InputMethodAddedRemovedCallback = void (DOMString inputMethodId); | 78 callback InputMethodAddedRemovedCallback = void (DOMString inputMethodId); |
|
stevenjb
2015/08/10 15:57:20
Unused
michaelpg
2015/08/10 22:35:06
Removed.
| |
| 75 | 79 |
| 76 interface Functions { | 80 interface Functions { |
| 77 // Gets languages available for translate, spell checking, input and locale. | 81 // Gets languages available for translate, spell checking, input and locale. |
| 78 static void getLanguageList(GetLanguageListCallback callback); | 82 static void getLanguageList(GetLanguageListCallback callback); |
| 79 | 83 |
| 80 // Sets the accepted languages, used to decide which languages to translate, | 84 // Sets the accepted languages, used to decide which languages to translate, |
| 81 // generate the Accept-Language header, etc. | 85 // generate the Accept-Language header, etc. |
| 82 static void setLanguageList(DOMString[] languageCodes); | 86 static void setLanguageList(DOMString[] languageCodes); |
| 83 | 87 |
| 84 // Gets the current status of the spell check dictionary. | 88 // Gets the current status of the chosen spell check dictionaries. |
| 85 static void getSpellCheckDictionaryStatus( | 89 static void getSpellcheckDictionaryStatuses( |
| 86 GetSpellCheckDictionaryStatusCallback callback); | 90 GetSpellcheckDictionaryStatusesCallback callback); |
| 87 | 91 |
| 88 // Gets the custom spell check words. | 92 // Gets the custom spell check words. |
| 89 static void getSpellCheckWords(GetSpellCheckWordsCallback callback); | 93 static void getSpellcheckWords(GetSpellcheckWordsCallback callback); |
| 90 | 94 |
| 91 // Gets the translate target language (in most cases, the display locale). | 95 // Gets the translate target language (in most cases, the display locale). |
| 92 static void getTranslateTargetLanguage( | 96 static void getTranslateTargetLanguage( |
| 93 GetTranslateTargetLanguageCallback callback); | 97 GetTranslateTargetLanguageCallback callback); |
| 94 | 98 |
| 95 // Gets all supported input methods, including IMEs. Chrome OS only. | 99 // Gets all supported input methods, including IMEs. Chrome OS only. |
| 96 static void getInputMethodLists(GetInputMethodListsCallback callback); | 100 static void getInputMethodLists(GetInputMethodListsCallback callback); |
| 97 | 101 |
| 98 // Adds the input method to the current user's list of enabled input | 102 // Adds the input method to the current user's list of enabled input |
| 99 // methods, enabling the input method for the current user. Chrome OS only. | 103 // methods, enabling the input method for the current user. Chrome OS only. |
| 100 static void addInputMethod(DOMString inputMethodId); | 104 static void addInputMethod(DOMString inputMethodId); |
| 101 | 105 |
| 102 // Removes the input method from the current user's list of enabled input | 106 // Removes the input method from the current user's list of enabled input |
| 103 // methods, disabling the input method for the current user. Chrome OS only. | 107 // methods, disabling the input method for the current user. Chrome OS only. |
| 104 static void removeInputMethod(DOMString inputMethodId); | 108 static void removeInputMethod(DOMString inputMethodId); |
| 105 }; | 109 }; |
| 106 | 110 |
| 107 interface Events { | 111 interface Events { |
| 108 // Called when the language used for spell checking changes or the | 112 // Called when the pref for the dictionaries used for spell checking changes |
| 109 // dictionary download status changes. | 113 // or the status of one of the spell check dictionaries changes. |
| 110 static void onSpellCheckDictionaryChanged( | 114 static void onSpellcheckDictionariesChanged( |
| 111 GetSpellCheckDictionaryStatusCallback callback); | 115 SpellcheckDictionaryStatus[] statuses); |
| 116 | |
| 117 // Called when words are added to and/or removed from the custom spell check | |
| 118 // dictionary. | |
| 119 static void onCustomDictionaryChanged( | |
| 120 DOMString[] wordsAdded, DOMString[] wordsRemoved); | |
| 112 | 121 |
| 113 // Called when an input method is added. | 122 // Called when an input method is added. |
| 114 static void onInputMethodAdded( | 123 static void onInputMethodAdded(DOMString inputMethodId); |
| 115 InputMethodAddedRemovedCallback callback); | |
| 116 | 124 |
| 117 // Called when an input method is removed. | 125 // Called when an input method is removed. |
| 118 static void onInputMethodRemoved( | 126 static void onInputMethodRemoved(DOMString inputMethodId); |
| 119 InputMethodAddedRemovedCallback callback); | |
| 120 }; | 127 }; |
| 121 }; | 128 }; |
| OLD | NEW |