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_ |