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

Unified Diff: ios/chrome/browser/tabs/tab.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
Index: ios/chrome/browser/tabs/tab.mm
diff --git a/ios/chrome/browser/tabs/tab.mm b/ios/chrome/browser/tabs/tab.mm
index 776f2a7b2de88d81f4e727a3c50a6541eb764fc1..4cfc3e7a7d5a72f8b88f6c3a3958bb4164e71dc1 100644
--- a/ios/chrome/browser/tabs/tab.mm
+++ b/ios/chrome/browser/tabs/tab.mm
@@ -1479,9 +1479,14 @@ - (BOOL)usesDesktopUserAgent {
if (!self.navigationManager)
return NO;
- web::NavigationItem* visibleItem = self.navigationManager->GetVisibleItem();
- return visibleItem &&
- visibleItem->GetUserAgentType() == web::UserAgentType::DESKTOP;
+ // TODO(crbug.com/707081): Clean this up once the bug is fixed.
+ web::NavigationItem* item = self.navigationManager->GetTransientItem();
+ if (!item)
+ item = self.navigationManager->GetPendingItem();
+ if (!item)
+ item = self.navigationManager->GetLastCommittedItem();
+
+ return item && item->GetUserAgentType() == web::UserAgentType::DESKTOP;
}
- (void)enableDesktopUserAgent {
« no previous file with comments | « no previous file | ios/chrome/browser/ui/browser_view_controller.mm » ('j') | ios/chrome/browser/ui/browser_view_controller.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698