OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/chrome/browser/ui/settings/voicesearch_collection_view_controller.h
" | 5 #import "ios/chrome/browser/ui/settings/voicesearch_collection_view_controller.h
" |
6 | 6 |
7 #import "base/ios/weak_nsobject.h" | 7 #import "base/ios/weak_nsobject.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 BOOL on = enabled && _ttsEnabled.GetValue(); | 231 BOOL on = enabled && _ttsEnabled.GetValue(); |
232 | 232 |
233 UISwitch* switchView = switchCell.switchView; | 233 UISwitch* switchView = switchCell.switchView; |
234 switchView.enabled = enabled; | 234 switchView.enabled = enabled; |
235 switchCell.textLabel.textColor = | 235 switchCell.textLabel.textColor = |
236 [CollectionViewSwitchCell defaultTextColorForState:switchView.state]; | 236 [CollectionViewSwitchCell defaultTextColorForState:switchView.state]; |
237 if (on != switchView.isOn) { | 237 if (on != switchView.isOn) { |
238 [switchView setOn:on animated:YES]; | 238 [switchView setOn:on animated:YES]; |
239 } | 239 } |
240 | 240 |
241 [self reconfigureCellsForItems:modifiedItems | 241 [self reconfigureCellsForItems:modifiedItems]; |
242 inSectionWithIdentifier:SectionIdentifierLanguages]; | |
243 } | 242 } |
244 | 243 |
245 - (BOOL)currentLanguageSupportsTTS { | 244 - (BOOL)currentLanguageSupportsTTS { |
246 voice::SpeechInputLocaleConfig* localeConfig = | 245 voice::SpeechInputLocaleConfig* localeConfig = |
247 voice::SpeechInputLocaleConfig::GetInstance(); | 246 voice::SpeechInputLocaleConfig::GetInstance(); |
248 std::string localeCode = _selectedLanguage.GetValue().empty() | 247 std::string localeCode = _selectedLanguage.GetValue().empty() |
249 ? localeConfig->GetDefaultLocale().code | 248 ? localeConfig->GetDefaultLocale().code |
250 : _selectedLanguage.GetValue(); | 249 : _selectedLanguage.GetValue(); |
251 return localeConfig->IsTextToSpeechEnabledForCode(localeCode); | 250 return localeConfig->IsTextToSpeechEnabledForCode(localeCode); |
252 } | 251 } |
253 | 252 |
254 @end | 253 @end |
OLD | NEW |