Chromium Code Reviews| Index: chrome/browser/chromeos/input_method/input_method_manager_impl.h |
| diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.h b/chrome/browser/chromeos/input_method/input_method_manager_impl.h |
| index c8117dc8c9446787a407ffc7bb23e73c9ddc1e02..cfb20f9d9b5b1e5514cbdcb0a977f2e8ff9ded43 100644 |
| --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.h |
| +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.h |
| @@ -30,8 +30,44 @@ class ImeKeyboard; |
| class InputMethodManagerImpl : public InputMethodManager, |
| public CandidateWindowController::Observer { |
| public: |
| + class State : public InputMethodManager::State { |
| + public: |
| + State(); |
| + |
| + // Init new state as a copy of other. |
| + void InitFrom(const State& other); |
| + |
| + std::string Dump() const; |
| + |
| + std::string state_name; |
| + |
| + // The input method which was/is selected. |
| + InputMethodDescriptor previous_input_method_; |
| + InputMethodDescriptor current_input_method_; |
| + // The active input method ids cache. |
| + std::vector<std::string> active_input_method_ids_; |
| + |
| + // For screen locker. When the screen is locked, |previous_input_method_|, |
| + // |current_input_method_|, and |active_input_method_ids_| above are copied |
| + // to these "saved" variables. |
| + InputMethodDescriptor saved_previous_input_method_; |
| + InputMethodDescriptor saved_current_input_method_; |
| + std::vector<std::string> saved_active_input_method_ids_; |
| + |
| + std::string pending_input_method_; |
| + |
| + // The engine map: |
| + // { input_method_id : Engine }. |
| + typedef std::map<std::string, InputMethodEngineInterface*> EngineMap; |
| + EngineMap engine_map_; |
| + |
| + protected: |
| + friend base::RefCounted<chromeos::input_method::InputMethodManager::State>; |
| + virtual ~State(); |
| + }; |
| + |
| // Constructs an InputMethodManager instance. The client is responsible for |
| - // calling |SetState| in response to relevant changes in browser state. |
| + // calling |SetUIState| in response to relevant changes in browser state. |
| explicit InputMethodManagerImpl(scoped_ptr<InputMethodDelegate> delegate); |
| virtual ~InputMethodManagerImpl(); |
| @@ -41,8 +77,8 @@ class InputMethodManagerImpl : public InputMethodManager, |
| // the protected setters. |
| void Init(base::SequencedTaskRunner* ui_task_runner); |
| - // Receives notification of an InputMethodManager::State transition. |
| - void SetState(State new_state); |
| + // Receives notification of an InputMethodManager::UIState transition. |
| + void SetUIState(UIState new_ui_state); |
| // InputMethodManager override: |
| virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE; |
| @@ -96,6 +132,11 @@ class InputMethodManagerImpl : public InputMethodManager, |
| virtual bool MigrateInputMethods( |
| std::vector<std::string>* input_method_ids) OVERRIDE; |
| + virtual scoped_refptr<InputMethodManager::State> CreateNewState( |
| + const std::string& debug_name) const OVERRIDE; |
| + virtual void SetState( |
| + scoped_refptr<InputMethodManager::State> state) OVERRIDE; |
| + |
| // Sets |candidate_window_controller_|. |
| void SetCandidateWindowControllerForTesting( |
| CandidateWindowController* candidate_window_controller); |
| @@ -139,10 +180,14 @@ class InputMethodManagerImpl : public InputMethodManager, |
| const std::vector<std::string>& input_method_ids, |
| const std::string& current_input_method_id); |
| + // Change system input method and inform observers. Doesn't modify state. |
| + void ChangeInputMethodInternal(const InputMethodDescriptor& input_method_id, |
| + bool show_message); |
| + |
| // Change system input method. |
| // Returns true if the system input method is changed. |
| - bool ChangeInputMethodInternal(const std::string& input_method_id, |
| - bool show_message); |
| + bool LookupAndChangeInputMethodInternal(const std::string& input_method_id, |
| + bool show_message); |
| // Gets whether the XKB extension is loaded successfully by checking the XKB |
| // input methods in input methods in |component_extension_ime_manager_|. |
| @@ -166,33 +211,19 @@ class InputMethodManagerImpl : public InputMethodManager, |
| // (after list of enabled input methods has been updated) |
| void ReconfigureIMFramework(); |
| - // Gets the current active user profile. |
| - Profile* GetProfile() const; |
| - |
| scoped_ptr<InputMethodDelegate> delegate_; |
| // The current browser status. |
| - State state_; |
| + UIState ui_state_; |
| // A list of objects that monitor the manager. |
| ObserverList<InputMethodManager::Observer> observers_; |
| ObserverList<CandidateWindowObserver> candidate_window_observers_; |
| - // The input method which was/is selected. |
| - InputMethodDescriptor previous_input_method_; |
| - InputMethodDescriptor current_input_method_; |
| - // The active input method ids cache. |
| - std::vector<std::string> active_input_method_ids_; |
| - |
| // The list of enabled extension IMEs. |
| std::vector<std::string> enabled_extension_imes_; |
| - // For screen locker. When the screen is locked, |previous_input_method_|, |
| - // |current_input_method_|, and |active_input_method_ids_| above are copied |
| - // to these "saved" variables. |
| - InputMethodDescriptor saved_previous_input_method_; |
| - InputMethodDescriptor saved_current_input_method_; |
| - std::vector<std::string> saved_active_input_method_ids_; |
| + scoped_refptr<InputMethodManagerImpl::State> state_; |
| // Extra input methods that have been explicitly added to the menu, such as |
| // those created by extension. |
| @@ -216,19 +247,10 @@ class InputMethodManagerImpl : public InputMethodManager, |
| // auto-repeat interval. |
| scoped_ptr<ImeKeyboard> keyboard_; |
| - std::string pending_input_method_; |
|
Shu Chen
2014/08/04 14:55:23
this is already gone, please rebase your cl.
Alexander Alekseev
2014/08/06 23:39:45
Done.
|
| - |
| base::ThreadChecker thread_checker_; |
| base::WeakPtrFactory<InputMethodManagerImpl> weak_ptr_factory_; |
| - // The engine map: |
| - // { Profile : { input_method_id : Engine } }. |
| - typedef std::map<std::string, InputMethodEngineInterface*> |
| - EngineMap; |
| - typedef std::map<Profile*, EngineMap, ProfileCompare> ProfileEngineMap; |
| - ProfileEngineMap profile_engine_map_; |
| - |
| DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); |
| }; |