Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: ios/web/web_state/ui/crw_web_view_scroll_view_proxy.mm

Issue 2876693006: Add -[CRWWebViewScrollViewObserver webViewScrollViewWillBeginZooming...] (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ui/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"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 202 }
203 }]; 203 }];
204 return shouldScrollToTop; 204 return shouldScrollToTop;
205 } 205 }
206 206
207 - (void)scrollViewDidZoom:(UIScrollView*)scrollView { 207 - (void)scrollViewDidZoom:(UIScrollView*)scrollView {
208 DCHECK_EQ(_scrollView, scrollView); 208 DCHECK_EQ(_scrollView, scrollView);
209 [_observers webViewScrollViewDidZoom:self]; 209 [_observers webViewScrollViewDidZoom:self];
210 } 210 }
211 211
212 - (void)scrollViewWillBeginZooming:(UIScrollView*)scrollView
213 withView:(UIView*)view {
214 DCHECK_EQ(_scrollView, scrollView);
215 [_observers webViewScrollViewWillBeginZooming:self];
216 }
217
212 #pragma mark - 218 #pragma mark -
213 219
214 + (NSArray*)scrollViewObserverKeyPaths { 220 + (NSArray*)scrollViewObserverKeyPaths {
215 return @[ @"contentSize" ]; 221 return @[ @"contentSize" ];
216 } 222 }
217 223
218 - (void)startObservingScrollView:(UIScrollView*)scrollView { 224 - (void)startObservingScrollView:(UIScrollView*)scrollView {
219 for (NSString* keyPath in [[self class] scrollViewObserverKeyPaths]) 225 for (NSString* keyPath in [[self class] scrollViewObserverKeyPaths])
220 [scrollView addObserver:self forKeyPath:keyPath options:0 context:nil]; 226 [scrollView addObserver:self forKeyPath:keyPath options:0 context:nil];
221 } 227 }
222 228
223 - (void)stopObservingScrollView:(UIScrollView*)scrollView { 229 - (void)stopObservingScrollView:(UIScrollView*)scrollView {
224 for (NSString* keyPath in [[self class] scrollViewObserverKeyPaths]) 230 for (NSString* keyPath in [[self class] scrollViewObserverKeyPaths])
225 [scrollView removeObserver:self forKeyPath:keyPath]; 231 [scrollView removeObserver:self forKeyPath:keyPath];
226 } 232 }
227 233
228 - (void)observeValueForKeyPath:(NSString*)keyPath 234 - (void)observeValueForKeyPath:(NSString*)keyPath
229 ofObject:(id)object 235 ofObject:(id)object
230 change:(NSDictionary*)change 236 change:(NSDictionary*)change
231 context:(void*)context { 237 context:(void*)context {
232 DCHECK_EQ(object, _scrollView); 238 DCHECK_EQ(object, _scrollView);
233 if ([keyPath isEqualToString:@"contentSize"]) 239 if ([keyPath isEqualToString:@"contentSize"])
234 [_observers webViewScrollViewDidResetContentSize:self]; 240 [_observers webViewScrollViewDidResetContentSize:self];
235 } 241 }
236 242
237 @end 243 @end
OLDNEW
« no previous file with comments | « ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698