0

[ios] Don't rely on nil webState in LocationBarCoordinator.

Bug: 934294
Change-Id: I3737b1560f138250206f9f1b8648d32ada9f0392
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1520702
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#641002}
This commit is contained in:
Justin Cohen
2019-03-15 00:05:25 +00:00
committed by Commit Bot
parent 532802dbc6
commit 012cf25029

@@ -270,10 +270,12 @@ const int kLocationAuthorizationStatusCount = 4;
- (void)focusOmniboxFromSearchButton { - (void)focusOmniboxFromSearchButton {
// TODO(crbug.com/931284): Temporary workaround for intermediate broken state // TODO(crbug.com/931284): Temporary workaround for intermediate broken state
// in the NTP. Remove this once crbug.com/899827 is fixed. // in the NTP. Remove this once crbug.com/899827 is fixed.
NewTabPageTabHelper* NTPHelper = if (self.webState) {
NewTabPageTabHelper::FromWebState(self.webState); NewTabPageTabHelper* NTPHelper =
if (NTPHelper && NTPHelper->IsActive() && NTPHelper->IgnoreLoadRequests()) { NewTabPageTabHelper::FromWebState(self.webState);
return; if (NTPHelper && NTPHelper->IsActive() && NTPHelper->IgnoreLoadRequests()) {
return;
}
} }
[self.omniboxCoordinator setNextFocusSourceAsSearchButton]; [self.omniboxCoordinator setNextFocusSourceAsSearchButton];
[self focusOmnibox]; [self focusOmnibox];
@@ -286,10 +288,12 @@ const int kLocationAuthorizationStatusCount = 4;
- (void)focusOmnibox { - (void)focusOmnibox {
// TODO(crbug.com/931284): Temporary workaround for intermediate broken state // TODO(crbug.com/931284): Temporary workaround for intermediate broken state
// in the NTP. Remove this once crbug.com/899827 is fixed. // in the NTP. Remove this once crbug.com/899827 is fixed.
NewTabPageTabHelper* NTPHelper = if (self.webState) {
NewTabPageTabHelper::FromWebState(self.webState); NewTabPageTabHelper* NTPHelper =
if (NTPHelper && NTPHelper->IsActive() && NTPHelper->IgnoreLoadRequests()) { NewTabPageTabHelper::FromWebState(self.webState);
return; if (NTPHelper && NTPHelper->IsActive() && NTPHelper->IgnoreLoadRequests()) {
return;
}
} }
// Dismiss the edit menu. // Dismiss the edit menu.
[[UIMenuController sharedMenuController] setMenuVisible:NO animated:NO]; [[UIMenuController sharedMenuController] setMenuVisible:NO animated:NO];