Chromium Code Reviews| Index: chrome/browser/chromeos/input_method/ibus_controller_base.cc |
| diff --git a/chrome/browser/chromeos/input_method/ibus_controller_base.cc b/chrome/browser/chromeos/input_method/ibus_controller_base.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..39ed582c6d529c7c7a3b8f74cd166983445753ab |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/input_method/ibus_controller_base.cc |
| @@ -0,0 +1,65 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/chromeos/input_method/ibus_controller_base.h" |
| + |
| +namespace chromeos { |
| +namespace input_method { |
| + |
| +IBusControllerBase::IBusControllerBase() { |
| +} |
| + |
| +IBusControllerBase::~IBusControllerBase() { |
| +} |
| + |
| +void IBusControllerBase::AddObserver(Observer* observer) { |
| + observers_.AddObserver(observer); |
| +} |
| + |
| +void IBusControllerBase::RemoveObserver(Observer* observer) { |
| + observers_.RemoveObserver(observer); |
| +} |
| + |
| +bool IBusControllerBase::SetInputMethodConfig( |
| + const std::string& section, |
| + const std::string& config_name, |
| + const InputMethodConfigValue& value) { |
| + DCHECK(!section.empty()); |
| + DCHECK(!config_name.empty()); |
| + |
| + const ConfigKeyType key(section, config_name); |
| + current_config_values_[key] = value; |
| + return SetInputMethodConfigInternal(key, value); |
|
kinaba
2012/04/16 10:22:53
It seems more natural to me that current_config_va
Yusuke Sato
2012/04/16 11:25:43
Good point. Fixed.
|
| +} |
| + |
| +const InputMethodPropertyList& |
| +IBusControllerBase::GetCurrentProperties() const { |
| + return current_property_list_; |
| +} |
| + |
| +bool IBusControllerBase::GetInputMethodConfigForTesting( |
| + const std::string& section, |
| + const std::string& config_name, |
| + InputMethodConfigValue* out_value) { |
| + DCHECK(out_value); |
| + const ConfigKeyType key = std::make_pair(section, config_name); |
|
kinaba
2012/04/16 10:22:53
nit: key(section, config_name)
Yusuke Sato
2012/04/16 11:25:43
Done.
|
| + InputMethodConfigRequests::const_iterator iter |
| + = current_config_values_.find(key); |
|
Zachary Kuznia
2012/04/17 01:26:36
Nit: I think the = should be on the previous line.
Yusuke Sato
2012/04/17 02:23:32
Done.
|
| + if (iter == current_config_values_.end()) |
| + return false; |
| + *out_value = iter->second; |
| + return true; |
| +} |
| + |
| +void IBusControllerBase::NotifyPropertyChangedForTesting() { |
| + FOR_EACH_OBSERVER(Observer, observers_, PropertyChanged()); |
| +} |
| + |
| +void IBusControllerBase::SetCurrentPropertiesForTesting( |
| + const InputMethodPropertyList& current_property_list) { |
| + current_property_list_ = current_property_list; |
| +} |
| + |
| +} // namespace input_method |
| +} // namespace chromeos |