Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: ios/chrome/browser/voice/speech_input_locale_config.h

Issue 2425713002: [ios] Adds configuration helper files for voice search. (Closed)
Patch Set: Review and file moves. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/voice/speech_input_locale_config.h
diff --git a/ios/chrome/browser/voice/speech_input_locale_config.h b/ios/chrome/browser/voice/speech_input_locale_config.h
new file mode 100644
index 0000000000000000000000000000000000000000..a8a5b48c989394ca0a3a804579131606156b5115
--- /dev/null
+++ b/ios/chrome/browser/voice/speech_input_locale_config.h
@@ -0,0 +1,57 @@
+// 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_VOICE_SPEECH_INPUT_LOCALE_CONFIG_H_
+#define IOS_CHROME_BROWSER_VOICE_SPEECH_INPUT_LOCALE_CONFIG_H_
+
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "ios/chrome/browser/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() const = 0;
+
+ // Returns a reference to a vector of SpeechInputLocales sorted alphabetically
+ // by their display names.
+ virtual const std::vector<SpeechInputLocale>& GetAvailableLocales() const = 0;
+
+ // 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(
+ const std::string& locale_code) const = 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() const = 0;
+
+ // Returns whether the language portion of |locale_code| is an available
+ // TTS language.
+ virtual bool IsTextToSpeechEnabledForCode(
+ const std::string& locale_code) const = 0;
+
+ protected:
+ SpeechInputLocaleConfig() = default;
+ virtual ~SpeechInputLocaleConfig() = default;
+
+ DISALLOW_COPY_AND_ASSIGN(SpeechInputLocaleConfig);
+};
+
+} // namespace voice
+
+#endif // IOS_CHROME_BROWSER_VOICE_SPEECH_INPUT_LOCALE_CONFIG_H_
« no previous file with comments | « ios/chrome/browser/voice/speech_input_locale.h ('k') | ios/chrome/browser/voice/speech_input_locale_config.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698