Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_PREDICTION_PROXIMITY_INFO_SERVICE_H_ | |
| 6 #define SERVICES_PREDICTION_PROXIMITY_INFO_SERVICE_H_ | |
| 7 | |
| 8 #include "mojo/services/prediction/public/interfaces/prediction.mojom.h" | |
| 9 #include "services/prediction/key_set.h" | |
| 10 #include "third_party/prediction/suggest/core/layout/proximity_info.h" | |
| 11 | |
| 12 // NOTE: This class has been translated to C++ and modified from the Android | |
| 13 // Open Source Project. Specifically from some functions of the following file: | |
| 14 // https://android.googlesource.com/platform/packages/inputmethods/LatinIME/+/ | |
| 15 // android-5.1.1_r8/java/src/com/android/inputmethod/keyboard/ProximityInfo.java | |
| 16 | |
| 17 namespace prediction { | |
| 18 | |
| 19 class TouchPositionCorrection; | |
| 20 | |
| 21 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.
| |
| 22 public: | |
| 23 ProximityInfoService(const std::string locale, | |
| 24 const int grid_width, | |
| 25 const int grid_height, | |
| 26 const int min_width, | |
| 27 const int height, | |
| 28 const int most_common_key_width, | |
| 29 const int most_common_key_height, | |
| 30 TouchPositionCorrection* touch_position_correction); | |
| 31 ~ProximityInfoService(); | |
| 32 | |
| 33 latinime::ProximityInfo* GetNativeProximityInfoService(); | |
| 34 | |
| 35 private: | |
| 36 // Number of key widths from current touch point to search for nearest keys. | |
| 37 static const float SEARCH_DISTANCE; | |
| 38 static const float DEFAULT_TOUCH_POSITION_CORRECTION_RADIUS; | |
| 39 | |
| 40 int pgrid_width; | |
| 41 int pgrid_height; | |
| 42 int pgrid_size; | |
| 43 int pcell_width; | |
| 44 int pcell_height; | |
| 45 int pkeyboard_min_width; | |
| 46 int pkeyboard_height; | |
| 47 int pmost_common_key_width; | |
| 48 int pmost_common_key_height; | |
| 49 const Key*** pgrid_neighbors; | |
| 50 std::string plocale; | |
| 51 int* neighbor_count_per_cell; | |
| 52 latinime::ProximityInfo* pnative_proximity_info; | |
| 53 | |
| 54 static bool NeedsProximityInfoService(const Key key); | |
| 55 | |
| 56 latinime::ProximityInfo* CreateNativeProximityInfoService( | |
| 57 TouchPositionCorrection* touch_position_correction); | |
| 58 | |
| 59 void ComputeNearestNeighbors(); | |
| 60 }; // class ProximityInfoService | |
| 61 | |
| 62 } // namespace prediction | |
| 63 | |
| 64 #endif // SERVICES_PREDICTION_PROXIMITY_INFO_SERVICE_H_ | |
| OLD | NEW |