Chromium Code Reviews| Index: chrome/browser/input_method/input_method_engine_base.h |
| diff --git a/chrome/browser/chromeos/input_method/input_method_engine.h b/chrome/browser/input_method/input_method_engine_base.h |
| similarity index 56% |
| copy from chrome/browser/chromeos/input_method/input_method_engine.h |
| copy to chrome/browser/input_method/input_method_engine_base.h |
| index 9687222fca4e7fbcf1addd19feb2774c70e963ef..66f7946874533ab034b777bad255d3a639e868c3 100644 |
| --- a/chrome/browser/chromeos/input_method/input_method_engine.h |
| +++ b/chrome/browser/input_method/input_method_engine_base.h |
| @@ -1,12 +1,9 @@ |
| -// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ |
| -#define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ |
| - |
| -#include <stddef.h> |
| -#include <stdint.h> |
| +#ifndef CHROME_BROWSER_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_ |
| +#define CHROME_BROWSER_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_ |
| #include <map> |
| #include <string> |
| @@ -20,31 +17,38 @@ |
| class Profile; |
| namespace ui { |
| -class CandidateWindow; |
| struct CompositionText; |
| class IMEEngineHandlerInterface; |
| class IMEEngineObserver; |
| class KeyEvent; |
| - |
| -namespace ime { |
| -struct InputMethodMenuItem; |
| -} // namespace ime |
| } // namespace ui |
| -namespace chromeos { |
| +namespace input_method { |
| -class InputMethodEngine : public ui::IMEEngineHandlerInterface { |
| +class InputMethodEngineBase : virtual public ui::IMEEngineHandlerInterface { |
|
sky
2016/01/08 16:35:27
Why are you using virtual?
Azure Wei
2016/01/10 08:19:30
This is because InputMethodEngineBase didn't overr
|
| public: |
| - InputMethodEngine(); |
| + InputMethodEngineBase(); |
| - ~InputMethodEngine() override; |
| + ~InputMethodEngineBase() override; |
| void Initialize(scoped_ptr<ui::IMEEngineObserver> observer, |
| const char* extension_id, |
| Profile* profile); |
| // IMEEngineHandlerInterface overrides. |
| - const std::string& GetActiveComponentId() const override; |
| + void FocusIn(const ui::IMEEngineHandlerInterface::InputContext& input_context) |
| + override; |
| + void FocusOut() override; |
| + void Enable(const std::string& component_id) override; |
| + void Disable() override; |
| + void Reset() override; |
| + void ProcessKeyEvent(const ui::KeyEvent& key_event, |
| + KeyEventDoneCallback& callback) override; |
| + void SetSurroundingText(const std::string& text, |
| + uint32_t cursor_pos, |
| + uint32_t anchor_pos, |
| + uint32_t offset_pos) override; |
| + void SetCompositionBounds(const std::vector<gfx::Rect>& bounds) override; |
| bool SetComposition(int context_id, |
| const char* text, |
| int selection_start, |
| @@ -56,56 +60,16 @@ class InputMethodEngine : public ui::IMEEngineHandlerInterface { |
| bool CommitText(int context_id, |
| const char* text, |
| std::string* error) override; |
| - bool SendKeyEvents(int context_id, |
| - const std::vector<KeyboardEvent>& events) override; |
| - const CandidateWindowProperty& GetCandidateWindowProperty() const override; |
| - void SetCandidateWindowProperty( |
| - const CandidateWindowProperty& property) override; |
| - bool SetCandidateWindowVisible(bool visible, std::string* error) override; |
| - bool SetCandidates(int context_id, |
| - const std::vector<Candidate>& candidates, |
| - std::string* error) override; |
| - bool SetCursorPosition(int context_id, |
| - int candidate_id, |
| - std::string* error) override; |
| - bool SetMenuItems(const std::vector<MenuItem>& items) override; |
| - bool UpdateMenuItems(const std::vector<MenuItem>& items) override; |
| - bool IsActive() const override; |
| + const std::string& GetActiveComponentId() const override; |
| bool DeleteSurroundingText(int context_id, |
| int offset, |
| size_t number_of_chars, |
| std::string* error) override; |
| - |
| - // IMEEngineHandlerInterface overrides. |
| - void FocusIn(const ui::IMEEngineHandlerInterface::InputContext& input_context) |
| - override; |
| - void FocusOut() override; |
| - void Enable(const std::string& component_id) override; |
| - void Disable() override; |
| - void PropertyActivate(const std::string& property_name) override; |
| - void Reset() override; |
| - void ProcessKeyEvent(const ui::KeyEvent& key_event, |
| - KeyEventDoneCallback& callback) override; |
| - void CandidateClicked(uint32_t index) override; |
| - void SetSurroundingText(const std::string& text, |
| - uint32_t cursor_pos, |
| - uint32_t anchor_pos, |
| - uint32_t offset_pos) override; |
| - void HideInputView() override; |
| - void SetCompositionBounds(const std::vector<gfx::Rect>& bounds) override; |
| - |
| int GetCotextIdForTesting() { return context_id_; } |
| - |
| bool IsInterestedInKeyEvent() const override; |
| - private: |
| - bool CheckProfile() const; |
| - // Converts MenuItem to InputMethodMenuItem. |
| - void MenuItemToProperty(const MenuItem& item, |
| - ui::ime::InputMethodMenuItem* property); |
| - |
| - // Enables overriding input view page to Virtual Keyboard window. |
| - void EnableInputView(); |
| + protected: |
| + virtual bool CheckProfile() const = 0; |
|
sky
2016/01/08 16:35:27
Functions (just like members) should have descript
Azure Wei
2016/01/10 08:19:30
Done.
|
| ui::TextInputType current_input_type_; |
| @@ -128,21 +92,6 @@ class InputMethodEngine : public ui::IMEEngineHandlerInterface { |
| scoped_ptr<ui::CompositionText> composition_text_; |
| int composition_cursor_; |
| - // The current candidate window. |
| - scoped_ptr<ui::CandidateWindow> candidate_window_; |
| - |
| - // The current candidate window property. |
| - CandidateWindowProperty candidate_window_property_; |
| - |
| - // Indicates whether the candidate window is visible. |
| - bool window_visible_; |
| - |
| - // Mapping of candidate index to candidate id. |
| - std::vector<int> candidate_ids_; |
| - |
| - // Mapping of candidate id to index. |
| - std::map<int, int> candidate_indexes_; |
| - |
| // Used with SendKeyEvents and ProcessKeyEvent to check if the key event |
| // sent to ProcessKeyEvent is sent by SendKeyEvents. |
| const ui::KeyEvent* sent_key_event_; |
| @@ -150,6 +99,6 @@ class InputMethodEngine : public ui::IMEEngineHandlerInterface { |
| Profile* profile_; |
| }; |
| -} // namespace chromeos |
| +} // namespace input_method |
| -#endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_ENGINE_H_ |
| +#endif // CHROME_BROWSER_INPUT_METHOD_INPUT_METHOD_ENGINE_BASE_H_ |