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

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

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

Powered by Google App Engine
This is Rietveld 408576698