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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 ComponentExtensionIMEManager::~ComponentExtensionIMEManager() { | 84 ComponentExtensionIMEManager::~ComponentExtensionIMEManager() { |
85 } | 85 } |
86 | 86 |
87 void ComponentExtensionIMEManager::Initialize( | 87 void ComponentExtensionIMEManager::Initialize( |
88 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate) { | 88 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate) { |
89 delegate_ = delegate.Pass(); | 89 delegate_ = delegate.Pass(); |
90 component_extension_imes_ = delegate_->ListIME(); | 90 component_extension_imes_ = delegate_->ListIME(); |
91 } | 91 } |
92 | 92 |
93 bool ComponentExtensionIMEManager::LoadComponentExtensionIME( | 93 bool ComponentExtensionIMEManager::LoadComponentExtensionIME( |
| 94 Profile* profile, |
94 const std::string& input_method_id) { | 95 const std::string& input_method_id) { |
95 ComponentExtensionIME ime; | 96 ComponentExtensionIME ime; |
96 if (FindEngineEntry(input_method_id, &ime, NULL)) | 97 if (FindEngineEntry(input_method_id, &ime, NULL)) |
97 return delegate_->Load(ime.id, ime.manifest, ime.path); | 98 return delegate_->Load(profile, ime.id, ime.manifest, ime.path); |
98 else | 99 else |
99 return false; | 100 return false; |
100 } | 101 } |
101 | 102 |
102 bool ComponentExtensionIMEManager::UnloadComponentExtensionIME( | 103 bool ComponentExtensionIMEManager::UnloadComponentExtensionIME( |
| 104 Profile* profile, |
103 const std::string& input_method_id) { | 105 const std::string& input_method_id) { |
104 ComponentExtensionIME ime; | 106 ComponentExtensionIME ime; |
105 if (!FindEngineEntry(input_method_id, &ime, NULL)) | 107 if (!FindEngineEntry(input_method_id, &ime, NULL)) |
106 return false; | 108 return false; |
107 delegate_->Unload(ime.id, ime.path); | 109 delegate_->Unload(profile, ime.id, ime.path); |
108 return true; | 110 return true; |
109 } | 111 } |
110 | 112 |
111 bool ComponentExtensionIMEManager::IsWhitelisted( | 113 bool ComponentExtensionIMEManager::IsWhitelisted( |
112 const std::string& input_method_id) { | 114 const std::string& input_method_id) { |
113 return extension_ime_util::IsComponentExtensionIME(input_method_id) && | 115 return extension_ime_util::IsComponentExtensionIME(input_method_id) && |
114 FindEngineEntry(input_method_id, NULL, NULL); | 116 FindEngineEntry(input_method_id, NULL, NULL); |
115 } | 117 } |
116 | 118 |
117 bool ComponentExtensionIMEManager::IsWhitelistedExtension( | 119 bool ComponentExtensionIMEManager::IsWhitelistedExtension( |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 bool ComponentExtensionIMEManager::IsInLoginLayoutWhitelist( | 241 bool ComponentExtensionIMEManager::IsInLoginLayoutWhitelist( |
240 const std::vector<std::string>& layouts) { | 242 const std::vector<std::string>& layouts) { |
241 for (size_t i = 0; i < layouts.size(); ++i) { | 243 for (size_t i = 0; i < layouts.size(); ++i) { |
242 if (login_layout_set_.find(layouts[i]) != login_layout_set_.end()) | 244 if (login_layout_set_.find(layouts[i]) != login_layout_set_.end()) |
243 return true; | 245 return true; |
244 } | 246 } |
245 return false; | 247 return false; |
246 } | 248 } |
247 | 249 |
248 } // namespace chromeos | 250 } // namespace chromeos |
OLD | NEW |