| 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 UI_BASE_IME_CHROMEOS_COMPONENT_EXTENSION_IME_MANAGER_H_ | 5 #ifndef UI_BASE_IME_CHROMEOS_COMPONENT_EXTENSION_IME_MANAGER_H_ |
| 6 #define UI_BASE_IME_CHROMEOS_COMPONENT_EXTENSION_IME_MANAGER_H_ | 6 #define UI_BASE_IME_CHROMEOS_COMPONENT_EXTENSION_IME_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "ui/base/ime/chromeos/input_method_descriptor.h" | 14 #include "ui/base/ime/chromeos/input_method_descriptor.h" |
| 15 #include "ui/base/ime/ui_base_ime_export.h" | 15 #include "ui/base/ui_base_export.h" |
| 16 | 16 |
| 17 class Profile; | 17 class Profile; |
| 18 | 18 |
| 19 namespace chromeos { | 19 namespace chromeos { |
| 20 | 20 |
| 21 // Represents an engine in component extension IME. | 21 // Represents an engine in component extension IME. |
| 22 struct UI_BASE_IME_EXPORT ComponentExtensionEngine { | 22 struct UI_BASE_EXPORT ComponentExtensionEngine { |
| 23 ComponentExtensionEngine(); | 23 ComponentExtensionEngine(); |
| 24 ~ComponentExtensionEngine(); | 24 ~ComponentExtensionEngine(); |
| 25 std::string engine_id; // The engine id. | 25 std::string engine_id; // The engine id. |
| 26 std::string display_name; // The display name. | 26 std::string display_name; // The display name. |
| 27 std::string indicator; // The indicator text. | 27 std::string indicator; // The indicator text. |
| 28 std::vector<std::string> language_codes; // The engine's language(ex. "en"). | 28 std::vector<std::string> language_codes; // The engine's language(ex. "en"). |
| 29 std::string description; // The engine description. | 29 std::string description; // The engine description. |
| 30 std::vector<std::string> layouts; // The list of keyboard layout of engine. | 30 std::vector<std::string> layouts; // The list of keyboard layout of engine. |
| 31 GURL options_page_url; // an URL to option page. | 31 GURL options_page_url; // an URL to option page. |
| 32 GURL input_view_url; // an URL to input view page. | 32 GURL input_view_url; // an URL to input view page. |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // Represents a component extension IME. | 35 // Represents a component extension IME. |
| 36 struct UI_BASE_IME_EXPORT ComponentExtensionIME { | 36 struct UI_BASE_EXPORT ComponentExtensionIME { |
| 37 ComponentExtensionIME(); | 37 ComponentExtensionIME(); |
| 38 ~ComponentExtensionIME(); | 38 ~ComponentExtensionIME(); |
| 39 std::string id; // extension id. | 39 std::string id; // extension id. |
| 40 std::string manifest; // the contents of manifest.json | 40 std::string manifest; // the contents of manifest.json |
| 41 std::string description; // description of extension. | 41 std::string description; // description of extension. |
| 42 GURL options_page_url; // an URL to option page. | 42 GURL options_page_url; // an URL to option page. |
| 43 base::FilePath path; | 43 base::FilePath path; |
| 44 std::vector<ComponentExtensionEngine> engines; | 44 std::vector<ComponentExtensionEngine> engines; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // Provides an interface to list/load/unload for component extension IME. | 47 // Provides an interface to list/load/unload for component extension IME. |
| 48 class UI_BASE_IME_EXPORT ComponentExtensionIMEManagerDelegate { | 48 class UI_BASE_EXPORT ComponentExtensionIMEManagerDelegate { |
| 49 public: | 49 public: |
| 50 ComponentExtensionIMEManagerDelegate(); | 50 ComponentExtensionIMEManagerDelegate(); |
| 51 virtual ~ComponentExtensionIMEManagerDelegate(); | 51 virtual ~ComponentExtensionIMEManagerDelegate(); |
| 52 | 52 |
| 53 // Lists installed component extension IMEs. | 53 // Lists installed component extension IMEs. |
| 54 virtual std::vector<ComponentExtensionIME> ListIME() = 0; | 54 virtual std::vector<ComponentExtensionIME> ListIME() = 0; |
| 55 | 55 |
| 56 // Loads component extension IME associated with |extension_id|. | 56 // Loads component extension IME associated with |extension_id|. |
| 57 // Returns false if it fails, otherwise returns true. | 57 // Returns false if it fails, otherwise returns true. |
| 58 virtual void Load(Profile* profile, | 58 virtual void Load(Profile* profile, |
| 59 const std::string& extension_id, | 59 const std::string& extension_id, |
| 60 const std::string& manifest, | 60 const std::string& manifest, |
| 61 const base::FilePath& path) = 0; | 61 const base::FilePath& path) = 0; |
| 62 | 62 |
| 63 // Unloads component extension IME associated with |extension_id|. | 63 // Unloads component extension IME associated with |extension_id|. |
| 64 virtual void Unload(Profile* profile, | 64 virtual void Unload(Profile* profile, |
| 65 const std::string& extension_id, | 65 const std::string& extension_id, |
| 66 const base::FilePath& path) = 0; | 66 const base::FilePath& path) = 0; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 // This class manages component extension input method. | 69 // This class manages component extension input method. |
| 70 class UI_BASE_IME_EXPORT ComponentExtensionIMEManager { | 70 class UI_BASE_EXPORT ComponentExtensionIMEManager { |
| 71 public: | 71 public: |
| 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 // Loads |input_method_id| component extension IME. This function returns true | 80 // Loads |input_method_id| component extension IME. This function returns true |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 std::set<std::string> input_method_id_set_; | 122 std::set<std::string> input_method_id_set_; |
| 123 | 123 |
| 124 std::set<std::string> login_layout_set_; | 124 std::set<std::string> login_layout_set_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager); | 126 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace chromeos | 129 } // namespace chromeos |
| 130 | 130 |
| 131 #endif // UI_BASE_IME_CHROMEOS_COMPONENT_EXTENSION_IME_MANAGER_H_ | 131 #endif // UI_BASE_IME_CHROMEOS_COMPONENT_EXTENSION_IME_MANAGER_H_ |
| OLD | NEW |