Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: chromeos/ime/component_extension_ime_manager.h

Issue 190033005: [IME] Removes the duplicated IMEs in chrome://settings/languages, and support async component IMEs … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: try to make test green. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 OnImeComponentExtensionInitialized() = 0;
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 observers for the component extension IMEs are initialized.
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
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
144 bool was_initialization_notified_;
145
138 std::set<std::string> login_layout_set_; 146 std::set<std::string> login_layout_set_;
139 147
140 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager); 148 DISALLOW_COPY_AND_ASSIGN(ComponentExtensionIMEManager);
141 }; 149 };
142 150
143 } // namespace chromeos 151 } // namespace chromeos
144 152
145 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_ 153 #endif // CHROMEOS_IME_COMPONENT_EXTENSION_IME_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/input_method/background.js ('k') | chromeos/ime/component_extension_ime_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698