| 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 "base/observer_list.h" | |
| 6 #include "ui/chromeos/ime/input_method_menu_item.h" | |
| 7 #include "ui/chromeos/ui_chromeos_export.h" | |
| 8 | |
| 9 #ifndef UI_CHROMEOS_IME_INPUT_METHOD_MENU_MANAGER_H_ | |
| 10 #define UI_CHROMEOS_IME_INPUT_METHOD_MENU_MANAGER_H_ | |
| 11 | |
| 12 template<typename Type> struct DefaultSingletonTraits; | |
| 13 | |
| 14 namespace ui { | |
| 15 namespace ime { | |
| 16 | |
| 17 class UI_CHROMEOS_EXPORT InputMethodMenuManager { | |
| 18 public: | |
| 19 class Observer { | |
| 20 public: | |
| 21 virtual ~Observer() {} | |
| 22 | |
| 23 // Called when the list of menu items is changed. | |
| 24 virtual void InputMethodMenuItemChanged( | |
| 25 InputMethodMenuManager* manager) = 0; | |
| 26 }; | |
| 27 | |
| 28 ~InputMethodMenuManager(); | |
| 29 | |
| 30 void AddObserver(Observer* observer); | |
| 31 void RemoveObserver(Observer* observer); | |
| 32 | |
| 33 // Obtains the singleton instance. | |
| 34 static InputMethodMenuManager* GetInstance(); | |
| 35 | |
| 36 // Sets the list of input method menu items. The list could be empty(). | |
| 37 void SetCurrentInputMethodMenuItemList( | |
| 38 const InputMethodMenuItemList& menu_list); | |
| 39 | |
| 40 // Gets the list of input method menu items. The list could be empty(). | |
| 41 InputMethodMenuItemList GetCurrentInputMethodMenuItemList() const; | |
| 42 | |
| 43 // True if the key exists in the menu_list_. | |
| 44 bool HasInputMethodMenuItemForKey(const std::string& key) const; | |
| 45 | |
| 46 private: | |
| 47 InputMethodMenuManager(); | |
| 48 | |
| 49 // For Singleton to be able to construct an instance. | |
| 50 friend struct DefaultSingletonTraits<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 ui | |
| 63 | |
| 64 #endif // UI_CHROMEOS_IME_INPUT_METHOD_MENU_MANAGER_H_ | |
| OLD | NEW |