| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/web/public/web_state/crw_web_view_scroll_view_proxy.h" | 5 #import "ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #import "base/ios/crb_protocol_observers.h" | 10 #import "base/ios/crb_protocol_observers.h" |
| 11 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
| 12 #import "base/mac/scoped_nsobject.h" | 12 #import "base/mac/scoped_nsobject.h" |
| 13 | 13 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) | 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." | 15 #error "This file requires ARC support." |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 - (void)scrollViewDidEndScrollingAnimation:(UIScrollView*)scrollView { | 185 - (void)scrollViewDidEndScrollingAnimation:(UIScrollView*)scrollView { |
| 186 DCHECK_EQ(_scrollView, scrollView); | 186 DCHECK_EQ(_scrollView, scrollView); |
| 187 [_observers webViewScrollViewDidEndScrollingAnimation:self]; | 187 [_observers webViewScrollViewDidEndScrollingAnimation:self]; |
| 188 } | 188 } |
| 189 | 189 |
| 190 - (BOOL)scrollViewShouldScrollToTop:(UIScrollView*)scrollView { | 190 - (BOOL)scrollViewShouldScrollToTop:(UIScrollView*)scrollView { |
| 191 DCHECK_EQ(_scrollView, scrollView); | 191 DCHECK_EQ(_scrollView, scrollView); |
| 192 __block BOOL shouldScrollToTop = YES; | 192 __block BOOL shouldScrollToTop = YES; |
| 193 [_observers executeOnObservers:^(id observer) { | 193 [_observers executeOnObservers:^(id observer) { |
| 194 if ([observer respondsToSelector:@selector( | 194 if ([observer respondsToSelector:@selector |
| 195 webViewScrollViewShouldScrollToTop:)]) { | 195 (webViewScrollViewShouldScrollToTop:)]) { |
| 196 shouldScrollToTop = shouldScrollToTop && | 196 shouldScrollToTop = shouldScrollToTop && |
| 197 [observer webViewScrollViewShouldScrollToTop:self]; | 197 [observer webViewScrollViewShouldScrollToTop:self]; |
| 198 } | 198 } |
| 199 }]; | 199 }]; |
| 200 return shouldScrollToTop; | 200 return shouldScrollToTop; |
| 201 } | 201 } |
| 202 | 202 |
| 203 - (void)scrollViewDidZoom:(UIScrollView*)scrollView { | 203 - (void)scrollViewDidZoom:(UIScrollView*)scrollView { |
| 204 DCHECK_EQ(_scrollView, scrollView); | 204 DCHECK_EQ(_scrollView, scrollView); |
| 205 [_observers webViewScrollViewDidZoom:self]; | 205 [_observers webViewScrollViewDidZoom:self]; |
| 206 } | 206 } |
| 207 | 207 |
| 208 #pragma mark - | 208 #pragma mark - |
| (...skipping 15 matching lines...) Expand all Loading... |
| 224 - (void)observeValueForKeyPath:(NSString*)keyPath | 224 - (void)observeValueForKeyPath:(NSString*)keyPath |
| 225 ofObject:(id)object | 225 ofObject:(id)object |
| 226 change:(NSDictionary*)change | 226 change:(NSDictionary*)change |
| 227 context:(void*)context { | 227 context:(void*)context { |
| 228 DCHECK_EQ(object, _scrollView); | 228 DCHECK_EQ(object, _scrollView); |
| 229 if ([keyPath isEqualToString:@"contentSize"]) | 229 if ([keyPath isEqualToString:@"contentSize"]) |
| 230 [_observers webViewScrollViewDidResetContentSize:self]; | 230 [_observers webViewScrollViewDidResetContentSize:self]; |
| 231 } | 231 } |
| 232 | 232 |
| 233 @end | 233 @end |
| OLD | NEW |