Update parsing of dumpsys batterystats
[chromium-blink-merge.git] / ash / ime / input_method_menu_manager.h
blobffaeb480a89a6d972c14e7f941497283defb527d
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 "ash/ash_export.h"
7 #include "ash/ime/input_method_menu_item.h"
8 #include "base/observer_list.h"
10 #ifndef ASH_IME_INPUT_METHOD_MENU_MANAGER_H_
11 #define ASH_IME_INPUT_METHOD_MENU_MANAGER_H_
13 template<typename Type> struct DefaultSingletonTraits;
15 namespace ash {
16 namespace ime {
18 class ASH_EXPORT InputMethodMenuManager {
19 public:
20 class Observer {
21 public:
22 virtual ~Observer() {}
24 // Called when the list of menu items is changed.
25 virtual void InputMethodMenuItemChanged(
26 InputMethodMenuManager* manager) = 0;
29 ~InputMethodMenuManager();
31 void AddObserver(Observer* observer);
32 void RemoveObserver(Observer* observer);
34 // Obtains the singleton instance.
35 static InputMethodMenuManager* GetInstance();
37 // Sets the list of input method menu items. The list could be empty().
38 void SetCurrentInputMethodMenuItemList(
39 const InputMethodMenuItemList& menu_list);
41 // Gets the list of input method menu items. The list could be empty().
42 InputMethodMenuItemList GetCurrentInputMethodMenuItemList() const;
44 // True if the key exists in the menu_list_.
45 bool HasInputMethodMenuItemForKey(const std::string& key) const;
47 private:
48 InputMethodMenuManager();
50 // For Singleton to be able to construct an instance.
51 friend struct DefaultSingletonTraits<InputMethodMenuManager>;
53 // Menu item list of the input method. This is set by extension IMEs.
54 InputMethodMenuItemList menu_list_;
56 // Observers who will be notified when menu changes.
57 ObserverList<Observer> observers_;
59 DISALLOW_COPY_AND_ASSIGN(InputMethodMenuManager);
62 } // namespace ime
63 } // namespace ash
65 #endif // ASH_IME_INPUT_METHOD_MENU_MANAGER_H_