Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / base / ime / chromeos / extension_ime_util.h
blob08dbc7b5c3428b38f14321989280d56bf530fcdf
1 // Copyright 2013 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.
5 #ifndef UI_BASE_IME_CHROMEOS_EXTENSION_IME_UTIL_H_
6 #define UI_BASE_IME_CHROMEOS_EXTENSION_IME_UTIL_H_
8 #include <string>
10 #include "base/auto_reset.h"
11 #include "ui/base/ime/ui_base_ime_export.h"
13 namespace chromeos {
15 // Extension IME related utilities.
16 namespace extension_ime_util {
18 #if defined(GOOGLE_CHROME_BUILD)
19 const char kXkbExtensionId[] = "jkghodnilhceideoidjikpgommlajknk";
20 const char kM17nExtensionId[] = "gjaehgfemfahhmlgpdfknkhdnemmolop";
21 const char kHangulExtensionId[] = "bdgdidmhaijohebebipajioienkglgfo";
22 const char kMozcExtensionId[] = "gjaehgfemfahhmlgpdfknkhdnemmolop";
23 const char kT13nExtensionId[] = "gjaehgfemfahhmlgpdfknkhdnemmolop";
24 const char kChinesePinyinExtensionId[] = "gjaehgfemfahhmlgpdfknkhdnemmolop";
25 const char kChineseZhuyinExtensionId[] = "gjaehgfemfahhmlgpdfknkhdnemmolop";
26 const char kChineseCangjieExtensionId[] = "gjaehgfemfahhmlgpdfknkhdnemmolop";
27 #else
28 const char kXkbExtensionId[] = "fgoepimhcoialccpbmpnnblemnepkkao";
29 const char kM17nExtensionId[] = "jhffeifommiaekmbkkjlpmilogcfdohp";
30 const char kHangulExtensionId[] = "bdgdidmhaijohebebipajioienkglgfo";
31 const char kMozcExtensionId[] = "bbaiamgfapehflhememkfglaehiobjnk";
32 const char kT13nExtensionId[] = "gjaehgfemfahhmlgpdfknkhdnemmolop";
33 const char kChinesePinyinExtensionId[] = "cpgalbafkoofkjmaeonnfijgpfennjjn";
34 const char kChineseZhuyinExtensionId[] = "ekbifjdfhkmdeeajnolmgdlmkllopefi";
35 const char kChineseCangjieExtensionId[] = "aeebooiibjahgpgmhkeocbeekccfknbj";
36 #endif
38 // Returns InputMethodID for |engine_id| in |extension_id| of extension IME.
39 // This function does not check |extension_id| is installed extension IME nor
40 // |engine_id| is really a member of |extension_id|.
41 std::string UI_BASE_IME_EXPORT
42 GetInputMethodID(const std::string& extension_id, const std::string& engine_id);
44 // Returns InputMethodID for |engine_id| in |extension_id| of component
45 // extension IME, This function does not check |extension_id| is component one
46 // nor |engine_id| is really a member of |extension_id|.
47 std::string UI_BASE_IME_EXPORT
48 GetComponentInputMethodID(const std::string& extension_id,
49 const std::string& engine_id);
51 // Returns extension ID if |input_method_id| is extension IME ID or component
52 // extension IME ID. Otherwise returns an empty string ("").
53 std::string UI_BASE_IME_EXPORT
54 GetExtensionIDFromInputMethodID(const std::string& input_method_id);
56 // Returns InputMethodID from engine id (e.g. xkb:fr:fra), or returns itself if
57 // the |engine_id| is not a known engine id.
58 // The caller must make sure the |engine_id| is from system input methods
59 // instead of 3rd party input methods.
60 std::string UI_BASE_IME_EXPORT
61 GetInputMethodIDByEngineID(const std::string& engine_id);
63 // Returns true if |input_method_id| is extension IME ID. This function does not
64 // check |input_method_id| is installed extension IME.
65 bool UI_BASE_IME_EXPORT IsExtensionIME(const std::string& input_method_id);
67 // Returns true if |input_method_id| is component extension IME ID. This
68 // function does not check |input_method_id| is really whitelisted one or not.
69 // If you want to check |input_method_id| is whitelisted component extension
70 // IME, please use ComponentExtensionIMEManager::IsWhitelisted instead.
71 bool UI_BASE_IME_EXPORT
72 IsComponentExtensionIME(const std::string& input_method_id);
74 // Returns true if the |input_method| is a member of |extension_id| of extension
75 // IME, otherwise returns false.
76 bool UI_BASE_IME_EXPORT IsMemberOfExtension(const std::string& input_method_id,
77 const std::string& extension_id);
79 // Returns true if the |input_method_id| is the extension based xkb keyboard,
80 // otherwise returns false.
81 bool UI_BASE_IME_EXPORT
82 IsKeyboardLayoutExtension(const std::string& input_method_id);
84 // Returns input method component id from the extension-based InputMethodID
85 // for component IME extensions. This function does not check that
86 // |input_method_id| is installed.
87 std::string UI_BASE_IME_EXPORT
88 GetComponentIDByInputMethodID(const std::string& input_method_id);
90 // Gets legacy xkb id (e.g. xkb:us::eng) from the new extension based xkb id
91 // (e.g. _comp_ime_...xkb:us::eng). If the given id is not prefixed with
92 // 'xkb:', just return the same as the given id.
93 std::string UI_BASE_IME_EXPORT
94 MaybeGetLegacyXkbId(const std::string& input_method_id);
96 } // namespace extension_ime_util
98 } // namespace chromeos
100 #endif // UI_BASE_IME_CHROMEOS_EXTENSION_IME_UTIL_H_