OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/input_method/ibus_controller_base.h" |
| 6 |
| 7 namespace chromeos { |
| 8 namespace input_method { |
| 9 |
| 10 IBusControllerBase::IBusControllerBase() { |
| 11 } |
| 12 |
| 13 IBusControllerBase::~IBusControllerBase() { |
| 14 } |
| 15 |
| 16 void IBusControllerBase::AddObserver(Observer* observer) { |
| 17 observers_.AddObserver(observer); |
| 18 } |
| 19 |
| 20 void IBusControllerBase::RemoveObserver(Observer* observer) { |
| 21 observers_.RemoveObserver(observer); |
| 22 } |
| 23 |
| 24 bool IBusControllerBase::SetInputMethodConfig( |
| 25 const std::string& section, |
| 26 const std::string& config_name, |
| 27 const InputMethodConfigValue& value) { |
| 28 DCHECK(!section.empty()); |
| 29 DCHECK(!config_name.empty()); |
| 30 |
| 31 const ConfigKeyType key(section, config_name); |
| 32 if (!SetInputMethodConfigInternal(key, value)) |
| 33 return false; |
| 34 current_config_values_[key] = value; |
| 35 return true; |
| 36 } |
| 37 |
| 38 const InputMethodPropertyList& |
| 39 IBusControllerBase::GetCurrentProperties() const { |
| 40 return current_property_list_; |
| 41 } |
| 42 |
| 43 bool IBusControllerBase::GetInputMethodConfigForTesting( |
| 44 const std::string& section, |
| 45 const std::string& config_name, |
| 46 InputMethodConfigValue* out_value) { |
| 47 DCHECK(out_value); |
| 48 const ConfigKeyType key(section, config_name); |
| 49 InputMethodConfigRequests::const_iterator iter = |
| 50 current_config_values_.find(key); |
| 51 if (iter == current_config_values_.end()) |
| 52 return false; |
| 53 *out_value = iter->second; |
| 54 return true; |
| 55 } |
| 56 |
| 57 void IBusControllerBase::NotifyPropertyChangedForTesting() { |
| 58 FOR_EACH_OBSERVER(Observer, observers_, PropertyChanged()); |
| 59 } |
| 60 |
| 61 void IBusControllerBase::SetCurrentPropertiesForTesting( |
| 62 const InputMethodPropertyList& current_property_list) { |
| 63 current_property_list_ = current_property_list; |
| 64 } |
| 65 |
| 66 } // namespace input_method |
| 67 } // namespace chromeos |
OLD | NEW |