Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_manager.h

Issue 12453011: Move InputMethodManager to chromeos/ime (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_H_
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/chromeos/input_method/input_method_config.h"
14 #include "chrome/browser/chromeos/input_method/input_method_descriptor.h"
15 #include "chrome/browser/chromeos/input_method/input_method_property.h"
16
17 namespace ui {
18 class Accelerator;
19 } // namespace ui
20
21 namespace chromeos {
22 class InputMethodEngine;
23 namespace input_method {
24
25 class InputMethodUtil;
26 class XKeyboard;
27
28 // This class manages input methodshandles. Classes can add themselves as
29 // observers. Clients can get an instance of this library class by:
30 // GetInputMethodManager().
31 class InputMethodManager {
32 public:
33 enum State {
34 STATE_LOGIN_SCREEN = 0,
35 STATE_BROWSER_SCREEN,
36 STATE_LOCK_SCREEN,
37 STATE_TERMINATING,
38 };
39
40 class Observer {
41 public:
42 virtual ~Observer() {}
43 // Called when the current input method is changed. |show_message|
44 // indicates whether the user should be notified of this change.
45 virtual void InputMethodChanged(InputMethodManager* manager,
46 bool show_message) = 0;
47 // Called when the list of properties is changed.
48 virtual void InputMethodPropertyChanged(InputMethodManager* manager) = 0;
49 };
50
51 // CandidateWindowObserver is notified of events related to the candidate
52 // window. The "suggestion window" used by IMEs such as ibus-mozc does not
53 // count as the candidate window (this may change if we later want suggestion
54 // window events as well). These events also won't occur when the virtual
55 // keyboard is used, since it controls its own candidate window.
56 class CandidateWindowObserver {
57 public:
58 virtual ~CandidateWindowObserver() {}
59 // Called when the candidate window is opened.
60 virtual void CandidateWindowOpened(InputMethodManager* manager) = 0;
61 // Called when the candidate window is closed.
62 virtual void CandidateWindowClosed(InputMethodManager* manager) = 0;
63 };
64
65 virtual ~InputMethodManager() {}
66
67 // Adds an observer to receive notifications of input method related
68 // changes as desribed in the Observer class above.
69 virtual void AddObserver(Observer* observer) = 0;
70 virtual void AddCandidateWindowObserver(
71 CandidateWindowObserver* observer) = 0;
72 virtual void RemoveObserver(Observer* observer) = 0;
73 virtual void RemoveCandidateWindowObserver(
74 CandidateWindowObserver* observer) = 0;
75
76 // Returns all input methods that are supported, including ones not active.
77 // This function never returns NULL. Note that input method extensions are NOT
78 // included in the result.
79 virtual scoped_ptr<InputMethodDescriptors>
80 GetSupportedInputMethods() const = 0;
81
82 // Returns the list of input methods we can select (i.e. active) including
83 // extension input methods.
84 virtual scoped_ptr<InputMethodDescriptors> GetActiveInputMethods() const = 0;
85
86 // Returns the number of active input methods including extension input
87 // methods.
88 virtual size_t GetNumActiveInputMethods() const = 0;
89
90 // Changes the current input method to |input_method_id|. If |input_method_id|
91 // is not active, switch to the first one in the active input method list.
92 virtual void ChangeInputMethod(const std::string& input_method_id) = 0;
93
94 // Enables keyboard layouts (e.g. US Qwerty, US Dvorak, French Azerty) that
95 // are necessary for the |language_code| and then switches to |initial_layout|
96 // if the string is not empty. For example, if |language_code| is "en-US", US
97 // Qwerty, US International, US Extended, US Dvorak, and US Colemak layouts
98 // would be enabled. Likewise, for Germany locale, US Qwerty which corresponds
99 // to the hardware keyboard layout and several keyboard layouts for Germany
100 // would be enabled.
101 // This method is for setting up i18n keyboard layouts for the login screen.
102 virtual void EnableLayouts(const std::string& language_code,
103 const std::string& initial_layout) = 0;
104
105 // Activates the input method property specified by the |key|.
106 virtual void ActivateInputMethodProperty(const std::string& key) = 0;
107
108 // Updates the list of active input method IDs, and then starts or stops the
109 // system input method framework as needed.
110 virtual bool EnableInputMethods(
111 const std::vector<std::string>& new_active_input_method_ids) = 0;
112
113 // Updates a configuration of a system input method engine with |value|.
114 // Returns true if the configuration is correctly set.
115 virtual bool SetInputMethodConfig(const std::string& section,
116 const std::string& config_name,
117 const InputMethodConfigValue& value) = 0;
118
119 // Adds an input method extension. This function does not takes ownership of
120 // |instance|.
121 virtual void AddInputMethodExtension(const std::string& id,
122 const std::string& name,
123 const std::vector<std::string>& layouts,
124 const std::string& language,
125 InputMethodEngine* instance) = 0;
126
127 // Removes an input method extension.
128 virtual void RemoveInputMethodExtension(const std::string& id) = 0;
129
130 // Returns a list of descriptors for all Input Method Extensions.
131 virtual void GetInputMethodExtensions(InputMethodDescriptors* result) = 0;
132
133 // Sets the list of extension IME ids which should not be enabled.
134 virtual void SetFilteredExtensionImes(std::vector<std::string>* ids) = 0;
135
136 // Gets the descriptor of the input method which is currently selected.
137 virtual InputMethodDescriptor GetCurrentInputMethod() const = 0;
138
139 // Gets the list of input method properties. The list could be empty().
140 virtual InputMethodPropertyList GetCurrentInputMethodProperties() const = 0;
141
142 // Returns an X keyboard object which could be used to change the current XKB
143 // layout, change the caps lock status, and set the auto repeat rate/interval.
144 virtual XKeyboard* GetXKeyboard() = 0;
145
146 // Returns an InputMethodUtil object.
147 virtual InputMethodUtil* GetInputMethodUtil() = 0;
148
149 // Switches the current input method (or keyboard layout) to the next one.
150 virtual bool SwitchToNextInputMethod() = 0;
151
152 // Switches the current input method (or keyboard layout) to the previous one.
153 virtual bool SwitchToPreviousInputMethod() = 0;
154
155 // Switches to an input method (or keyboard layout) which is associated with
156 // the |accelerator|.
157 virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) = 0;
158 };
159
160 } // namespace input_method
161 } // namespace chromeos
162
163 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698