Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / chromeos / ime / input_method_menu_manager.h
blobc1de537813a88240f9cac4680f0766319838490c
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_
12 template<typename Type> struct DefaultSingletonTraits;
14 namespace ui {
15 namespace ime {
17 class UI_CHROMEOS_EXPORT InputMethodMenuManager {
18 public:
19 class Observer {
20 public:
21 virtual ~Observer() {}
23 // Called when the list of menu items is changed.
24 virtual void InputMethodMenuItemChanged(
25 InputMethodMenuManager* manager) = 0;
28 ~InputMethodMenuManager();
30 void AddObserver(Observer* observer);
31 void RemoveObserver(Observer* observer);
33 // Obtains the singleton instance.
34 static InputMethodMenuManager* GetInstance();
36 // Sets the list of input method menu items. The list could be empty().
37 void SetCurrentInputMethodMenuItemList(
38 const InputMethodMenuItemList& menu_list);
40 // Gets the list of input method menu items. The list could be empty().
41 InputMethodMenuItemList GetCurrentInputMethodMenuItemList() const;
43 // True if the key exists in the menu_list_.
44 bool HasInputMethodMenuItemForKey(const std::string& key) const;
46 private:
47 InputMethodMenuManager();
49 // For Singleton to be able to construct an instance.
50 friend struct DefaultSingletonTraits<InputMethodMenuManager>;
52 // Menu item list of the input method. This is set by extension IMEs.
53 InputMethodMenuItemList menu_list_;
55 // Observers who will be notified when menu changes.
56 ObserverList<Observer> observers_;
58 DISALLOW_COPY_AND_ASSIGN(InputMethodMenuManager);
61 } // namespace ime
62 } // namespace ui
64 #endif // UI_CHROMEOS_IME_INPUT_METHOD_MENU_MANAGER_H_