| 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/pref_backed_boolean.h" | 5 #import "ios/chrome/browser/ui/settings/utils/pref_backed_boolean.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "components/prefs/pref_member.h" | 8 #include "components/prefs/pref_member.h" |
| 9 #include "components/prefs/pref_service.h" | 9 #include "components/prefs/pref_service.h" |
| 10 | 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." |
| 13 #endif |
| 14 |
| 11 namespace { | 15 namespace { |
| 12 | 16 |
| 13 // Adaptor function to allow invoking onChange as a base::Closure. | 17 // Adaptor function to allow invoking onChange as a base::Closure. |
| 14 void OnChange(id<ObservableBoolean> object) { | 18 void OnChange(id<ObservableBoolean> object) { |
| 15 [object.observer booleanDidChange:object]; | 19 [object.observer booleanDidChange:object]; |
| 16 } | 20 } |
| 17 | 21 |
| 18 } // namespace | 22 } // namespace |
| 19 | 23 |
| 20 @implementation PrefBackedBoolean { | 24 @implementation PrefBackedBoolean { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 40 | 44 |
| 41 - (BOOL)value { | 45 - (BOOL)value { |
| 42 return _pref.GetValue(); | 46 return _pref.GetValue(); |
| 43 } | 47 } |
| 44 | 48 |
| 45 - (void)setValue:(BOOL)value { | 49 - (void)setValue:(BOOL)value { |
| 46 _pref.SetValue(value == YES); | 50 _pref.SetValue(value == YES); |
| 47 } | 51 } |
| 48 | 52 |
| 49 @end | 53 @end |
| OLD | NEW |