Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / input_method / input_method_engine.h
index 716d136..f19d635 100644 (file)
@@ -13,6 +13,8 @@
 #include "chromeos/ime/input_method_descriptor.h"
 #include "url/gurl.h"
 
+class Profile;
+
 namespace ui {
 class CandidateWindow;
 class KeyEvent;
@@ -39,99 +41,81 @@ class InputMethodEngine : public InputMethodEngineInterface {
   virtual ~InputMethodEngine();
 
   void Initialize(scoped_ptr<InputMethodEngineInterface::Observer> observer,
-                  const char* engine_name,
-                  const char* extension_id,
-                  const char* engine_id,
-                  const std::vector<std::string>& languages,
-                  const std::vector<std::string>& layouts,
-                  const GURL& options_page,
-                  const GURL& input_view);
+                  const char* extension_id);
 
   // InputMethodEngineInterface overrides.
-  virtual const input_method::InputMethodDescriptor& GetDescriptor()
-      const OVERRIDE;
-  virtual void NotifyImeReady() OVERRIDE;
+  virtual const std::string& GetActiveComponentId() const override;
   virtual bool SetComposition(int context_id,
                               const char* text,
                               int selection_start,
                               int selection_end,
                               int cursor,
                               const std::vector<SegmentInfo>& segments,
-                              std::string* error) OVERRIDE;
-  virtual bool ClearComposition(int context_id, std::string* error) OVERRIDE;
+                              std::string* error) override;
+  virtual bool ClearComposition(int context_id, std::string* error) override;
   virtual bool CommitText(int context_id, const char* text,
-                          std::string* error) OVERRIDE;
+                          std::string* error) override;
   virtual bool SendKeyEvents(int context_id,
-                             const std::vector<KeyboardEvent>& events) OVERRIDE;
+                             const std::vector<KeyboardEvent>& events) override;
   virtual const CandidateWindowProperty&
-    GetCandidateWindowProperty() const OVERRIDE;
+    GetCandidateWindowProperty() const override;
   virtual void SetCandidateWindowProperty(
-      const CandidateWindowProperty& property) OVERRIDE;
+      const CandidateWindowProperty& property) override;
   virtual bool SetCandidateWindowVisible(bool visible,
-                                         std::string* error) OVERRIDE;
+                                         std::string* error) override;
   virtual bool SetCandidates(int context_id,
                              const std::vector<Candidate>& candidates,
-                             std::string* error) OVERRIDE;
+                             std::string* error) override;
   virtual bool SetCursorPosition(int context_id, int candidate_id,
-                                 std::string* error) OVERRIDE;
-  virtual bool SetMenuItems(const std::vector<MenuItem>& items) OVERRIDE;
-  virtual bool UpdateMenuItems(const std::vector<MenuItem>& items) OVERRIDE;
-  virtual bool IsActive() const OVERRIDE;
-  virtual void KeyEventDone(input_method::KeyEventHandle* key_data,
-                            bool handled) OVERRIDE;
+                                 std::string* error) override;
+  virtual bool SetMenuItems(const std::vector<MenuItem>& items) override;
+  virtual bool UpdateMenuItems(const std::vector<MenuItem>& items) override;
+  virtual bool IsActive() const override;
   virtual bool DeleteSurroundingText(int context_id,
                                      int offset,
                                      size_t number_of_chars,
-                                     std::string* error) OVERRIDE;
+                                     std::string* error) override;
 
   // IMEEngineHandlerInterface overrides.
   virtual void FocusIn(
-      const IMEEngineHandlerInterface::InputContext& input_context) OVERRIDE;
-  virtual void FocusOut() OVERRIDE;
-  virtual void Enable() OVERRIDE;
-  virtual void Disable() OVERRIDE;
-  virtual void PropertyActivate(const std::string& property_name) OVERRIDE;
-  virtual void Reset() OVERRIDE;
+      const IMEEngineHandlerInterface::InputContext& input_context) override;
+  virtual void FocusOut() override;
+  virtual void Enable(const std::string& component_id) override;
+  virtual void Disable() override;
+  virtual void PropertyActivate(const std::string& property_name) override;
+  virtual void Reset() override;
   virtual void ProcessKeyEvent(const ui::KeyEvent& key_event,
-                               const KeyEventDoneCallback& callback) OVERRIDE;
-  virtual void CandidateClicked(uint32 index) OVERRIDE;
+                               const KeyEventDoneCallback& callback) override;
+  virtual void CandidateClicked(uint32 index) override;
   virtual void SetSurroundingText(const std::string& text, uint32 cursor_pos,
-                                  uint32 anchor_pos) OVERRIDE;
-  virtual void HideInputView() OVERRIDE;
+                                  uint32 anchor_pos) override;
+  virtual void HideInputView() override;
+  virtual void SetCompositionBounds(const gfx::Rect& bounds) override;
 
- private:
-  void RecordHistogram(const char* name, int count);
+  int GetCotextIdForTesting() { return context_id_; }
 
+ private:
   // Converts MenuItem to InputMethodMenuItem.
   void MenuItemToProperty(const MenuItem& item,
                           ash::ime::InputMethodMenuItem* property);
 
-  // Enables or disables overriding input view page to Virtual Keyboard window.
-  void EnableInputView(bool enabled);
-
-  // Descriptor of this input method.
-  input_method::InputMethodDescriptor descriptor_;
+  // Enables overriding input view page to Virtual Keyboard window.
+  void EnableInputView();
 
   ui::TextInputType current_input_type_;
 
-  // True if this engine is active.
-  bool active_;
-
   // ID that is used for the current input context.  False if there is no focus.
   int context_id_;
 
   // Next id that will be assigned to a context.
   int next_context_id_;
 
-  // This IME ID in Chrome Extension.
-  std::string engine_id_;
+  // The input_component ID in IME extension's manifest.
+  std::string active_component_id_;
 
-  // This IME's Chrome Extension ID.
+  // The IME extension ID.
   std::string extension_id_;
 
-  // This IME ID in InputMethodManager.
-  std::string imm_id_;
-
   // The observer object recieving events for this IME.
   scoped_ptr<InputMethodEngineInterface::Observer> observer_;
 
@@ -154,16 +138,9 @@ class InputMethodEngine : public InputMethodEngineInterface {
   // Mapping of candidate id to index.
   std::map<int, int> candidate_indexes_;
 
-  // Used for input view window.
-  GURL input_view_url_;
-
   // Used with SendKeyEvents and ProcessKeyEvent to check if the key event
   // sent to ProcessKeyEvent is sent by SendKeyEvents.
   const ui::KeyEvent* sent_key_event_;
-
-  // The start & end time of using this input method. This is for UMA.
-  base::Time start_time_;
-  base::Time end_time_;
 };
 
 }  // namespace chromeos