| 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 "ui/base/test/scoped_preferred_scroller_style_legacy_mac.h" | 5 #import "ui/base/test/scoped_preferred_scroller_style_legacy_mac.h" |
| 6 | 6 |
| 7 #import "base/mac/sdk_forward_declarations.h" | 7 #import "base/mac/sdk_forward_declarations.h" |
| 8 #import "base/mac/scoped_objc_class_swizzler.h" | 8 #import "base/mac/scoped_objc_class_swizzler.h" |
| 9 | 9 |
| 10 using base::mac::ScopedObjCClassSwizzler; | 10 using base::mac::ScopedObjCClassSwizzler; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 swizzler_.reset( | 43 swizzler_.reset( |
| 44 new ScopedObjCClassSwizzler([NSScroller class], | 44 new ScopedObjCClassSwizzler([NSScroller class], |
| 45 [FakeNSScrollerPreferredStyleDonor class], | 45 [FakeNSScrollerPreferredStyleDonor class], |
| 46 @selector(preferredScrollerStyle))); | 46 @selector(preferredScrollerStyle))); |
| 47 | 47 |
| 48 if (previous_style != NSScrollerStyleLegacy) | 48 if (previous_style != NSScrollerStyleLegacy) |
| 49 NotifyStyleChanged(); | 49 NotifyStyleChanged(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 ScopedPreferredScrollerStyleLegacy::~ScopedPreferredScrollerStyleLegacy() { | 52 ScopedPreferredScrollerStyleLegacy::~ScopedPreferredScrollerStyleLegacy() { |
| 53 if (!swizzler_) |
| 54 return; // Handle 10.6, which wouldn't have swizzled anything. |
| 55 |
| 53 swizzler_.reset(); | 56 swizzler_.reset(); |
| 54 | 57 |
| 55 if ([NSScroller preferredScrollerStyle] != NSScrollerStyleLegacy) | 58 if ([NSScroller preferredScrollerStyle] != NSScrollerStyleLegacy) |
| 56 NotifyStyleChanged(); | 59 NotifyStyleChanged(); |
| 57 } | 60 } |
| 58 | 61 |
| 59 } // namespace test | 62 } // namespace test |
| 60 } // namespace ui | 63 } // namespace ui |
| OLD | NEW |