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

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2711733007: Revert of (Set)IsOverridingUserAgent should be called on VisibleItem (Closed)
Patch Set: Created 3 years, 10 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/web/navigation/crw_session_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/crw_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index f12d786bc62c841f492660f42620f5e2da70832e..bfcc3f987101de631b9de34ac04db4e97a7df7ee 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -458,9 +458,9 @@
// Returns YES if the user interacted with the page recently.
@property(nonatomic, readonly) BOOL userClickedRecently;
-
-// Whether or not desktop user agent is used for the visibleItem.
-@property(nonatomic, readonly) BOOL usesDesktopUserAgent;
+// Returns whether the desktop user agent should be used when setting the user
+// agent.
+@property(nonatomic, readonly) BOOL useDesktopUserAgent;
// Facade for Mojo API.
@property(nonatomic, readonly) web::MojoFacade* mojoFacade;
@@ -2339,13 +2339,9 @@
return rendererInitiatedWithoutInteraction || noNavigationItems;
}
-- (BOOL)usesDesktopUserAgent {
- if (!self.navigationManagerImpl)
- return NO;
-
- web::NavigationItem* visibleItem =
- self.navigationManagerImpl->GetVisibleItem();
- return visibleItem && visibleItem->IsOverridingUserAgent();
+- (BOOL)useDesktopUserAgent {
+ web::NavigationItem* item = [self currentNavItem];
+ return item && item->IsOverridingUserAgent();
}
- (web::MojoFacade*)mojoFacade {
@@ -4218,7 +4214,7 @@
// delegate must be specified.
return web::BuildWKWebView(CGRectZero, config,
self.webStateImpl->GetBrowserState(),
- self.usesDesktopUserAgent);
+ [self useDesktopUserAgent]);
}
- (void)setWebView:(WKWebView*)webView {
« no previous file with comments | « ios/web/navigation/crw_session_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698