Chromium Code Reviews| Index: ios/chrome/browser/ui/voice/speech_input_locale_config.h |
| diff --git a/ios/chrome/browser/ui/voice/speech_input_locale_config.h b/ios/chrome/browser/ui/voice/speech_input_locale_config.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dc65e1086800f7fd691a113e5fc09337073ffa93 |
| --- /dev/null |
| +++ b/ios/chrome/browser/ui/voice/speech_input_locale_config.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2016 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 IOS_CHROME_BROWSER_UI_VOICE_SPEECH_INPUT_LOCALE_CONFIG_H_ |
| +#define IOS_CHROME_BROWSER_UI_VOICE_SPEECH_INPUT_LOCALE_CONFIG_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "ios/chrome/browser/ui/voice/speech_input_locale.h" |
| + |
| +namespace voice { |
| + |
| +class SpeechInputLocaleConfig; |
| + |
| +// Configuration object supplying information about valid locales for Voice |
| +// Search. |
| +class SpeechInputLocaleConfig { |
| + public: |
| + // Returns a pointer to the singleton object. |
| + static SpeechInputLocaleConfig* GetInstance(); |
| + |
| + // Returns the default locale as determined by the system language. |
| + virtual SpeechInputLocale GetDefaultLocale() = 0; |
|
sdefresne
2016/10/17 16:12:39
Can this method be const?
virtual SpeechInputLoca
rohitrao (ping after 24h)
2016/10/17 17:42:27
Done.
|
| + |
| + // Returns a reference to a vector of SpeechInputLocales sorted alphabetically |
| + // by their display names. |
| + virtual const std::vector<SpeechInputLocale>& GetAvailableLocales() = 0; |
|
sdefresne
2016/10/17 16:12:39
ditto, can this method be const?
rohitrao (ping after 24h)
2016/10/17 17:42:27
Done.
|
| + |
| + // Returns the SpeechInputLocale to use for |locale_code|. If |locale_code| is |
| + // not contained in GetAvailableLocales()'s return value, then the |
| + // SpeechInputLocaleConfig will attempt to match with an appropriate subsitute |
| + // (e.g. "en-NZ" => "en-AU"). |
| + virtual SpeechInputLocale GetLocaleForCode( |
|
sdefresne
2016/10/17 16:12:39
ditto, can this method be const?
rohitrao (ping after 24h)
2016/10/17 17:42:27
Done.
|
| + const std::string& locale_code) = 0; |
| + |
| + // Returns a reference to an alphabetically sorted vector containing language |
| + // codes (e.g. "en", "fr") that can be used to trigger Text To Speech results. |
| + virtual const std::vector<std::string>& GetTextToSpeechLanguages() = 0; |
|
sdefresne
2016/10/17 16:12:39
ditto, can this method be const?
rohitrao (ping after 24h)
2016/10/17 17:42:26
Done.
|
| + |
| + // Returns whether the language portion of |locale_code| is an available |
| + // TTS language. |
| + virtual bool IsTextToSpeechEnabledForCode(const std::string& locale_code) = 0; |
|
sdefresne
2016/10/17 16:12:39
ditto, can this method be const?
rohitrao (ping after 24h)
2016/10/17 17:42:27
Done.
|
| + |
| + protected: |
| + SpeechInputLocaleConfig(); |
|
sdefresne
2016/10/17 16:12:39
Can you use "= default" here and for the destructo
rohitrao (ping after 24h)
2016/10/17 17:42:26
Done.
|
| + virtual ~SpeechInputLocaleConfig(); |
| +}; |
|
sdefresne
2016/10/17 16:12:39
DISALLOW_COPY_AND_ASSIGN?
rohitrao (ping after 24h)
2016/10/17 17:42:27
Done.
|
| + |
| +} // namespace voice |
| + |
| +#endif // IOS_CHROME_BROWSER_UI_VOICE_SPEECH_INPUT_LOCALE_CONFIG_H_ |