Commit 030bb2f4 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Always show the swipe curtain with slim navigation enabled.

Bug: 820036
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I3a7a713b90cfb314685b680cbf476d115a9c3771
Reviewed-on: https://chromium-review.googlesource.com/1101246
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarDanyao Wang <danyao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567664}
parent 90f87878
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#import "ios/chrome/browser/ui/toolbar/public/side_swipe_toolbar_interacting.h" #import "ios/chrome/browser/ui/toolbar/public/side_swipe_toolbar_interacting.h"
#include "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/browser/ui/ui_util.h"
#import "ios/chrome/browser/web/page_placeholder_tab_helper.h" #import "ios/chrome/browser/web/page_placeholder_tab_helper.h"
#import "ios/web/public/web_client.h"
#import "ios/web/public/web_state/web_state_observer_bridge.h" #import "ios/web/public/web_state/web_state_observer_bridge.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
...@@ -471,7 +472,13 @@ const NSUInteger kIpadGreySwipeTabCount = 8; ...@@ -471,7 +472,13 @@ const NSUInteger kIpadGreySwipeTabCount = 8;
[currentContentProvider_ goForward:webState]; [currentContentProvider_ goForward:webState];
} }
if (webState && webState->IsLoading()) { // Checking -IsLoading() is likely incorrect, but to narrow the scope of
// fixes for slim navigation manager, only ignore this state when
// slim is disabled. With slim navigation enabled, this false when
// pages can be served from WKWebView's page cache.
if (webState &&
(web::GetWebClient()->IsSlimNavigationManagerEnabled() ||
webState->IsLoading())) {
scopedWebStateObserver_->RemoveAll(); scopedWebStateObserver_->RemoveAll();
scopedWebStateObserver_->Add(webState); scopedWebStateObserver_->Add(webState);
[self addCurtainWithCompletionHandler:^{ [self addCurtainWithCompletionHandler:^{
...@@ -578,7 +585,20 @@ const NSUInteger kIpadGreySwipeTabCount = 8; ...@@ -578,7 +585,20 @@ const NSUInteger kIpadGreySwipeTabCount = 8;
#pragma mark - CRWWebStateObserver Methods #pragma mark - CRWWebStateObserver Methods
// Checking -webStateDidStopLoading is likely incorrect, but to narrow the scope
// of fixes for slim navigation manager, only ignore this callback when slim is
// disabled.
- (void)webStateDidStopLoading:(web::WebState*)webState { - (void)webStateDidStopLoading:(web::WebState*)webState {
if (web::GetWebClient()->IsSlimNavigationManagerEnabled())
return;
[self dismissCurtainWithCompletionHandler:^{
inSwipe_ = NO;
}];
}
- (void)webState:(web::WebState*)webState didLoadPageWithSuccess:(BOOL)success {
if (!web::GetWebClient()->IsSlimNavigationManagerEnabled())
return;
[self dismissCurtainWithCompletionHandler:^{ [self dismissCurtainWithCompletionHandler:^{
inSwipe_ = NO; inSwipe_ = NO;
}]; }];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment