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()); |
} |