OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "ash/ash_export.h" | |
6 | |
7 #include "ash/ime/input_method_menu_item.h" | |
8 #include "base/observer_list.h" | |
9 | |
10 #ifndef ASH_IME_INPUT_METHOD_MENU_MANAGER_H_ | |
11 #define ASH_IME_INPUT_METHOD_MENU_MANAGER_H_ | |
12 | |
13 namespace ash { | |
14 namespace ime { | |
15 | |
16 class ASH_EXPORT InputMethodMenuManager { | |
17 public: | |
18 class Observer { | |
19 public: | |
20 virtual ~Observer() {} | |
21 | |
22 // Called when the list of menu items is changed. | |
23 virtual void InputMethodMenuItemChanged( | |
24 InputMethodMenuManager* manager) = 0; | |
25 }; | |
26 | |
27 ~InputMethodMenuManager(); | |
28 | |
29 void AddObserver(Observer* observer); | |
30 void RemoveObserver(Observer* observer); | |
31 | |
32 static InputMethodMenuManager* Get(); | |
33 | |
34 // Create the global instance. | |
35 static void Initialize(); | |
36 // Destroy the global instance. | |
37 static void Shutdown(); | |
38 | |
39 // Sets the list of input method menu items. The list could be empty(). | |
40 void SetCurrentInputMethodMenuItemList( | |
41 const InputMethodMenuItemList& menu_list); | |
42 | |
43 // Gets the list of input method menu items. The list could be empty(). | |
44 InputMethodMenuItemList GetCurrentInputMethodMenuItemList() const; | |
45 | |
46 // True if the key exists in the menu_list_. | |
47 bool HasInputMethodMenuItemForKey(const std::string& key) const; | |
48 | |
49 private: | |
50 InputMethodMenuManager(); | |
51 | |
52 // Menu item list of the input method. This is set by extension IMEs. | |
53 InputMethodMenuItemList menu_list_; | |
54 | |
55 // Observers who will be notified when menu changes. | |
56 ObserverList<Observer> observers_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(InputMethodMenuManager); | |
59 }; | |
60 | |
61 } // namespace ime | |
62 } // namespace ash | |
63 | |
64 #endif // ASH_IME_INPUT_METHOD_MENU_MANAGER_H_ | |
OLD | NEW |