OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/web/web_state/ui/crw_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
6 | 6 |
7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
8 | 8 |
9 #import <objc/runtime.h> | 9 #import <objc/runtime.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 2333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2344 // the page has no navigation items, as occurs when an App Store link is | 2344 // the page has no navigation items, as occurs when an App Store link is |
2345 // opened from another application. | 2345 // opened from another application. |
2346 BOOL rendererInitiatedWithoutInteraction = | 2346 BOOL rendererInitiatedWithoutInteraction = |
2347 self.sessionController.openedByDOM && !_userInteractedWithWebController; | 2347 self.sessionController.openedByDOM && !_userInteractedWithWebController; |
2348 BOOL noNavigationItems = !(self.navigationManagerImpl->GetItemCount()); | 2348 BOOL noNavigationItems = !(self.navigationManagerImpl->GetItemCount()); |
2349 return rendererInitiatedWithoutInteraction || noNavigationItems; | 2349 return rendererInitiatedWithoutInteraction || noNavigationItems; |
2350 } | 2350 } |
2351 | 2351 |
2352 - (BOOL)usesDesktopUserAgent { | 2352 - (BOOL)usesDesktopUserAgent { |
2353 web::NavigationItem* item = [self currentNavItem]; | 2353 web::NavigationItem* item = [self currentNavItem]; |
2354 return item && item->IsOverridingUserAgent(); | 2354 return item && item->GetUserAgentType() == web::UserAgentType::DESKTOP; |
2355 } | 2355 } |
2356 | 2356 |
2357 - (web::MojoFacade*)mojoFacade { | 2357 - (web::MojoFacade*)mojoFacade { |
2358 if (!_mojoFacade) { | 2358 if (!_mojoFacade) { |
2359 service_manager::mojom::InterfaceProvider* interfaceProvider = | 2359 service_manager::mojom::InterfaceProvider* interfaceProvider = |
2360 _webStateImpl->GetMojoInterfaceRegistry(); | 2360 _webStateImpl->GetMojoInterfaceRegistry(); |
2361 _mojoFacade.reset(new web::MojoFacade(interfaceProvider, self)); | 2361 _mojoFacade.reset(new web::MojoFacade(interfaceProvider, self)); |
2362 } | 2362 } |
2363 return _mojoFacade.get(); | 2363 return _mojoFacade.get(); |
2364 } | 2364 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2396 fromEntry:fromEntry]; | 2396 fromEntry:fromEntry]; |
2397 [_delegate webWillFinishHistoryNavigationFromEntry:fromEntry]; | 2397 [_delegate webWillFinishHistoryNavigationFromEntry:fromEntry]; |
2398 } | 2398 } |
2399 | 2399 |
2400 - (void)updateDesktopUserAgentForEntry:(CRWSessionEntry*)entry | 2400 - (void)updateDesktopUserAgentForEntry:(CRWSessionEntry*)entry |
2401 fromEntry:(CRWSessionEntry*)fromEntry { | 2401 fromEntry:(CRWSessionEntry*)fromEntry { |
2402 web::NavigationItemImpl* item = entry.navigationItemImpl; | 2402 web::NavigationItemImpl* item = entry.navigationItemImpl; |
2403 web::NavigationItemImpl* fromItem = fromEntry.navigationItemImpl; | 2403 web::NavigationItemImpl* fromItem = fromEntry.navigationItemImpl; |
2404 if (!item || !fromItem) | 2404 if (!item || !fromItem) |
2405 return; | 2405 return; |
2406 bool useDesktopUserAgent = item->IsOverridingUserAgent(); | 2406 if (item->GetUserAgentType() != fromItem->GetUserAgentType()) |
Eugene But (OOO till 7-30)
2017/02/25 01:51:52
If new UA is NONE, then page reconstruction is unn
kkhorimoto
2017/02/27 23:29:04
Done.
| |
2407 if (useDesktopUserAgent != fromItem->IsOverridingUserAgent()) { | |
2408 [self requirePageReconstruction]; | 2407 [self requirePageReconstruction]; |
2409 } | |
2410 } | 2408 } |
2411 | 2409 |
2412 #pragma mark - | 2410 #pragma mark - |
2413 #pragma mark CRWWebControllerContainerViewDelegate | 2411 #pragma mark CRWWebControllerContainerViewDelegate |
2414 | 2412 |
2415 - (CRWWebViewProxyImpl*)contentViewProxyForContainerView: | 2413 - (CRWWebViewProxyImpl*)contentViewProxyForContainerView: |
2416 (CRWWebControllerContainerView*)containerView { | 2414 (CRWWebControllerContainerView*)containerView { |
2417 return _webViewProxy.get(); | 2415 return _webViewProxy.get(); |
2418 } | 2416 } |
2419 | 2417 |
(...skipping 2828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5248 - (void)simulateLoadRequestWithURL:(const GURL&)URL { | 5246 - (void)simulateLoadRequestWithURL:(const GURL&)URL { |
5249 _lastRegisteredRequestURL = URL; | 5247 _lastRegisteredRequestURL = URL; |
5250 _loadPhase = web::LOAD_REQUESTED; | 5248 _loadPhase = web::LOAD_REQUESTED; |
5251 } | 5249 } |
5252 | 5250 |
5253 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5251 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
5254 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5252 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
5255 } | 5253 } |
5256 | 5254 |
5257 @end | 5255 @end |
OLD | NEW |