Chromium Code Reviews| 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 CHROMEOS_IME_INPUT_METHOD_MANAGER_H_ | 5 #ifndef CHROMEOS_IME_INPUT_METHOD_MANAGER_H_ |
| 6 #define CHROMEOS_IME_INPUT_METHOD_MANAGER_H_ | 6 #define CHROMEOS_IME_INPUT_METHOD_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
| 14 #include "chromeos/ime/input_method_descriptor.h" | 15 #include "chromeos/ime/input_method_descriptor.h" |
| 15 | 16 |
| 16 namespace ui { | 17 namespace ui { |
| 17 class Accelerator; | 18 class Accelerator; |
| 18 } // namespace ui | 19 } // namespace ui |
| 19 | 20 |
| 20 namespace chromeos { | 21 namespace chromeos { |
| 21 class ComponentExtensionIMEManager; | 22 class ComponentExtensionIMEManager; |
| 22 class InputMethodEngineInterface; | 23 class InputMethodEngineInterface; |
| 23 namespace input_method { | 24 namespace input_method { |
| 24 class InputMethodUtil; | 25 class InputMethodUtil; |
| 25 class ImeKeyboard; | 26 class ImeKeyboard; |
| 26 | 27 |
| 27 // This class manages input methodshandles. Classes can add themselves as | 28 // This class manages input methodshandles. Classes can add themselves as |
| 28 // observers. Clients can get an instance of this library class by: | 29 // observers. Clients can get an instance of this library class by: |
| 29 // InputMethodManager::Get(). | 30 // InputMethodManager::Get(). |
| 30 class CHROMEOS_EXPORT InputMethodManager { | 31 class CHROMEOS_EXPORT InputMethodManager { |
| 31 public: | 32 public: |
| 32 enum State { | 33 enum UIState { |
|
Shu Chen
2014/08/04 14:55:24
Maybe better to name it as "UISession" or "UIScree
Alexander Alekseev
2014/08/06 23:39:45
I've renamed it to UISessionState, because set met
| |
| 33 STATE_LOGIN_SCREEN = 0, | 34 STATE_LOGIN_SCREEN = 0, |
| 34 STATE_BROWSER_SCREEN, | 35 STATE_BROWSER_SCREEN, |
| 35 STATE_LOCK_SCREEN, | 36 STATE_LOCK_SCREEN, |
| 36 STATE_TERMINATING, | 37 STATE_TERMINATING, |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 class Observer { | 40 class Observer { |
| 40 public: | 41 public: |
| 41 virtual ~Observer() {} | 42 virtual ~Observer() {} |
| 42 // Called when the current input method is changed. |show_message| | 43 // Called when the current input method is changed. |show_message| |
| 43 // indicates whether the user should be notified of this change. | 44 // indicates whether the user should be notified of this change. |
| 44 virtual void InputMethodChanged(InputMethodManager* manager, | 45 virtual void InputMethodChanged(InputMethodManager* manager, |
| 45 bool show_message) = 0; | 46 bool show_message) = 0; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 // CandidateWindowObserver is notified of events related to the candidate | 49 // CandidateWindowObserver is notified of events related to the candidate |
| 49 // window. The "suggestion window" used by IMEs such as ibus-mozc does not | 50 // window. The "suggestion window" used by IMEs such as ibus-mozc does not |
| 50 // count as the candidate window (this may change if we later want suggestion | 51 // count as the candidate window (this may change if we later want suggestion |
| 51 // window events as well). These events also won't occur when the virtual | 52 // window events as well). These events also won't occur when the virtual |
| 52 // keyboard is used, since it controls its own candidate window. | 53 // keyboard is used, since it controls its own candidate window. |
| 53 class CandidateWindowObserver { | 54 class CandidateWindowObserver { |
| 54 public: | 55 public: |
| 55 virtual ~CandidateWindowObserver() {} | 56 virtual ~CandidateWindowObserver() {} |
| 56 // Called when the candidate window is opened. | 57 // Called when the candidate window is opened. |
| 57 virtual void CandidateWindowOpened(InputMethodManager* manager) = 0; | 58 virtual void CandidateWindowOpened(InputMethodManager* manager) = 0; |
| 58 // Called when the candidate window is closed. | 59 // Called when the candidate window is closed. |
| 59 virtual void CandidateWindowClosed(InputMethodManager* manager) = 0; | 60 virtual void CandidateWindowClosed(InputMethodManager* manager) = 0; |
| 60 }; | 61 }; |
| 61 | 62 |
| 63 class State : public base::RefCounted<InputMethodManager::State> { | |
| 64 protected: | |
| 65 friend base::RefCounted<InputMethodManager::State>; | |
| 66 | |
| 67 virtual ~State(); | |
| 68 }; | |
| 69 | |
| 62 virtual ~InputMethodManager() {} | 70 virtual ~InputMethodManager() {} |
| 63 | 71 |
| 64 // Gets the global instance of InputMethodManager. Initialize() must be called | 72 // Gets the global instance of InputMethodManager. Initialize() must be called |
| 65 // first. | 73 // first. |
| 66 static CHROMEOS_EXPORT InputMethodManager* Get(); | 74 static CHROMEOS_EXPORT InputMethodManager* Get(); |
| 67 | 75 |
| 68 // Sets the global instance. |instance| will be owned by the internal pointer | 76 // Sets the global instance. |instance| will be owned by the internal pointer |
| 69 // and deleted by Shutdown(). | 77 // and deleted by Shutdown(). |
| 70 // TODO(nona): Instanciate InputMethodManagerImpl inside of this function once | 78 // TODO(nona): Instanciate InputMethodManagerImpl inside of this function once |
| 71 // crbug.com/164375 is fixed. | 79 // crbug.com/164375 is fixed. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 // Switches to an input method (or keyboard layout) which is associated with | 194 // Switches to an input method (or keyboard layout) which is associated with |
| 187 // the |accelerator|. | 195 // the |accelerator|. |
| 188 virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) = 0; | 196 virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) = 0; |
| 189 | 197 |
| 190 // If keyboard layout can be uset at login screen | 198 // If keyboard layout can be uset at login screen |
| 191 virtual bool IsLoginKeyboard(const std::string& layout) const = 0; | 199 virtual bool IsLoginKeyboard(const std::string& layout) const = 0; |
| 192 | 200 |
| 193 // Migrates the input method id to extension-based input method id. | 201 // Migrates the input method id to extension-based input method id. |
| 194 virtual bool MigrateInputMethods( | 202 virtual bool MigrateInputMethods( |
| 195 std::vector<std::string>* input_method_ids) = 0; | 203 std::vector<std::string>* input_method_ids) = 0; |
| 204 | |
| 205 virtual scoped_refptr<State> CreateNewState( | |
| 206 const std::string& debug_name) const = 0; | |
| 207 | |
| 208 virtual void SetState(scoped_refptr<State> state) = 0; | |
| 196 }; | 209 }; |
| 197 | 210 |
| 198 } // namespace input_method | 211 } // namespace input_method |
| 199 } // namespace chromeos | 212 } // namespace chromeos |
| 200 | 213 |
| 201 #endif // CHROMEOS_IME_INPUT_METHOD_MANAGER_H_ | 214 #endif // CHROMEOS_IME_INPUT_METHOD_MANAGER_H_ |
| OLD | NEW |