| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_VOICE_SPEECH_INPUT_LOCALE_CONFIG_H_ |
| 6 #define IOS_CHROME_BROWSER_VOICE_SPEECH_INPUT_LOCALE_CONFIG_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "ios/chrome/browser/voice/speech_input_locale.h" |
| 13 |
| 14 namespace voice { |
| 15 |
| 16 class SpeechInputLocaleConfig; |
| 17 |
| 18 // Configuration object supplying information about valid locales for Voice |
| 19 // Search. |
| 20 class SpeechInputLocaleConfig { |
| 21 public: |
| 22 // Returns a pointer to the singleton object. |
| 23 static SpeechInputLocaleConfig* GetInstance(); |
| 24 |
| 25 // Returns the default locale as determined by the system language. |
| 26 virtual SpeechInputLocale GetDefaultLocale() const = 0; |
| 27 |
| 28 // Returns a reference to a vector of SpeechInputLocales sorted alphabetically |
| 29 // by their display names. |
| 30 virtual const std::vector<SpeechInputLocale>& GetAvailableLocales() const = 0; |
| 31 |
| 32 // Returns the SpeechInputLocale to use for |locale_code|. If |locale_code| is |
| 33 // not contained in GetAvailableLocales()'s return value, then the |
| 34 // SpeechInputLocaleConfig will attempt to match with an appropriate subsitute |
| 35 // (e.g. "en-NZ" => "en-AU"). |
| 36 virtual SpeechInputLocale GetLocaleForCode( |
| 37 const std::string& locale_code) const = 0; |
| 38 |
| 39 // Returns a reference to an alphabetically sorted vector containing language |
| 40 // codes (e.g. "en", "fr") that can be used to trigger Text To Speech results. |
| 41 virtual const std::vector<std::string>& GetTextToSpeechLanguages() const = 0; |
| 42 |
| 43 // Returns whether the language portion of |locale_code| is an available |
| 44 // TTS language. |
| 45 virtual bool IsTextToSpeechEnabledForCode( |
| 46 const std::string& locale_code) const = 0; |
| 47 |
| 48 protected: |
| 49 SpeechInputLocaleConfig() = default; |
| 50 virtual ~SpeechInputLocaleConfig() = default; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(SpeechInputLocaleConfig); |
| 53 }; |
| 54 |
| 55 } // namespace voice |
| 56 |
| 57 #endif // IOS_CHROME_BROWSER_VOICE_SPEECH_INPUT_LOCALE_CONFIG_H_ |
| OLD | NEW |