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

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

Issue 2711683002: (Set)IsOverridingUserAgent should be called on VisibleItem (Closed)
Patch Set: Update function name 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
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 bfcc3f987101de631b9de34ac04db4e97a7df7ee..5edd932196b90dafb0671c4b8c302035df66ef82 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -458,9 +458,10 @@ @interface CRWWebController ()<CRWContextMenuDelegate,
// Returns YES if the user interacted with the page recently.
@property(nonatomic, readonly) BOOL userClickedRecently;
-// Returns whether the desktop user agent should be used when setting the user
-// agent.
-@property(nonatomic, readonly) BOOL useDesktopUserAgent;
+
+// Whether or not desktop user agent is used for the currently visible page.
+@property(nonatomic, readonly, getter=isUsingDesktopUserAgent)
Eugene But (OOO till 7-30) 2017/02/23 02:36:59 Same comment here.
liaoyuke 2017/02/23 17:50:42 Done.
+ BOOL usesDesktopUserAgent;
// Facade for Mojo API.
@property(nonatomic, readonly) web::MojoFacade* mojoFacade;
@@ -2339,9 +2340,11 @@ - (BOOL)shouldClosePageOnNativeApplicationLoad {
return rendererInitiatedWithoutInteraction || noNavigationItems;
}
-- (BOOL)useDesktopUserAgent {
- web::NavigationItem* item = [self currentNavItem];
- return item && item->IsOverridingUserAgent();
+- (BOOL)isUsingDesktopUserAgent {
+ web::NavigationItem* visibleItem =
Eugene But (OOO till 7-30) 2017/02/23 02:36:59 nit: How about this?: if (!self.navigationManager
liaoyuke 2017/02/23 17:50:42 Done.
+ self.navigationManagerImpl ? self.navigationManagerImpl->GetVisibleItem()
+ : nil;
+ return visibleItem && visibleItem->IsOverridingUserAgent();
}
- (web::MojoFacade*)mojoFacade {
@@ -4214,7 +4217,7 @@ - (WKWebView*)webViewWithConfiguration:(WKWebViewConfiguration*)config {
// delegate must be specified.
return web::BuildWKWebView(CGRectZero, config,
self.webStateImpl->GetBrowserState(),
- [self useDesktopUserAgent]);
+ self.usesDesktopUserAgent);
}
- (void)setWebView:(WKWebView*)webView {
« ios/chrome/browser/tabs/tab.h ('K') | « 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