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

Unified Diff: services/keyboard_native/key_layout.h

Issue 1247903003: Add spellcheck and word suggestion to the prediction service (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: format README and CHROMIUM.diff Created 5 years, 4 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
« no previous file with comments | « services/keyboard_native/BUILD.gn ('k') | services/keyboard_native/key_layout.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/keyboard_native/key_layout.h
diff --git a/services/keyboard_native/key_layout.h b/services/keyboard_native/key_layout.h
index cd002c2ed973dffae658f785f7fe4bffceb37d25..ccc33ed4c49f3f796efd6883101d83231c1c7312 100644
--- a/services/keyboard_native/key_layout.h
+++ b/services/keyboard_native/key_layout.h
@@ -22,6 +22,9 @@ class PointF;
namespace keyboard {
+class Predictor;
+class TextUpdateKey;
+
// Represents a drawable keyboard.
class KeyLayout {
public:
@@ -55,6 +58,9 @@ class KeyLayout {
// Sets the callback to call whenever delete is pressed.
void SetDeleteCallback(base::Callback<void()> on_delete_callback);
+ void SetSuggestTextCallback(
+ base::Callback<void(const std::string&)> on_suggest_text_callback);
+
// Sets the dimensions the keyboard will draw itself into.
void SetKeyArea(const gfx::RectF& key_area);
@@ -68,6 +74,8 @@ class KeyLayout {
// Indicate to the keyboard that a touch up has occurred at the given Point.
void OnTouchUp(const gfx::PointF& touch_up);
+ void SetPredictor(Predictor* predictor);
+
private:
// initializes the *_layout_ vectors.
void InitLayouts();
@@ -85,6 +93,8 @@ class KeyLayout {
// A TextKey callback that calls on_delete_callback_.
void OnKeyDelete(const TextKey& key);
+ void OnSuggestKeyEmitText(const TextUpdateKey& key);
+
// A TextKey callback that switches the layout_ and key_map_ to upper case.
void OnKeySwitchToUpperCase(const TextKey& key);
@@ -96,6 +106,7 @@ class KeyLayout {
base::Callback<void(const std::string&)> on_text_callback_;
base::Callback<void()> on_delete_callback_;
+ base::Callback<void(const std::string&)> on_suggest_text_callback_;
gfx::RectF key_area_;
std::vector<std::vector<float>>* layout_;
std::vector<std::vector<float>> letters_layout_;
@@ -104,6 +115,7 @@ class KeyLayout {
std::vector<std::vector<Key*>> lower_case_key_map_;
std::vector<std::vector<Key*>> upper_case_key_map_;
std::vector<std::vector<Key*>> symbols_key_map_;
+ Predictor* predictor_;
base::WeakPtrFactory<KeyLayout> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(KeyLayout);
« no previous file with comments | « services/keyboard_native/BUILD.gn ('k') | services/keyboard_native/key_layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698