| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/input_method/ibus_controller_impl.h" | 5 #include "chrome/browser/chromeos/input_method/ibus_controller_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> // for std::reverse. | 7 #include <algorithm> // for std::reverse. |
| 8 #include <cstdio> | 8 #include <cstdio> |
| 9 #include <cstring> // for std::strcmp. | 9 #include <cstring> // for std::strcmp. |
| 10 #include <set> | 10 #include <set> |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 return false; | 205 return false; |
| 206 } | 206 } |
| 207 | 207 |
| 208 IBusEngineHandlerInterface* engine = IBusBridge::Get()->GetEngineHandler(); | 208 IBusEngineHandlerInterface* engine = IBusBridge::Get()->GetEngineHandler(); |
| 209 if (engine) | 209 if (engine) |
| 210 engine->PropertyActivate(key, | 210 engine->PropertyActivate(key, |
| 211 static_cast<ibus::IBusPropertyState>(is_radio)); | 211 static_cast<ibus::IBusPropertyState>(is_radio)); |
| 212 return true; | 212 return true; |
| 213 } | 213 } |
| 214 | 214 |
| 215 void IBusControllerImpl::AddObserver(Observer* observer) { |
| 216 observers_.AddObserver(observer); |
| 217 } |
| 218 |
| 219 void IBusControllerImpl::RemoveObserver(Observer* observer) { |
| 220 observers_.RemoveObserver(observer); |
| 221 } |
| 222 |
| 223 const InputMethodPropertyList& |
| 224 IBusControllerImpl::GetCurrentProperties() const { |
| 225 return current_property_list_; |
| 226 } |
| 227 |
| 228 void IBusControllerImpl::ClearProperties() { |
| 229 current_property_list_.clear(); |
| 230 } |
| 231 |
| 215 void IBusControllerImpl::RegisterProperties( | 232 void IBusControllerImpl::RegisterProperties( |
| 216 const IBusPropertyList& ibus_prop_list) { | 233 const IBusPropertyList& ibus_prop_list) { |
| 217 current_property_list_.clear(); | 234 current_property_list_.clear(); |
| 218 if (!FlattenPropertyList(ibus_prop_list, ¤t_property_list_)) | 235 if (!FlattenPropertyList(ibus_prop_list, ¤t_property_list_)) |
| 219 current_property_list_.clear(); // Clear properties on errors. | 236 current_property_list_.clear(); // Clear properties on errors. |
| 220 FOR_EACH_OBSERVER(IBusController::Observer, observers_, PropertyChanged()); | 237 FOR_EACH_OBSERVER(IBusController::Observer, observers_, PropertyChanged()); |
| 221 } | 238 } |
| 222 | 239 |
| 223 void IBusControllerImpl::UpdateProperty(const IBusProperty& ibus_prop) { | 240 void IBusControllerImpl::UpdateProperty(const IBusProperty& ibus_prop) { |
| 224 InputMethodPropertyList prop_list; // our representation. | 241 InputMethodPropertyList prop_list; // our representation. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 239 | 256 |
| 240 // static | 257 // static |
| 241 bool IBusControllerImpl::FindAndUpdatePropertyForTesting( | 258 bool IBusControllerImpl::FindAndUpdatePropertyForTesting( |
| 242 const chromeos::input_method::InputMethodProperty& new_prop, | 259 const chromeos::input_method::InputMethodProperty& new_prop, |
| 243 chromeos::input_method::InputMethodPropertyList* prop_list) { | 260 chromeos::input_method::InputMethodPropertyList* prop_list) { |
| 244 return FindAndUpdateProperty(new_prop, prop_list); | 261 return FindAndUpdateProperty(new_prop, prop_list); |
| 245 } | 262 } |
| 246 | 263 |
| 247 } // namespace input_method | 264 } // namespace input_method |
| 248 } // namespace chromeos | 265 } // namespace chromeos |
| OLD | NEW |