Chromium Code Reviews| 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..efe02f31dd752fec31ef796c46417d90decd1106 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 @@ @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. |
|
Eugene But (OOO till 7-30)
2017/02/23 18:00:12
s/currently visible page/visibleItem
Because curr
liaoyuke
2017/02/23 18:37:11
Done.
|
| +@property(nonatomic, readonly) BOOL usesDesktopUserAgent; |
| // Facade for Mojo API. |
| @property(nonatomic, readonly) web::MojoFacade* mojoFacade; |
| @@ -2339,9 +2339,13 @@ - (BOOL)shouldClosePageOnNativeApplicationLoad { |
| return rendererInitiatedWithoutInteraction || noNavigationItems; |
| } |
| -- (BOOL)useDesktopUserAgent { |
| - web::NavigationItem* item = [self currentNavItem]; |
| - return item && item->IsOverridingUserAgent(); |
| +- (BOOL)usesDesktopUserAgent { |
| + if (!self.navigationManagerImpl) |
| + return NO; |
| + |
| + web::NavigationItem* visibleItem = |
| + self.navigationManagerImpl->GetVisibleItem(); |
| + return visibleItem && visibleItem->IsOverridingUserAgent(); |
| } |
| - (web::MojoFacade*)mojoFacade { |
| @@ -4214,7 +4218,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 { |