OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ | 5 #ifndef CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ |
6 #define CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ | 6 #define CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ |
7 | 7 |
| 8 #include <map> |
8 #include <set> | 9 #include <set> |
9 | 10 |
10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
13 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
14 #include "chromeos/ime/input_method_descriptor.h" | 15 #include "chromeos/ime/input_method_descriptor.h" |
15 | 16 |
16 namespace chromeos { | 17 namespace chromeos { |
17 | 18 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // false if already corresponding component extension is unloaded. | 82 // false if already corresponding component extension is unloaded. |
82 bool UnloadComponentExtensionIME(const std::string& input_method_id); | 83 bool UnloadComponentExtensionIME(const std::string& input_method_id); |
83 | 84 |
84 // Returns true if |input_method_id| is whitelisted component extension input | 85 // Returns true if |input_method_id| is whitelisted component extension input |
85 // method. | 86 // method. |
86 bool IsWhitelisted(const std::string& input_method_id); | 87 bool IsWhitelisted(const std::string& input_method_id); |
87 | 88 |
88 // Returns true if |extension_id| is whitelisted component extension. | 89 // Returns true if |extension_id| is whitelisted component extension. |
89 bool IsWhitelistedExtension(const std::string& extension_id); | 90 bool IsWhitelistedExtension(const std::string& extension_id); |
90 | 91 |
91 // Returns InputMethodId. This function returns empty string if |extension_id| | |
92 // and |engine_id| is not a whitelisted component extention IME. | |
93 std::string GetId(const std::string& extension_id, | |
94 const std::string& engine_id); | |
95 | |
96 // Returns localized name of |input_method_id|. | |
97 std::string GetName(const std::string& input_method_id); | |
98 | |
99 // Returns localized description of |input_method_id|. | |
100 std::string GetDescription(const std::string& input_method_id); | |
101 | |
102 // Returns list of input method id associated with |language|. | |
103 std::vector<std::string> ListIMEByLanguage(const std::string& language); | |
104 | |
105 // Returns all IME as InputMethodDescriptors. | 92 // Returns all IME as InputMethodDescriptors. |
106 input_method::InputMethodDescriptors GetAllIMEAsInputMethodDescriptor(); | 93 input_method::InputMethodDescriptors GetAllIMEAsInputMethodDescriptor(); |
107 | 94 |
108 // Returns all XKB keyboard IME as InputMethodDescriptors. | 95 // Returns all XKB keyboard IME as InputMethodDescriptors. |
109 input_method::InputMethodDescriptors GetXkbIMEAsInputMethodDescriptor(); | 96 input_method::InputMethodDescriptors GetXkbIMEAsInputMethodDescriptor(); |
110 | 97 |
111 private: | 98 private: |
112 // Finds ComponentExtensionIME and EngineDescription associated with | 99 // Finds ComponentExtensionIME and EngineDescription associated with |
113 // |input_method_id|. This function retruns true if it is found, otherwise | 100 // |input_method_id|. This function retruns true if it is found, otherwise |
114 // returns false. |out_extension| and |out_engine| can be NULL. | 101 // returns false. |out_extension| and |out_engine| can be NULL. |
115 bool FindEngineEntry(const std::string& input_method_id, | 102 bool FindEngineEntry(const std::string& input_method_id, |
116 ComponentExtensionIME* out_extension, | 103 ComponentExtensionIME* out_extension); |
117 ComponentExtensionEngine* out_engine); | |
118 | 104 |
119 bool IsInLoginLayoutWhitelist(const std::vector<std::string>& layouts); | 105 bool IsInLoginLayoutWhitelist(const std::vector<std::string>& layouts); |
120 | 106 |
121 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate_; | 107 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate_; |
122 | 108 |
123 std::vector<ComponentExtensionIME> component_extension_imes_; | 109 // The map of extension_id to ComponentExtensionIME instance. |
| 110 // It's filled by Initialize() method and never changed during runtime. |
| 111 std::map<std::string, ComponentExtensionIME> component_extension_imes_; |
| 112 |
| 113 // For quick check the validity of a given input method id. |
| 114 // It's filled by Initialize() method and never changed during runtime. |
| 115 std::set<std::string> input_method_id_set_; |
124 | 116 |
125 std::set<std::string> login_layout_set_; | 117 std::set<std::string> login_layout_set_; |
126 | 118 |
127 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager); | 119 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager); |
128 }; | 120 }; |
129 | 121 |
130 } // namespace chromeos | 122 } // namespace chromeos |
131 | 123 |
132 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ | 124 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ |
OLD | NEW |