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 #include "ios/chrome/browser/voice/speech_input_locale_config_impl.h" | 5 #include "ios/chrome/browser/voice/speech_input_locale_config_impl.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
11 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
14 #import "ios/chrome/browser/voice/speech_input_locale_match_config.h" | 14 #import "ios/chrome/browser/voice/speech_input_locale_match_config.h" |
15 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 15 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
16 #include "ios/public/provider/chrome/browser/voice/voice_search_language.h" | 16 #include "ios/public/provider/chrome/browser/voice/voice_search_language.h" |
17 #include "ios/public/provider/chrome/browser/voice/voice_search_provider.h" | 17 #include "ios/public/provider/chrome/browser/voice/voice_search_provider.h" |
18 | 18 |
| 19 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 20 #error "This file requires ARC support." |
| 21 #endif |
| 22 |
19 namespace { | 23 namespace { |
20 | 24 |
21 // Returns the language portion of |locale_code|. | 25 // Returns the language portion of |locale_code|. |
22 std::string GetLanguageComponentForLocaleCode(const std::string& locale_code) { | 26 std::string GetLanguageComponentForLocaleCode(const std::string& locale_code) { |
23 std::vector<std::string> tokens = base::SplitString( | 27 std::vector<std::string> tokens = base::SplitString( |
24 locale_code, "-", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 28 locale_code, "-", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
25 if (tokens.empty()) | 29 if (tokens.empty()) |
26 return std::string(); | 30 return std::string(); |
27 return tokens[0]; | 31 return tokens[0]; |
28 } | 32 } |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 190 } |
187 } | 191 } |
188 } | 192 } |
189 } | 193 } |
190 | 194 |
191 void SpeechInputLocaleConfigImpl::InitializeTextToSpeechLangauges() { | 195 void SpeechInputLocaleConfigImpl::InitializeTextToSpeechLangauges() { |
192 text_to_speech_languages_ = {"de", "en", "es", "fr", "it", "ja", "ko"}; | 196 text_to_speech_languages_ = {"de", "en", "es", "fr", "it", "ja", "ko"}; |
193 } | 197 } |
194 | 198 |
195 } // namespace voice | 199 } // namespace voice |
OLD | NEW |