| 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 "chromeos/chromeos_export.h" |
| 10 #include "chromeos/dbus/ibus/ibus_component.h" | 11 #include "chromeos/dbus/ibus/ibus_component.h" |
| 11 | 12 |
| 12 namespace chromeos { | 13 namespace chromeos { |
| 13 | 14 |
| 14 // Represents a component extension IME. | 15 // Represents a component extension IME. |
| 15 struct ComponentExtensionIME { | 16 struct CHROMEOS_EXPORT ComponentExtensionIME { |
| 16 ComponentExtensionIME(); | 17 ComponentExtensionIME(); |
| 17 ~ComponentExtensionIME(); | 18 ~ComponentExtensionIME(); |
| 18 std::string id; // extension id. | 19 std::string id; // extension id. |
| 19 std::string description; // description of extension. | 20 std::string description; // description of extension. |
| 20 base::FilePath path; | 21 base::FilePath path; |
| 21 std::vector<IBusComponent::EngineDescription> engines; | 22 std::vector<IBusComponent::EngineDescription> engines; |
| 22 }; | 23 }; |
| 23 | 24 |
| 24 // Provides an interface to list/load/unload for component extension IME. | 25 // Provides an interface to list/load/unload for component extension IME. |
| 25 class ComponentExtentionIMEManagerDelegate { | 26 class CHROMEOS_EXPORT ComponentExtentionIMEManagerDelegate { |
| 26 public: | 27 public: |
| 27 ComponentExtentionIMEManagerDelegate(); | 28 ComponentExtentionIMEManagerDelegate(); |
| 28 virtual ~ComponentExtentionIMEManagerDelegate(); | 29 virtual ~ComponentExtentionIMEManagerDelegate(); |
| 29 | 30 |
| 30 // Lists installed component extension IMEs. | 31 // Lists installed component extension IMEs. |
| 31 virtual std::vector<ComponentExtensionIME> ListIME() = 0; | 32 virtual std::vector<ComponentExtensionIME> ListIME() = 0; |
| 32 | 33 |
| 33 // Loads component extension IME associated with |extension_id|. | 34 // Loads component extension IME associated with |extension_id|. |
| 34 // Returns false if it fails, otherwise returns true. | 35 // Returns false if it fails, otherwise returns true. |
| 35 virtual bool Load(const std::string& extension_id, | 36 virtual bool Load(const std::string& extension_id, |
| 36 const base::FilePath& path) = 0; | 37 const base::FilePath& path) = 0; |
| 37 | 38 |
| 38 // Unloads component extension IME associated with |extension_id|. | 39 // Unloads component extension IME associated with |extension_id|. |
| 39 // Returns false if it fails, otherwise returns true; | 40 // Returns false if it fails, otherwise returns true; |
| 40 virtual bool Unload(const std::string& extension_id, | 41 virtual bool Unload(const std::string& extension_id, |
| 41 const base::FilePath& path) = 0; | 42 const base::FilePath& path) = 0; |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 // This class manages component extension input method. | 45 // This class manages component extension input method. |
| 45 class ComponentExtentionIMEManager { | 46 class CHROMEOS_EXPORT ComponentExtentionIMEManager { |
| 46 public: | 47 public: |
| 47 // This class takes the ownership of |delegate|. | 48 // This class takes the ownership of |delegate|. |
| 48 explicit ComponentExtentionIMEManager( | 49 explicit ComponentExtentionIMEManager( |
| 49 ComponentExtentionIMEManagerDelegate* delegate); | 50 ComponentExtentionIMEManagerDelegate* delegate); |
| 50 virtual ~ComponentExtentionIMEManager(); | 51 virtual ~ComponentExtentionIMEManager(); |
| 51 | 52 |
| 52 // Initializes component extension manager. This function create internal | 53 // Initializes component extension manager. This function create internal |
| 53 // mapping between input method id and engine components. This function must | 54 // mapping between input method id and engine components. This function must |
| 54 // be called before using any other function. | 55 // be called before using any other function. |
| 55 void Initialize(); | 56 void Initialize(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 78 | 79 |
| 79 private: | 80 private: |
| 80 scoped_ptr<ComponentExtentionIMEManagerDelegate> delegate_; | 81 scoped_ptr<ComponentExtentionIMEManagerDelegate> delegate_; |
| 81 | 82 |
| 82 DISALLOW_COPY_AND_ASSIGN(ComponentExtentionIMEManager); | 83 DISALLOW_COPY_AND_ASSIGN(ComponentExtentionIMEManager); |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 } // namespace chromeos | 86 } // namespace chromeos |
| 86 | 87 |
| 87 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ | 88 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ |
| OLD | NEW |