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

Unified Diff: services/prediction/proximity_info_service.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, 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/proximity_info_service.h
diff --git a/services/prediction/proximity_info_service.h b/services/prediction/proximity_info_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..20d81276ebd07d4558b29157a7da4267117fea57
--- /dev/null
+++ b/services/prediction/proximity_info_service.h
@@ -0,0 +1,64 @@
+// Copyright 2015 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 SERVICES_PREDICTION_PROXIMITY_INFO_SERVICE_H_
+#define SERVICES_PREDICTION_PROXIMITY_INFO_SERVICE_H_
+
+#include "mojo/services/prediction/public/interfaces/prediction.mojom.h"
+#include "services/prediction/key_set.h"
+#include "third_party/prediction/suggest/core/layout/proximity_info.h"
+
+// NOTE: This class has been translated to C++ and modified from the Android
+// Open Source Project. Specifically from some functions of the following file:
+// https://android.googlesource.com/platform/packages/inputmethods/LatinIME/+/
+// android-5.1.1_r8/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
+
+namespace prediction {
+
+class TouchPositionCorrection;
+
+class ProximityInfoService {
APW 2015/07/23 20:11:28 This is really a Factory, not a Service
riajiang 2015/07/31 02:13:04 Done.
+ public:
+ ProximityInfoService(const std::string locale,
+ const int grid_width,
+ const int grid_height,
+ const int min_width,
+ const int height,
+ const int most_common_key_width,
+ const int most_common_key_height,
+ TouchPositionCorrection* touch_position_correction);
+ ~ProximityInfoService();
+
+ latinime::ProximityInfo* GetNativeProximityInfoService();
+
+ private:
+ // Number of key widths from current touch point to search for nearest keys.
+ static const float SEARCH_DISTANCE;
+ static const float DEFAULT_TOUCH_POSITION_CORRECTION_RADIUS;
+
+ int pgrid_width;
+ int pgrid_height;
+ int pgrid_size;
+ int pcell_width;
+ int pcell_height;
+ int pkeyboard_min_width;
+ int pkeyboard_height;
+ int pmost_common_key_width;
+ int pmost_common_key_height;
+ const Key*** pgrid_neighbors;
+ std::string plocale;
+ int* neighbor_count_per_cell;
+ latinime::ProximityInfo* pnative_proximity_info;
+
+ static bool NeedsProximityInfoService(const Key key);
+
+ latinime::ProximityInfo* CreateNativeProximityInfoService(
+ TouchPositionCorrection* touch_position_correction);
+
+ void ComputeNearestNeighbors();
+}; // class ProximityInfoService
+
+} // namespace prediction
+
+#endif // SERVICES_PREDICTION_PROXIMITY_INFO_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698