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 #include "chromeos/ime/component_extension_ime_manager.h" | 5 #include "chromeos/ime/component_extension_ime_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "chromeos/ime/extension_ime_util.h" | 9 #include "chromeos/ime/extension_ime_util.h" |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 const std::string input_method_id = | 98 const std::string input_method_id = |
99 extension_ime_util::GetComponentInputMethodID(ext.id, ime.engine_id); | 99 extension_ime_util::GetComponentInputMethodID(ext.id, ime.engine_id); |
100 if (extension_exists && !IsWhitelisted(input_method_id)) | 100 if (extension_exists && !IsWhitelisted(input_method_id)) |
101 component_extension_imes_[ext.id].engines.push_back(ime); | 101 component_extension_imes_[ext.id].engines.push_back(ime); |
102 input_method_id_set_.insert(input_method_id); | 102 input_method_id_set_.insert(input_method_id); |
103 } | 103 } |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 bool ComponentExtensionIMEManager::LoadComponentExtensionIME( | 107 bool ComponentExtensionIMEManager::LoadComponentExtensionIME( |
| 108 Profile* profile, |
108 const std::string& input_method_id) { | 109 const std::string& input_method_id) { |
109 ComponentExtensionIME ime; | 110 ComponentExtensionIME ime; |
110 if (FindEngineEntry(input_method_id, &ime)) | 111 if (FindEngineEntry(input_method_id, &ime)) |
111 return delegate_->Load(ime.id, ime.manifest, ime.path); | 112 return delegate_->Load(profile, ime.id, ime.manifest, ime.path); |
112 else | 113 else |
113 return false; | 114 return false; |
114 } | 115 } |
115 | 116 |
116 bool ComponentExtensionIMEManager::UnloadComponentExtensionIME( | 117 bool ComponentExtensionIMEManager::UnloadComponentExtensionIME( |
| 118 Profile* profile, |
117 const std::string& input_method_id) { | 119 const std::string& input_method_id) { |
118 ComponentExtensionIME ime; | 120 ComponentExtensionIME ime; |
119 if (!FindEngineEntry(input_method_id, &ime)) | 121 if (!FindEngineEntry(input_method_id, &ime)) |
120 return false; | 122 return false; |
121 delegate_->Unload(ime.id, ime.path); | 123 delegate_->Unload(profile, ime.id, ime.path); |
122 return true; | 124 return true; |
123 } | 125 } |
124 | 126 |
125 bool ComponentExtensionIMEManager::IsWhitelisted( | 127 bool ComponentExtensionIMEManager::IsWhitelisted( |
126 const std::string& input_method_id) { | 128 const std::string& input_method_id) { |
127 return input_method_id_set_.find(input_method_id) != | 129 return input_method_id_set_.find(input_method_id) != |
128 input_method_id_set_.end(); | 130 input_method_id_set_.end(); |
129 } | 131 } |
130 | 132 |
131 bool ComponentExtensionIMEManager::IsWhitelistedExtension( | 133 bool ComponentExtensionIMEManager::IsWhitelistedExtension( |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 bool ComponentExtensionIMEManager::IsInLoginLayoutWhitelist( | 199 bool ComponentExtensionIMEManager::IsInLoginLayoutWhitelist( |
198 const std::vector<std::string>& layouts) { | 200 const std::vector<std::string>& layouts) { |
199 for (size_t i = 0; i < layouts.size(); ++i) { | 201 for (size_t i = 0; i < layouts.size(); ++i) { |
200 if (login_layout_set_.find(layouts[i]) != login_layout_set_.end()) | 202 if (login_layout_set_.find(layouts[i]) != login_layout_set_.end()) |
201 return true; | 203 return true; |
202 } | 204 } |
203 return false; | 205 return false; |
204 } | 206 } |
205 | 207 |
206 } // namespace chromeos | 208 } // namespace chromeos |
OLD | NEW |