Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/fullscreen_controller.h" | 5 #import "ios/chrome/browser/ui/fullscreen_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/objc_property_releaser.h" | 10 #include "base/mac/objc_property_releaser.h" |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 706 | 706 |
| 707 - (void)pageLoaded:(CRWWebController*)webController { | 707 - (void)pageLoaded:(CRWWebController*)webController { |
| 708 [self enableFullScreen]; | 708 [self enableFullScreen]; |
| 709 web::WebState* webState = webController.webState; | 709 web::WebState* webState = webController.webState; |
| 710 if (webState) { | 710 if (webState) { |
| 711 BOOL MIMETypeIsPDF = webState->GetContentsMimeType() == "application/pdf"; | 711 BOOL MIMETypeIsPDF = webState->GetContentsMimeType() == "application/pdf"; |
| 712 [webViewProxy_ setShouldUseInsetForTopPadding:MIMETypeIsPDF]; | 712 [webViewProxy_ setShouldUseInsetForTopPadding:MIMETypeIsPDF]; |
| 713 } | 713 } |
| 714 } | 714 } |
| 715 | 715 |
| 716 - (void)webControllerWillClose:(CRWWebController*)webController { | |
| 717 [webController removeObserver:self]; | |
|
rohitrao (ping after 24h)
2017/03/26 23:21:22
When is this observer removed instead?
sdefresne
2017/03/28 15:15:05
In Tab -onWebStateDestroyed:.
| |
| 718 } | |
| 719 | |
| 720 #pragma mark - | 716 #pragma mark - |
| 721 #pragma mark CRWWebViewScrollViewObserver | 717 #pragma mark CRWWebViewScrollViewObserver |
| 722 | 718 |
| 723 - (void)webViewScrollViewDidScroll: | 719 - (void)webViewScrollViewDidScroll: |
| 724 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { | 720 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { |
| 725 CGFloat previousRequestedContentOffset = | 721 CGFloat previousRequestedContentOffset = |
| 726 webViewScrollViewProxy.contentOffset.y; | 722 webViewScrollViewProxy.contentOffset.y; |
| 727 if ([self shouldIgnoreScroll:webViewScrollViewProxy]) { | 723 if ([self shouldIgnoreScroll:webViewScrollViewProxy]) { |
| 728 // Do not act on those events, just record the eventual move. | 724 // Do not act on those events, just record the eventual move. |
| 729 self.previousContentOffset = previousRequestedContentOffset; | 725 self.previousContentOffset = previousRequestedContentOffset; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 817 overscrollActionsInProgress_ = NO; | 813 overscrollActionsInProgress_ = NO; |
| 818 } | 814 } |
| 819 | 815 |
| 820 #pragma mark - Used for testing | 816 #pragma mark - Used for testing |
| 821 | 817 |
| 822 + (void)setEnabledForTests:(BOOL)enabled { | 818 + (void)setEnabledForTests:(BOOL)enabled { |
| 823 gEnabledForTests = enabled; | 819 gEnabledForTests = enabled; |
| 824 } | 820 } |
| 825 | 821 |
| 826 @end | 822 @end |
| OLD | NEW |