1 // Copyright 2014 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.
5 #include "ui/chromeos/ime/input_method_menu_manager.h"
7 #include "base/logging.h"
8 #include "base/memory/singleton.h"
13 InputMethodMenuManager::InputMethodMenuManager()
14 : menu_list_(), observers_() {}
16 InputMethodMenuManager::~InputMethodMenuManager() {}
18 void InputMethodMenuManager::AddObserver(
19 InputMethodMenuManager::Observer
* observer
) {
20 observers_
.AddObserver(observer
);
23 void InputMethodMenuManager::RemoveObserver(
24 InputMethodMenuManager::Observer
* observer
) {
25 observers_
.RemoveObserver(observer
);
28 InputMethodMenuItemList
29 InputMethodMenuManager::GetCurrentInputMethodMenuItemList() const {
33 void InputMethodMenuManager::SetCurrentInputMethodMenuItemList(
34 const InputMethodMenuItemList
& menu_list
) {
35 menu_list_
= menu_list
;
36 FOR_EACH_OBSERVER(InputMethodMenuManager::Observer
,
38 InputMethodMenuItemChanged(this));
41 bool InputMethodMenuManager::HasInputMethodMenuItemForKey(
42 const std::string
& key
) const {
43 for (size_t i
= 0; i
< menu_list_
.size(); ++i
) {
44 if (menu_list_
[i
].key
== key
) {
52 InputMethodMenuManager
* InputMethodMenuManager::GetInstance() {
53 return Singleton
<InputMethodMenuManager
>::get();