Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3198)

Unified Diff: chrome/browser/input_method/input_method_engine_interface.h

Issue 1562733002: Make InputMethodEngine to inherit from new added class InputMethodEngineBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/input_method/input_method_engine_interface.h
diff --git a/chrome/browser/chromeos/input_method/input_method_engine.h b/chrome/browser/input_method/input_method_engine_interface.h
similarity index 56%
copy from chrome/browser/chromeos/input_method/input_method_engine.h
copy to chrome/browser/input_method/input_method_engine_interface.h
index 9687222fca4e7fbcf1addd19feb2774c70e963ef..cd9beb1d96e2fa61075ad1c78d32112c6fc1512d 100644
--- a/chrome/browser/chromeos/input_method/input_method_engine.h
+++ b/chrome/browser/input_method/input_method_engine_interface.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_INTERFACE_H_
+#define CHROME_BROWSER_INPUT_METHOD_INPUT_METHOD_ENGINE_INTERFACE_H_
#include <map>
#include <string>
@@ -20,31 +17,39 @@
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 InputMethodEngineInterface
+ : virtual public ui::IMEEngineHandlerInterface {
public:
- InputMethodEngine();
+ InputMethodEngineInterface();
- ~InputMethodEngine() override;
+ ~InputMethodEngineInterface() 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 +61,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;
ui::TextInputType current_input_type_;
@@ -128,21 +93,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 +100,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_INTERFACE_H_

Powered by Google App Engine
This is Rietveld 408576698