Index: chrome/browser/chromeos/cros/input_method_library.h |
diff --git a/chrome/browser/chromeos/cros/input_method_library.h b/chrome/browser/chromeos/cros/input_method_library.h |
index daa4c4a0d596da59f5a7d648265db2fa03455981..685fa210a2528a500b4b3f1da29b03040e79ffb9 100644 |
--- a/chrome/browser/chromeos/cros/input_method_library.h |
+++ b/chrome/browser/chromeos/cros/input_method_library.h |
@@ -95,140 +95,9 @@ class InputMethodLibrary { |
virtual const InputMethodDescriptor& current_input_method() const = 0; |
virtual const ImePropertyList& current_ime_properties() const = 0; |
-}; |
-// This class handles the interaction with the ChromeOS language library APIs. |
-// Classes can add themselves as observers. Users can get an instance of this |
-// library class like this: InputMethodLibrary::Get() |
-class InputMethodLibraryImpl : public InputMethodLibrary { |
- public: |
- InputMethodLibraryImpl(); |
- virtual ~InputMethodLibraryImpl(); |
- |
- // InputMethodLibrary overrides. |
- virtual void AddObserver(Observer* observer); |
- virtual void RemoveObserver(Observer* observer); |
- virtual InputMethodDescriptors* GetActiveInputMethods(); |
- virtual size_t GetNumActiveInputMethods(); |
- virtual InputMethodDescriptors* GetSupportedInputMethods(); |
- virtual void ChangeInputMethod(const std::string& input_method_id); |
- virtual void SetImePropertyActivated(const std::string& key, |
- bool activated); |
- virtual bool InputMethodIsActivated(const std::string& input_method_id); |
- virtual bool GetImeConfig( |
- const char* section, const char* config_name, ImeConfigValue* out_value); |
- virtual bool SetImeConfig(const char* section, |
- const char* config_name, |
- const ImeConfigValue& value); |
- |
- virtual const InputMethodDescriptor& previous_input_method() const { |
- return previous_input_method_; |
- } |
- virtual const InputMethodDescriptor& current_input_method() const { |
- return current_input_method_; |
- } |
- |
- virtual const ImePropertyList& current_ime_properties() const { |
- return current_ime_properties_; |
- } |
- |
- virtual void StartInputMethodProcesses(); |
- virtual void StopInputMethodProcesses(); |
- virtual void SetDeferImeStartup(bool defer); |
- |
- private: |
- // This method is called when there's a change in input method status. |
- static void InputMethodChangedHandler( |
- void* object, const InputMethodDescriptor& current_input_method); |
- |
- // This method is called when an input method sends "RegisterProperties" |
- // signal. |
- static void RegisterPropertiesHandler( |
- void* object, const ImePropertyList& prop_list); |
- |
- // This method is called when an input method sends "UpdateProperty" signal. |
- static void UpdatePropertyHandler( |
- void* object, const ImePropertyList& prop_list); |
- |
- // This method is called when bus connects or disconnects. |
- static void ConnectionChangeHandler(void* object, bool connected); |
- |
- // Ensures that the monitoring of input method changes is started. Starts |
- // the monitoring if necessary. Returns true if the monitoring has been |
- // successfully started. |
- bool EnsureStarted(); |
- |
- // Ensures that the cros library is loaded and the the monitoring is |
- // started. Loads the cros library and starts the monitoring if |
- // necessary. Returns true if the two conditions are both met. |
- bool EnsureLoadedAndStarted(); |
- |
- // Called by the handler to update the input method status. |
- // This will notify all the Observers. |
- void UpdateCurrentInputMethod( |
- const InputMethodDescriptor& current_input_method); |
- |
- // Called by the handler to register input method properties. |
- void RegisterProperties(const ImePropertyList& prop_list); |
- |
- // Called by the handler to update input method properties. |
- void UpdateProperty(const ImePropertyList& prop_list); |
- |
- void MaybeUpdateImeState(const char* section, const char* config_name, |
- const ImeConfigValue& value); |
- |
- // Tries to send all pending SetImeConfig requests to the input method config |
- // daemon. |
- void FlushImeConfig(); |
- |
- // Launch any IME processes that should currently be running, but aren't. |
- void MaybeLaunchIme(); |
- |
- // Handle one of the ime processes shutting down. If it was shutdown by us, |
- // just close the handle. If it crashed, restart it. |
- static void OnImeShutdown(int pid, int status, |
- InputMethodLibraryImpl* library); |
- |
- // A reference to the language api, to allow callbacks when the input method |
- // status changes. |
- InputMethodStatusConnection* input_method_status_connection_; |
- ObserverList<Observer> observers_; |
- |
- // The input method which was/is selected. |
- InputMethodDescriptor previous_input_method_; |
- InputMethodDescriptor current_input_method_; |
- |
- // The input method properties which the current input method uses. The list |
- // might be empty when no input method is used. |
- ImePropertyList current_ime_properties_; |
- |
- typedef std::pair<std::string, std::string> ConfigKeyType; |
- typedef std::map<ConfigKeyType, ImeConfigValue> InputMethodConfigRequests; |
- // SetImeConfig requests that are not yet completed. |
- // Use a map to queue config requests, so we only send the last request for |
- // the same config key (i.e. we'll discard ealier requests for the same |
- // config key). As we discard old requests for the same config key, the order |
- // of requests doesn't matter, so it's safe to use a map. |
- InputMethodConfigRequests pending_config_requests_; |
- |
- // Values that have been set via SetImeConfig(). We keep a copy available to |
- // resend if the ime restarts and loses its state. |
- InputMethodConfigRequests current_config_values_; |
- |
- // A timer for retrying to send |pendning_config_commands_| to the input |
- // method config daemon. |
- base::OneShotTimer<InputMethodLibraryImpl> timer_; |
- |
- bool ime_running_; |
- bool ime_connected_; |
- bool defer_ime_startup_; |
- std::string active_input_method_; |
- bool need_input_method_set_; |
- |
- int ime_handle_; |
- int candidate_window_handle_; |
- |
- DISALLOW_COPY_AND_ASSIGN(InputMethodLibraryImpl); |
+ // Get library implementation. |
+ static InputMethodLibrary* GetImpl(bool stub); |
}; |
} // namespace chromeos |