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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_H_
13 namespace input_method
{
15 struct InputMethodConfigValue
;
16 struct InputMethodProperty
;
17 typedef std::vector
<InputMethodProperty
> InputMethodPropertyList
;
19 // IBusController is used to interact with the system input method framework
20 // (which is currently IBus).
21 class IBusController
{
25 virtual ~Observer() {}
26 virtual void PropertyChanged() = 0;
27 virtual void OnConnected() = 0;
28 virtual void OnDisconnected() = 0;
29 // TODO(yusukes): Add functions for IPC error handling.
32 // Creates an instance of the class.
33 static IBusController
* Create();
35 virtual ~IBusController();
37 virtual void AddObserver(Observer
* observer
) = 0;
38 virtual void RemoveObserver(Observer
* observer
) = 0;
40 // Starts the system input method framework. No-op if it's already started.
41 virtual bool Start() = 0;
43 // Resets the system input method framework. A composition text is discarded,
44 // and a candidate window is closed.
45 virtual void Reset() = 0;
47 // Stops the system input method framework.
48 virtual bool Stop() = 0;
50 // Sets a configuration of an input method engine. Returns true if the
51 // configuration is successfully set. For example, when you set
52 // "engine/Mozc/history_learning_level", |section| should be "engine/Mozc",
53 // and |config_name| should be "history_learning_level".
54 virtual bool SetInputMethodConfig(const std::string
& section
,
55 const std::string
& config_name
,
56 const InputMethodConfigValue
& value
) = 0;
58 // Changes the current input method engine to |id|. Returns true on success.
59 // Example IDs: "mozc", "m17n:ar:kbd".
60 virtual bool ChangeInputMethod(const std::string
& id
) = 0;
62 // Activates the input method property specified by the |key|. Returns true on
64 virtual bool ActivateInputMethodProperty(const std::string
& key
) = 0;
66 // Gets the latest input method property send from the system input method
68 virtual const InputMethodPropertyList
& GetCurrentProperties() const = 0;
71 } // namespace input_method
72 } // namespace chromeos
74 // TODO(yusukes,nona): This interface does not depend on IBus actually.
75 // Rename the file if needed.
77 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_H_