Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: ios/chrome/browser/ui/browser_view_controller.mm

Issue 2779263002: Set user agent type of transient item the same as pending item. (Closed)
Patch Set: Address comments and add unit tests Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/tabs/tab.mm ('k') | ios/web/interstitials/web_interstitial_impl.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/browser_view_controller.mm
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm
index 4f586b25a365809c32a46dcda2b3a0da7f966b93..def98c5910ccf956f91682776318c9cd4f772a51 100644
--- a/ios/chrome/browser/ui/browser_view_controller.mm
+++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -1095,12 +1095,19 @@ - (BOOL)canShowFindBar {
web::WebState* webState = [_model currentTab].webState;
if (!webState)
return web::UserAgentType::NONE;
- web::NavigationItem* visibleItem =
- webState->GetNavigationManager()->GetVisibleItem();
- if (!visibleItem)
+
+ // TODO(crbug.com/707081): Clean this up once the bug is fixed.
Eugene But (OOO till 7-30) 2017/03/31 18:06:40 We should not land this code duplication, unless w
liaoyuke 2017/03/31 18:29:03 Makes sense! I'll just keep this piece of code as
+ web::NavigationItem* item =
+ webState->GetNavigationManager()->GetTransientItem();
+ if (!item)
+ item = webState->GetNavigationManager()->GetPendingItem();
+ if (!item)
+ item = webState->GetNavigationManager()->GetLastCommittedItem();
+
+ if (!item)
return web::UserAgentType::NONE;
- return visibleItem->GetUserAgentType();
+ return item->GetUserAgentType();
}
- (void)setVisible:(BOOL)visible {
« no previous file with comments | « ios/chrome/browser/tabs/tab.mm ('k') | ios/web/interstitials/web_interstitial_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698