OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/content_settings_collection_view_control
ler.h" | 5 #import "ios/chrome/browser/ui/settings/content_settings_collection_view_control
ler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "components/content_settings/core/browser/host_content_settings_map.h" | 8 #include "components/content_settings/core/browser/host_content_settings_map.h" |
9 #include "components/content_settings/core/common/content_settings.h" | 9 #include "components/content_settings/core/common/content_settings.h" |
10 #include "components/content_settings/core/common/content_settings_types.h" | 10 #include "components/content_settings/core/common/content_settings_types.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 178 } |
179 | 179 |
180 #pragma mark - PrefObserverDelegate | 180 #pragma mark - PrefObserverDelegate |
181 | 181 |
182 - (void)onPreferenceChanged:(const std::string&)preferenceName { | 182 - (void)onPreferenceChanged:(const std::string&)preferenceName { |
183 if (preferenceName == prefs::kEnableTranslate) { | 183 if (preferenceName == prefs::kEnableTranslate) { |
184 BOOL enabled = browserState_->GetPrefs()->GetBoolean(preferenceName); | 184 BOOL enabled = browserState_->GetPrefs()->GetBoolean(preferenceName); |
185 NSString* subtitle = enabled ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) | 185 NSString* subtitle = enabled ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) |
186 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); | 186 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); |
187 _translateDetailItem.detailText = subtitle; | 187 _translateDetailItem.detailText = subtitle; |
188 [self reconfigureCellsForItems:@[ _translateDetailItem ] | 188 [self reconfigureCellsForItems:@[ _translateDetailItem ]]; |
189 inSectionWithIdentifier:SectionIdentifierSettings]; | |
190 } | 189 } |
191 } | 190 } |
192 | 191 |
193 #pragma mark - BooleanObserver | 192 #pragma mark - BooleanObserver |
194 | 193 |
195 - (void)booleanDidChange:(id<ObservableBoolean>)observableBoolean { | 194 - (void)booleanDidChange:(id<ObservableBoolean>)observableBoolean { |
196 DCHECK_EQ(observableBoolean, _disablePopupsSetting); | 195 DCHECK_EQ(observableBoolean, _disablePopupsSetting); |
197 | 196 |
198 NSString* subtitle = [_disablePopupsSetting value] | 197 NSString* subtitle = [_disablePopupsSetting value] |
199 ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) | 198 ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) |
200 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); | 199 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); |
201 // Update the item. | 200 // Update the item. |
202 _blockPopupsDetailItem.detailText = subtitle; | 201 _blockPopupsDetailItem.detailText = subtitle; |
203 | 202 |
204 // Update the cell. | 203 // Update the cell. |
205 [self reconfigureCellsForItems:@[ _blockPopupsDetailItem ] | 204 [self reconfigureCellsForItems:@[ _blockPopupsDetailItem ]]; |
206 inSectionWithIdentifier:SectionIdentifierSettings]; | |
207 } | 205 } |
208 | 206 |
209 @end | 207 @end |
OLD | NEW |