Ria Runjie Jiang | 1e6163c | 2015-08-06 13:06:25 -0700 | [diff] [blame] | 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_DICTIONARY_SERVICE_H_ |
| 6 | #define SERVICES_PREDICTION_DICTIONARY_SERVICE_H_ |
| 7 | |
| 8 | #include "base/macros.h" |
| 9 | #include "base/memory/scoped_ptr.h" |
Viet-Trung Luu | 0f4f3ba | 2015-10-10 01:08:40 -0700 | [diff] [blame] | 10 | #include "mojo/services/prediction/interfaces/prediction.mojom.h" |
Ria Runjie Jiang | 1e6163c | 2015-08-06 13:06:25 -0700 | [diff] [blame] | 11 | #include "services/prediction/proximity_info_factory.h" |
| 12 | |
| 13 | namespace latinime { |
| 14 | |
| 15 | class Dictionary; |
| 16 | class DicTraverseSession; |
| 17 | class PrevWordsInfo; |
| 18 | } // namespace latinime |
| 19 | |
| 20 | namespace prediction { |
| 21 | |
| 22 | class DictionaryService { |
| 23 | public: |
| 24 | DictionaryService(); |
| 25 | ~DictionaryService(); |
| 26 | |
| 27 | mojo::Array<mojo::String> GetDictionarySuggestion( |
| 28 | PredictionInfoPtr prediction_info, |
| 29 | latinime::ProximityInfo* proximity_info); |
| 30 | |
| 31 | private: |
| 32 | void CreatDictFromEmbeddedDataIfNotExist(const std::string path); |
| 33 | |
| 34 | latinime::Dictionary* const OpenDictionary(const std::string path, |
| 35 | const int start_offset, |
| 36 | const int size, |
| 37 | const bool is_updatable); |
| 38 | |
| 39 | latinime::PrevWordsInfo ProcessPrevWord( |
| 40 | mojo::Array<PrevWordInfoPtr>& prev_words); |
| 41 | |
| 42 | int max_suggestion_size_; |
| 43 | scoped_ptr<latinime::Dictionary> default_dictionary_; |
| 44 | scoped_ptr<latinime::DicTraverseSession> default_session_; |
| 45 | |
| 46 | DISALLOW_COPY_AND_ASSIGN(DictionaryService); |
| 47 | }; |
| 48 | |
| 49 | } // namespace prediction |
| 50 | |
| 51 | #endif // SERVICES_PREDICTION_DICTIONARY_SERVICE_H_ |