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 "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
12 #include "chromeos/dbus/ibus/ibus_component.h" | |
13 #include "chromeos/ime/input_method_descriptor.h" | 12 #include "chromeos/ime/input_method_descriptor.h" |
14 | 13 |
15 namespace chromeos { | 14 namespace chromeos { |
16 | 15 |
| 16 // Represents an engine in component extension IME. |
| 17 struct CHROMEOS_EXPORT ComponentExtensionEngine { |
| 18 ComponentExtensionEngine(); |
| 19 ~ComponentExtensionEngine(); |
| 20 std::string engine_id; // The engine id. |
| 21 std::string display_name; // The display name. |
| 22 std::string language_code; // The engine's language(ex. "en"). |
| 23 std::string description; // The engine description. |
| 24 std::vector<std::string> layouts; // The list of keyboard layout of engine. |
| 25 }; |
| 26 |
17 // Represents a component extension IME. | 27 // Represents a component extension IME. |
18 // TODO(nona): Use GURL for |option_page_url| instead of string. | 28 // TODO(nona): Use GURL for |option_page_url| instead of string. |
19 struct CHROMEOS_EXPORT ComponentExtensionIME { | 29 struct CHROMEOS_EXPORT ComponentExtensionIME { |
20 ComponentExtensionIME(); | 30 ComponentExtensionIME(); |
21 ~ComponentExtensionIME(); | 31 ~ComponentExtensionIME(); |
22 std::string id; // extension id. | 32 std::string id; // extension id. |
23 std::string manifest; // the contents of manifest.json | 33 std::string manifest; // the contents of manifest.json |
24 std::string description; // description of extension. | 34 std::string description; // description of extension. |
25 std::string options_page_url; // We can't use GURL due to deps restriction. | 35 std::string options_page_url; // We can't use GURL due to deps restriction. |
26 base::FilePath path; | 36 base::FilePath path; |
27 std::vector<IBusComponent::EngineDescription> engines; | 37 std::vector<ComponentExtensionEngine> engines; |
28 }; | 38 }; |
29 | 39 |
30 // Provides an interface to list/load/unload for component extension IME. | 40 // Provides an interface to list/load/unload for component extension IME. |
31 class CHROMEOS_EXPORT ComponentExtensionIMEManagerDelegate { | 41 class CHROMEOS_EXPORT ComponentExtensionIMEManagerDelegate { |
32 public: | 42 public: |
33 ComponentExtensionIMEManagerDelegate(); | 43 ComponentExtensionIMEManagerDelegate(); |
34 virtual ~ComponentExtensionIMEManagerDelegate(); | 44 virtual ~ComponentExtensionIMEManagerDelegate(); |
35 | 45 |
36 // Lists installed component extension IMEs. | 46 // Lists installed component extension IMEs. |
37 virtual std::vector<ComponentExtensionIME> ListIME() = 0; | 47 virtual std::vector<ComponentExtensionIME> ListIME() = 0; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // for protected for unit testing. | 128 // for protected for unit testing. |
119 static std::string GetComponentExtensionIMEId(const std::string& extension_id, | 129 static std::string GetComponentExtensionIMEId(const std::string& extension_id, |
120 const std::string& engine_id); | 130 const std::string& engine_id); |
121 | 131 |
122 private: | 132 private: |
123 // Finds ComponentExtensionIME and EngineDescription associated with | 133 // Finds ComponentExtensionIME and EngineDescription associated with |
124 // |input_method_id|. This function retruns true if it is found, otherwise | 134 // |input_method_id|. This function retruns true if it is found, otherwise |
125 // returns false. |out_extension| and |out_engine| can be NULL. | 135 // returns false. |out_extension| and |out_engine| can be NULL. |
126 bool FindEngineEntry(const std::string& input_method_id, | 136 bool FindEngineEntry(const std::string& input_method_id, |
127 ComponentExtensionIME* out_extension, | 137 ComponentExtensionIME* out_extension, |
128 IBusComponent::EngineDescription* out_engine); | 138 ComponentExtensionEngine* out_engine); |
129 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate_; | 139 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate_; |
130 | 140 |
131 std::vector<ComponentExtensionIME> component_extension_imes_; | 141 std::vector<ComponentExtensionIME> component_extension_imes_; |
132 | 142 |
133 ObserverList<Observer> observers_; | 143 ObserverList<Observer> observers_; |
134 | 144 |
135 bool is_initialized_; | 145 bool is_initialized_; |
136 | 146 |
137 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager); | 147 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager); |
138 }; | 148 }; |
139 | 149 |
140 } // namespace chromeos | 150 } // namespace chromeos |
141 | 151 |
142 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ | 152 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ |
OLD | NEW |