| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "chrome/browser/chromeos/input_method/ibus_controller_base.h" | 11 #include "base/observer_list.h" |
| 12 #include "chrome/browser/chromeos/input_method/ibus_controller.h" |
| 12 #include "chromeos/ime/ibus_bridge.h" | 13 #include "chromeos/ime/ibus_bridge.h" |
| 14 #include "chromeos/ime/input_method_property.h" |
| 13 | 15 |
| 14 namespace chromeos { | 16 namespace chromeos { |
| 15 namespace input_method { | 17 namespace input_method { |
| 16 | 18 |
| 17 struct InputMethodProperty; | 19 struct InputMethodProperty; |
| 18 typedef std::vector<InputMethodProperty> InputMethodPropertyList; | 20 typedef std::vector<InputMethodProperty> InputMethodPropertyList; |
| 19 | 21 |
| 20 // The IBusController implementation. | 22 // The IBusController implementation. |
| 21 // TODO(nona): Merge to IBusControllerBase, there is no longer reason to split | 23 class IBusControllerImpl : public IBusController, |
| 22 // this class into Impl and Base. | |
| 23 class IBusControllerImpl : public IBusControllerBase, | |
| 24 public IBusPanelPropertyHandlerInterface { | 24 public IBusPanelPropertyHandlerInterface { |
| 25 public: | 25 public: |
| 26 IBusControllerImpl(); | 26 IBusControllerImpl(); |
| 27 virtual ~IBusControllerImpl(); | 27 virtual ~IBusControllerImpl(); |
| 28 | 28 |
| 29 // IBusController overrides: | 29 // IBusController overrides: |
| 30 virtual bool ActivateInputMethodProperty(const std::string& key) OVERRIDE; | 30 virtual bool ActivateInputMethodProperty(const std::string& key) OVERRIDE; |
| 31 | 31 |
| 32 // IBusController overrides. Derived classes should not override these 4 |
| 33 // functions. |
| 34 virtual void AddObserver(Observer* observer) OVERRIDE; |
| 35 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
| 36 virtual const InputMethodPropertyList& GetCurrentProperties() const OVERRIDE; |
| 37 virtual void ClearProperties() OVERRIDE; |
| 38 |
| 32 // Calls <anonymous_namespace>::FindAndUpdateProperty. This method is just for | 39 // Calls <anonymous_namespace>::FindAndUpdateProperty. This method is just for |
| 33 // unit testing. | 40 // unit testing. |
| 34 static bool FindAndUpdatePropertyForTesting( | 41 static bool FindAndUpdatePropertyForTesting( |
| 35 const InputMethodProperty& new_prop, | 42 const InputMethodProperty& new_prop, |
| 36 InputMethodPropertyList* prop_list); | 43 InputMethodPropertyList* prop_list); |
| 37 | 44 |
| 45 protected: |
| 46 ObserverList<Observer> observers_; |
| 47 |
| 48 // The value which will be returned by GetCurrentProperties(). Derived classes |
| 49 // should update this variable when needed. |
| 50 InputMethodPropertyList current_property_list_; |
| 51 |
| 38 private: | 52 private: |
| 39 // IBusPanelPropertyHandlerInterface overrides: | 53 // IBusPanelPropertyHandlerInterface overrides: |
| 40 virtual void RegisterProperties( | 54 virtual void RegisterProperties( |
| 41 const IBusPropertyList& properties) OVERRIDE; | 55 const IBusPropertyList& properties) OVERRIDE; |
| 42 virtual void UpdateProperty(const IBusProperty& property) OVERRIDE; | 56 virtual void UpdateProperty(const IBusProperty& property) OVERRIDE; |
| 43 | 57 |
| 44 DISALLOW_COPY_AND_ASSIGN(IBusControllerImpl); | 58 DISALLOW_COPY_AND_ASSIGN(IBusControllerImpl); |
| 45 }; | 59 }; |
| 46 | 60 |
| 47 } // namespace input_method | 61 } // namespace input_method |
| 48 } // namespace chromeos | 62 } // namespace chromeos |
| 49 | 63 |
| 50 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_ | 64 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_IMPL_H_ |
| OLD | NEW |