| 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/chrome/browser/tabs/tab.h" | 5 #import "ios/chrome/browser/tabs/tab.h" |
| 6 | 6 |
| 7 #import <CoreLocation/CoreLocation.h> | 7 #import <CoreLocation/CoreLocation.h> |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1978 | 1978 |
| 1979 - (void)setWebUsageEnabled:(BOOL)webUsageEnabled { | 1979 - (void)setWebUsageEnabled:(BOOL)webUsageEnabled { |
| 1980 [self.webController setWebUsageEnabled:webUsageEnabled]; | 1980 [self.webController setWebUsageEnabled:webUsageEnabled]; |
| 1981 } | 1981 } |
| 1982 | 1982 |
| 1983 - (void)webControllerDidSuppressDialog:(id)webController { | 1983 - (void)webControllerDidSuppressDialog:(id)webController { |
| 1984 DCHECK(isPrerenderTab_); | 1984 DCHECK(isPrerenderTab_); |
| 1985 [delegate_ discardPrerender]; | 1985 [delegate_ discardPrerender]; |
| 1986 } | 1986 } |
| 1987 | 1987 |
| 1988 - (CRWWebController*)webController:(CRWWebController*)webController | |
| 1989 createWebControllerForURL:(const GURL&)URL | |
| 1990 openerURL:(const GURL&)openerURL | |
| 1991 initiatedByUser:(BOOL)initiatedByUser { | |
| 1992 // Check if requested web controller is a popup and block it if necessary. | |
| 1993 if (!initiatedByUser) { | |
| 1994 web::WebState* webState = webController.webState; | |
| 1995 auto* helper = BlockedPopupTabHelper::FromWebState(webState); | |
| 1996 if (helper->ShouldBlockPopup(openerURL)) { | |
| 1997 web::NavigationItem* item = | |
| 1998 webState->GetNavigationManager()->GetLastCommittedItem(); | |
| 1999 web::Referrer referrer(openerURL, item->GetReferrer().policy); | |
| 2000 helper->HandlePopup(URL, referrer); | |
| 2001 return nil; | |
| 2002 } | |
| 2003 } | |
| 2004 | |
| 2005 // Requested web controller should not be blocked from opening. | |
| 2006 [self updateSnapshotWithOverlay:YES visibleFrameOnly:YES]; | |
| 2007 | |
| 2008 // Tabs open by DOM are always renderer initiated. | |
| 2009 web::NavigationManager::WebLoadParams params(GURL{}); | |
| 2010 params.transition_type = ui::PAGE_TRANSITION_LINK; | |
| 2011 params.is_renderer_initiated = YES; | |
| 2012 Tab* tab = [parentTabModel_ | |
| 2013 insertTabWithLoadParams:params | |
| 2014 opener:self | |
| 2015 openedByDOM:YES | |
| 2016 atIndex:TabModelConstants::kTabPositionAutomatically | |
| 2017 inBackground:NO]; | |
| 2018 return tab.webController; | |
| 2019 } | |
| 2020 | |
| 2021 - (CGFloat)headerHeightForWebController:(CRWWebController*)webController { | 1988 - (CGFloat)headerHeightForWebController:(CRWWebController*)webController { |
| 2022 return [self.tabHeadersDelegate headerHeightForTab:self]; | 1989 return [self.tabHeadersDelegate headerHeightForTab:self]; |
| 2023 } | 1990 } |
| 2024 | 1991 |
| 2025 - (void)webControllerDidUpdateSSLStatusForCurrentNavigationItem: | 1992 - (void)webControllerDidUpdateSSLStatusForCurrentNavigationItem: |
| 2026 (CRWWebController*)webController { | 1993 (CRWWebController*)webController { |
| 2027 // Disable fullscreen if SSL cert is invalid. | 1994 // Disable fullscreen if SSL cert is invalid. |
| 2028 web::NavigationItem* item = [self navigationManager]->GetTransientItem(); | 1995 web::NavigationItem* item = [self navigationManager]->GetTransientItem(); |
| 2029 web::SecurityStyle securityStyle = | 1996 web::SecurityStyle securityStyle = |
| 2030 item ? item->GetSSL().security_style : web::SECURITY_STYLE_UNKNOWN; | 1997 item ? item->GetSSL().security_style : web::SECURITY_STYLE_UNKNOWN; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2217 | 2184 |
| 2218 - (TabModel*)parentTabModel { | 2185 - (TabModel*)parentTabModel { |
| 2219 return parentTabModel_; | 2186 return parentTabModel_; |
| 2220 } | 2187 } |
| 2221 | 2188 |
| 2222 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2189 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2223 return inputAccessoryViewController_.get(); | 2190 return inputAccessoryViewController_.get(); |
| 2224 } | 2191 } |
| 2225 | 2192 |
| 2226 @end | 2193 @end |
| OLD | NEW |