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

Focus the toolbar when tapping the fake omnibox

When the fake omnibox displayed on the NTP is tapped, the location bar
should become first responder.
This CL removes a check which was useless.

Bug: 790749, 791033, 791165
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: If1312ad12ada919de7c188e84836e54e32a47fad
Reviewed-on: https://chromium-review.googlesource.com/803317Reviewed-by: default avatarElodie Banel <lod@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521304}
parent b40fc335
......@@ -331,12 +331,14 @@
- (void)locationBarHasBecomeFirstResponder {
[self.delegate locationBarDidBecomeFirstResponder];
[self expandOmniboxAnimated:YES];
if (!self.toolbarViewController.expanded)
[self expandOmniboxAnimated:YES];
}
- (void)locationBarHasResignedFirstResponder {
[self.delegate locationBarDidResignFirstResponder];
[self contractOmnibox];
if (self.toolbarViewController.expanded)
[self contractOmnibox];
}
- (void)locationBarBeganEdit {
......@@ -355,8 +357,7 @@
#pragma mark - OmniboxFocuser
- (void)focusOmnibox {
if (!self.viewController.view.hidden)
[_locationBarView.textField becomeFirstResponder];
[_locationBarView.textField becomeFirstResponder];
}
- (void)cancelOmniboxEdit {
......@@ -531,6 +532,7 @@
curve:UIViewAnimationCurveEaseInOut
animations:^{
}];
[self.locationBarView addExpandOmniboxAnimations:animator];
[self.toolbarViewController addToolbarExpansionAnimations:animator];
[animator startAnimation];
......
......@@ -41,6 +41,8 @@
@property(nonatomic, strong) UIView* locationBarView;
// The ToolsMenu button.
@property(nonatomic, strong, readonly) ToolbarToolsMenuButton* toolsMenuButton;
// Whether the toolbar is in the expanded state or not.
@property(nonatomic, assign) BOOL expanded;
// Adds the toolbar expanded state animations to |animator|, and changes the
// toolbar constraints in preparation for the animation.
......
......@@ -68,6 +68,7 @@
@synthesize buttonFactory = _buttonFactory;
@synthesize buttonUpdater = _buttonUpdater;
@synthesize dispatcher = _dispatcher;
@synthesize expanded = _expanded;
@synthesize locationBarView = _locationBarView;
@synthesize stackView = _stackView;
@synthesize loading = _loading;
......@@ -117,6 +118,7 @@
[self setUpToolbarButtons];
[self setUpLocationBarContainer];
[self setUpProgressBar];
_expanded = NO;
}
return self;
}
......@@ -131,6 +133,7 @@
self.contractButton.hidden = NO;
self.contractButton.alpha = 1;
}];
self.expanded = YES;
}
- (void)addToolbarContractionAnimations:(UIViewPropertyAnimator*)animator {
......@@ -143,6 +146,7 @@
self.contractButton.hidden = YES;
self.contractButton.alpha = 0;
}];
self.expanded = NO;
}
- (void)updateForSideSwipeSnapshotOnNTP:(BOOL)onNTP {
......
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