Commit e2287c3e authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Don't hide the omnibox on incognito NTP

The omnibox should only be hidden on non-incognito NTP.

Fixed: 1090521
Change-Id: I521a466b92eb29ccbef78e90b4c6e02aedff091c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2236410
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Commit-Queue: David Jean <djean@chromium.org>
Reviewed-by: default avatarDavid Jean <djean@chromium.org>
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#777303}
parent f7c67226
......@@ -11,6 +11,7 @@
#include "base/mac/foundation_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/sys_string_conversions.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/ui/commands/command_dispatcher.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_controller.h"
......@@ -71,6 +72,8 @@
forProtocol:@protocol(FakeboxFocuser)];
self.viewController = [[PrimaryToolbarViewController alloc] init];
self.viewController.shouldHideOmniboxOnNTP =
!self.browser->GetBrowserState()->IsOffTheRecord();
self.viewController.buttonFactory = [self buttonFactoryWithType:PRIMARY];
// TODO(crbug.com/1045047): Use HandlerForProtocol after commands protocol
// clean up.
......
......@@ -21,6 +21,9 @@
@property(nonatomic, weak) id<PrimaryToolbarViewControllerDelegate> delegate;
// Whether the omnibox should be hidden on NTP.
@property(nonatomic, assign) BOOL shouldHideOmniboxOnNTP;
// Sets the location bar view controller, containing the omnibox.
- (void)setLocationBarViewController:(UIViewController*)locationBarView;
......
......@@ -164,10 +164,16 @@
return;
[super setIsNTP:isNTP];
_isNTP = isNTP;
if (!isNTP && !IsSplitToolbarMode(self)) {
if (IsSplitToolbarMode(self) || !self.shouldHideOmniboxOnNTP)
return;
// This is hiding/showing and positionning the omnibox. This is only needed
// if the omnibox should be hidden when there is only one toolbar.
if (!isNTP) {
// Reset any location bar view updates when not an NTP.
[self setScrollProgressForTabletOmnibox:1];
} else if (isNTP && !IsSplitToolbarMode(self)) {
} else {
// Hides the omnibox.
[self setScrollProgressForTabletOmnibox:0];
}
}
......
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