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 "base/observer_list.h"
6 #include "ui/chromeos/ime/input_method_menu_item.h"
7 #include "ui/chromeos/ui_chromeos_export.h"
9 #ifndef UI_CHROMEOS_IME_INPUT_METHOD_MENU_MANAGER_H_
10 #define UI_CHROMEOS_IME_INPUT_METHOD_MENU_MANAGER_H_
13 template <typename Type
>
14 struct DefaultSingletonTraits
;
20 class UI_CHROMEOS_EXPORT InputMethodMenuManager
{
24 virtual ~Observer() {}
26 // Called when the list of menu items is changed.
27 virtual void InputMethodMenuItemChanged(
28 InputMethodMenuManager
* manager
) = 0;
31 ~InputMethodMenuManager();
33 void AddObserver(Observer
* observer
);
34 void RemoveObserver(Observer
* observer
);
36 // Obtains the singleton instance.
37 static InputMethodMenuManager
* GetInstance();
39 // Sets the list of input method menu items. The list could be empty().
40 void SetCurrentInputMethodMenuItemList(
41 const InputMethodMenuItemList
& menu_list
);
43 // Gets the list of input method menu items. The list could be empty().
44 InputMethodMenuItemList
GetCurrentInputMethodMenuItemList() const;
46 // True if the key exists in the menu_list_.
47 bool HasInputMethodMenuItemForKey(const std::string
& key
) const;
50 InputMethodMenuManager();
52 // For Singleton to be able to construct an instance.
53 friend struct base::DefaultSingletonTraits
<InputMethodMenuManager
>;
55 // Menu item list of the input method. This is set by extension IMEs.
56 InputMethodMenuItemList menu_list_
;
58 // Observers who will be notified when menu changes.
59 base::ObserverList
<Observer
> observers_
;
61 DISALLOW_COPY_AND_ASSIGN(InputMethodMenuManager
);
67 #endif // UI_CHROMEOS_IME_INPUT_METHOD_MENU_MANAGER_H_