| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_CHROME_BROWSER_VOICE_SPEECH_INPUT_LOCALE_CONFIG_IMPL_H_ | 5 #ifndef IOS_CHROME_BROWSER_VOICE_SPEECH_INPUT_LOCALE_CONFIG_IMPL_H_ |
| 6 #define IOS_CHROME_BROWSER_VOICE_SPEECH_INPUT_LOCALE_CONFIG_IMPL_H_ | 6 #define IOS_CHROME_BROWSER_VOICE_SPEECH_INPUT_LOCALE_CONFIG_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 11 #include "ios/chrome/browser/voice/speech_input_locale_config.h" | 11 #include "ios/chrome/browser/voice/speech_input_locale_config.h" |
| 12 | 12 |
| 13 class SpeechInputLocaleConfigImplTest; |
| 14 |
| 13 namespace base { | 15 namespace base { |
| 14 template <typename T> | 16 template <typename T> |
| 15 struct DefaultSingletonTraits; | 17 struct DefaultSingletonTraits; |
| 16 } // namespace base | 18 } // namespace base |
| 17 | 19 |
| 18 namespace voice { | 20 namespace voice { |
| 19 | 21 |
| 20 // A concrete implementation of SpeechInputLocaleConfig that uses the available | 22 // A concrete implementation of SpeechInputLocaleConfig that uses the available |
| 21 // language list from S3Kit and the speech input locale matching from | 23 // language list from S3Kit and the speech input locale matching from |
| 22 // SpeechInputLocaleMatches.plist. | 24 // SpeechInputLocaleMatches.plist. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void InitializeAvailableLocales(); | 56 void InitializeAvailableLocales(); |
| 55 | 57 |
| 56 // Adds local matching data from speech_input_matches.plist into | 58 // Adds local matching data from speech_input_matches.plist into |
| 57 // |locale_indices_for_codes_|. | 59 // |locale_indices_for_codes_|. |
| 58 void InitializeLocaleMatches(); | 60 void InitializeLocaleMatches(); |
| 59 | 61 |
| 60 // Populates |text_to_speech_languages_| with the available locales. | 62 // Populates |text_to_speech_languages_| with the available locales. |
| 61 void InitializeTextToSpeechLangauges(); | 63 void InitializeTextToSpeechLangauges(); |
| 62 | 64 |
| 63 friend struct base::DefaultSingletonTraits<SpeechInputLocaleConfigImpl>; | 65 friend struct base::DefaultSingletonTraits<SpeechInputLocaleConfigImpl>; |
| 66 friend class ::SpeechInputLocaleConfigImplTest; |
| 64 | 67 |
| 65 // The list of available speech input locales. | 68 // The list of available speech input locales. |
| 66 std::vector<SpeechInputLocale> available_locales_; | 69 std::vector<SpeechInputLocale> available_locales_; |
| 67 // A map storing canonical locale codes with the index of their associated | 70 // A map storing canonical locale codes with the index of their associated |
| 68 // InputLocale within |available_locales_|. | 71 // InputLocale within |available_locales_|. |
| 69 std::map<std::string, size_t> locale_indices_for_codes_; | 72 std::map<std::string, size_t> locale_indices_for_codes_; |
| 70 // A map storing the language portions of locale codes with the index of their | 73 // A map storing the language portions of locale codes with the index of their |
| 71 // associated InputLocale within |available_locales_|. | 74 // associated InputLocale within |available_locales_|. |
| 72 std::map<std::string, size_t> default_locale_indices_for_languages_; | 75 std::map<std::string, size_t> default_locale_indices_for_languages_; |
| 73 // The languages available for Text To Speech search results. | 76 // The languages available for Text To Speech search results. |
| 74 std::vector<std::string> text_to_speech_languages_; | 77 std::vector<std::string> text_to_speech_languages_; |
| 75 | 78 |
| 76 DISALLOW_COPY_AND_ASSIGN(SpeechInputLocaleConfigImpl); | 79 DISALLOW_COPY_AND_ASSIGN(SpeechInputLocaleConfigImpl); |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 } // namespace voice | 82 } // namespace voice |
| 80 | 83 |
| 81 #endif // IOS_CHROME_BROWSER_VOICE_SPEECH_INPUT_LOCALE_CONFIG_IMPL_H_ | 84 #endif // IOS_CHROME_BROWSER_VOICE_SPEECH_INPUT_LOCALE_CONFIG_IMPL_H_ |
| OLD | NEW |