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

Unified Diff: services/prediction/prediction_service_impl.cc

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, 5 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: services/prediction/prediction_service_impl.cc
diff --git a/services/prediction/prediction_service_impl.cc b/services/prediction/prediction_service_impl.cc
index cd3079ac18b9f3017c64991272e080084b597795..6ffc38dbe513b249f586181f41364802c2e0555e 100644
--- a/services/prediction/prediction_service_impl.cc
+++ b/services/prediction/prediction_service_impl.cc
@@ -7,35 +7,39 @@
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "services/prediction/dictionary_service.h"
#include "services/prediction/prediction_service_impl.h"
+#include "services/prediction/touch_position_correction.h"
namespace prediction {
PredictionServiceImpl::PredictionServiceImpl(
mojo::InterfaceRequest<PredictionService> request)
: strong_binding_(this, request.Pass()) {
+ touch_position_correction = new TouchPositionCorrection();
+
+ // Hardcoded qwerty keyboard proximity settings, parameters are:
+ // locale, grid_width, grid_height, min_width, height, most_common_key_width,
+ // most_common_key_height, sorted_keys, touch_position_correction
+ proximity_settings = new ProximityInfoService("en", 32, 16, 348, 174, 29, 58,
+ touch_position_correction);
+
+ dictionary_service = new DictionaryService();
}
PredictionServiceImpl::~PredictionServiceImpl() {
+ delete dictionary_service;
+ delete touch_position_correction;
+ delete proximity_settings;
}
// PredictionService implementation
-void PredictionServiceImpl::SetSettings(SettingsPtr settings) {
- stored_settings_.correction_enabled = settings->correction_enabled;
- stored_settings_.block_potentially_offensive =
- settings->block_potentially_offensive;
- stored_settings_.space_aware_gesture_enabled =
- settings->space_aware_gesture_enabled;
-}
-
-// only predict "cat" no matter what prediction_info
-// has for now
void PredictionServiceImpl::GetPredictionList(
PredictionInfoPtr prediction_info,
const GetPredictionListCallback& callback) {
- mojo::String cat = "cat";
- mojo::Array<mojo::String> prediction_list;
- prediction_list.push_back(cat);
+ mojo::Array<mojo::String> prediction_list =
+ dictionary_service->GetDictionarySuggestion(prediction_info.Pass(),
+ proximity_settings);
callback.Run(prediction_list.Pass());
}

Powered by Google App Engine
This is Rietveld 408576698