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 <set> | 8 #include <set> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 virtual bool Unload(const std::string& extension_id, | 59 virtual bool Unload(const std::string& extension_id, |
60 const base::FilePath& path) = 0; | 60 const base::FilePath& path) = 0; |
61 }; | 61 }; |
62 | 62 |
63 // This class manages component extension input method. | 63 // This class manages component extension input method. |
64 class CHROMEOS_EXPORT ComponentExtensionIMEManager { | 64 class CHROMEOS_EXPORT ComponentExtensionIMEManager { |
65 public: | 65 public: |
66 class Observer { | 66 class Observer { |
67 public: | 67 public: |
68 // Called when the initialization is done. | 68 // Called when the initialization is done. |
69 virtual void OnInitialized() = 0; | 69 virtual void OnInitialized() = 0; |
Yuki
2014/03/07 07:47:04
This is not your fault, but this is a very bad nam
Shu Chen
2014/03/07 08:24:09
Done.
| |
70 }; | 70 }; |
71 | 71 |
72 ComponentExtensionIMEManager(); | 72 ComponentExtensionIMEManager(); |
73 virtual ~ComponentExtensionIMEManager(); | 73 virtual ~ComponentExtensionIMEManager(); |
74 | 74 |
75 // Initializes component extension manager. This function create internal | 75 // Initializes component extension manager. This function create internal |
76 // mapping between input method id and engine components. This function must | 76 // mapping between input method id and engine components. This function must |
77 // be called before using any other function. | 77 // be called before using any other function. |
78 void Initialize(scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate); | 78 void Initialize(scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate); |
79 | 79 |
80 // Notifies the observes for the component extension IMEs are initialized. | |
Yuki
2014/03/07 07:47:04
typo: s/observes/observers/
Shu Chen
2014/03/07 08:24:09
Done.
| |
81 void NotifyInitialized(); | |
82 | |
80 // Returns true if the initialization is done, otherwise returns false. | 83 // Returns true if the initialization is done, otherwise returns false. |
81 bool IsInitialized(); | 84 bool IsInitialized(); |
82 | 85 |
83 // Loads |input_method_id| component extension IME. This function returns true | 86 // Loads |input_method_id| component extension IME. This function returns true |
84 // on success. This function is safe to call multiple times. Returns false if | 87 // on success. This function is safe to call multiple times. Returns false if |
85 // already corresponding component extension is loaded. | 88 // already corresponding component extension is loaded. |
86 bool LoadComponentExtensionIME(const std::string& input_method_id); | 89 bool LoadComponentExtensionIME(const std::string& input_method_id); |
87 | 90 |
88 // Unloads |input_method_id| component extension IME. This function returns | 91 // Unloads |input_method_id| component extension IME. This function returns |
89 // true on success. This function is safe to call multiple times. Returns | 92 // true on success. This function is safe to call multiple times. Returns |
(...skipping 17 matching lines...) Expand all Loading... | |
107 | 110 |
108 // Returns localized description of |input_method_id|. | 111 // Returns localized description of |input_method_id|. |
109 std::string GetDescription(const std::string& input_method_id); | 112 std::string GetDescription(const std::string& input_method_id); |
110 | 113 |
111 // Returns list of input method id associated with |language|. | 114 // Returns list of input method id associated with |language|. |
112 std::vector<std::string> ListIMEByLanguage(const std::string& language); | 115 std::vector<std::string> ListIMEByLanguage(const std::string& language); |
113 | 116 |
114 // Returns all IME as InputMethodDescriptors. | 117 // Returns all IME as InputMethodDescriptors. |
115 input_method::InputMethodDescriptors GetAllIMEAsInputMethodDescriptor(); | 118 input_method::InputMethodDescriptors GetAllIMEAsInputMethodDescriptor(); |
116 | 119 |
120 // Returns all XKB keyboard IME as InputMethodDescriptors. | |
121 input_method::InputMethodDescriptors GetXkbIMEAsInputMethodDescriptor(); | |
122 | |
117 void AddObserver(Observer* observer); | 123 void AddObserver(Observer* observer); |
118 void RemoveObserver(Observer* observer); | 124 void RemoveObserver(Observer* observer); |
119 | 125 |
120 private: | 126 private: |
121 // Finds ComponentExtensionIME and EngineDescription associated with | 127 // Finds ComponentExtensionIME and EngineDescription associated with |
122 // |input_method_id|. This function retruns true if it is found, otherwise | 128 // |input_method_id|. This function retruns true if it is found, otherwise |
123 // returns false. |out_extension| and |out_engine| can be NULL. | 129 // returns false. |out_extension| and |out_engine| can be NULL. |
124 bool FindEngineEntry(const std::string& input_method_id, | 130 bool FindEngineEntry(const std::string& input_method_id, |
125 ComponentExtensionIME* out_extension, | 131 ComponentExtensionIME* out_extension, |
126 ComponentExtensionEngine* out_engine); | 132 ComponentExtensionEngine* out_engine); |
127 | 133 |
128 bool IsInLoginLayoutWhitelist(const std::vector<std::string>& layouts); | 134 bool IsInLoginLayoutWhitelist(const std::vector<std::string>& layouts); |
129 | 135 |
130 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate_; | 136 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate_; |
131 | 137 |
132 std::vector<ComponentExtensionIME> component_extension_imes_; | 138 std::vector<ComponentExtensionIME> component_extension_imes_; |
133 | 139 |
134 ObserverList<Observer> observers_; | 140 ObserverList<Observer> observers_; |
135 | 141 |
136 bool is_initialized_; | 142 bool is_initialized_; |
137 | 143 |
138 std::set<std::string> login_layout_set_; | 144 std::set<std::string> login_layout_set_; |
139 | 145 |
140 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager); | 146 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager); |
141 }; | 147 }; |
142 | 148 |
143 } // namespace chromeos | 149 } // namespace chromeos |
144 | 150 |
145 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ | 151 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ |
OLD | NEW |