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

Side by Side Diff: services/keyboard_native/predictor.h

Issue 1247903003: Add spellcheck and word suggestion to the prediction service (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_KEYBOARD_NATIVE_PREDICTOR_H_
6 #define SERVICES_KEYBOARD_NATIVE_PREDICTOR_H_
7
8 #include <vector>
9
10 #include "base/callback.h"
11 #include "mojo/public/cpp/application/connect.h"
12 #include "mojo/public/interfaces/application/shell.mojom.h"
13 #include "mojo/services/prediction/public/interfaces/prediction.mojom.h"
14 #include "services/keyboard_native/key_layout.h"
15
16 namespace keyboard {
17
18 class Predictor {
19 public:
20 Predictor(mojo::Shell* shell);
21 ~Predictor();
22
23 void SetSuggestionKeys(std::vector<KeyLayout::Key*> suggestion_keys);
24
25 void SetUpdateCallback(base::Callback<void()> on_update_callback);
26
27 void StoreCurWord(std::string new_word);
28
29 int ChooseSuggestedWord(std::string suggested);
30
31 void DeleteCharInCurWord();
32
33 private:
34 void ShowEmptySuggestion();
35
36 void GetSuggestion();
37
38 void GetPredictionListAndEnd(const mojo::Array<mojo::String>& input_list);
39
40 prediction::PredictionServicePtr prediction_service_impl_;
41 std::vector<KeyLayout::Key*> suggestion_keys_;
42 std::string current_word_;
43 std::vector<std::string> previous_words_;
44 base::Callback<void()> on_update_callback_;
45
46 DISALLOW_COPY_AND_ASSIGN(Predictor);
47 };
48
49 } // namespace keyboard
50
51 #endif // SERVICES_KEYBOARD_NATIVE_PREDICTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698