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 #import "ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean.h" | 5 #import "ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean.h" |
6 | 6 |
7 #import "base/ios/weak_nsobject.h" | |
8 #include "base/scoped_observer.h" | 7 #include "base/scoped_observer.h" |
9 #include "components/content_settings/core/browser/content_settings_details.h" | 8 #include "components/content_settings/core/browser/content_settings_details.h" |
10 #include "components/content_settings/core/browser/content_settings_observer.h" | 9 #include "components/content_settings/core/browser/content_settings_observer.h" |
11 #include "components/content_settings/core/browser/host_content_settings_map.h" | 10 #include "components/content_settings/core/browser/host_content_settings_map.h" |
12 #include "components/content_settings/core/common/content_settings.h" | 11 #include "components/content_settings/core/common/content_settings.h" |
13 #include "components/content_settings/core/common/content_settings_types.h" | 12 #include "components/content_settings/core/common/content_settings_types.h" |
14 | 13 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." |
| 16 #endif |
| 17 |
15 @interface ContentSettingBackedBoolean () | 18 @interface ContentSettingBackedBoolean () |
16 | 19 |
17 // The ID of the setting in |settingsMap|. | 20 // The ID of the setting in |settingsMap|. |
18 @property(nonatomic, readonly) ContentSettingsType settingID; | 21 @property(nonatomic, readonly) ContentSettingsType settingID; |
19 | 22 |
20 // Whether the boolean value reflects the state of the preference that backs it, | 23 // Whether the boolean value reflects the state of the preference that backs it, |
21 // or its negation. | 24 // or its negation. |
22 @property(nonatomic, assign, getter=isInverted) BOOL inverted; | 25 @property(nonatomic, assign, getter=isInverted) BOOL inverted; |
23 | 26 |
24 // Whether this object is the one modifying the content setting. Used to filter | 27 // Whether this object is the one modifying the content setting. Used to filter |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 119 |
117 - (void)setValue:(BOOL)value { | 120 - (void)setValue:(BOOL)value { |
118 ContentSetting setting = | 121 ContentSetting setting = |
119 (self.inverted ^ value) ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 122 (self.inverted ^ value) ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
120 self.isModifyingContentSetting = YES; | 123 self.isModifyingContentSetting = YES; |
121 settingsMap_->SetDefaultContentSetting(settingID_, setting); | 124 settingsMap_->SetDefaultContentSetting(settingID_, setting); |
122 self.isModifyingContentSetting = NO; | 125 self.isModifyingContentSetting = NO; |
123 } | 126 } |
124 | 127 |
125 @end | 128 @end |
OLD | NEW |