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

Side by Side Diff: ios/chrome/browser/tabs/tab.mm

Issue 2737943003: Moved window opening callback to WebStateDelegate. (Closed)
Patch Set: Self review Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 1995
1996 - (void)setWebUsageEnabled:(BOOL)webUsageEnabled { 1996 - (void)setWebUsageEnabled:(BOOL)webUsageEnabled {
1997 [self.webController setWebUsageEnabled:webUsageEnabled]; 1997 [self.webController setWebUsageEnabled:webUsageEnabled];
1998 } 1998 }
1999 1999
2000 - (void)webControllerDidSuppressDialog:(id)webController { 2000 - (void)webControllerDidSuppressDialog:(id)webController {
2001 DCHECK(isPrerenderTab_); 2001 DCHECK(isPrerenderTab_);
2002 [delegate_ discardPrerender]; 2002 [delegate_ discardPrerender];
2003 } 2003 }
2004 2004
2005 - (CRWWebController*)webController:(CRWWebController*)webController
2006 createWebControllerForURL:(const GURL&)URL
2007 openerURL:(const GURL&)openerURL
2008 initiatedByUser:(BOOL)initiatedByUser {
2009 // Check if requested web controller is a popup and block it if necessary.
2010 if (!initiatedByUser) {
2011 web::WebState* webState = webController.webState;
2012 auto* helper = BlockedPopupTabHelper::FromWebState(webState);
2013 if (helper->ShouldBlockPopup(openerURL)) {
2014 web::NavigationItem* item =
2015 webState->GetNavigationManager()->GetLastCommittedItem();
2016 web::Referrer referrer(openerURL, item->GetReferrer().policy);
2017 helper->HandlePopup(URL, referrer);
2018 return nil;
2019 }
2020 }
2021
2022 // Requested web controller should not be blocked from opening.
2023 [self updateSnapshotWithOverlay:YES visibleFrameOnly:YES];
2024
2025 // Tabs open by DOM are always renderer initiated.
2026 web::NavigationManager::WebLoadParams params(GURL{});
2027 params.transition_type = ui::PAGE_TRANSITION_LINK;
2028 params.is_renderer_initiated = YES;
2029 Tab* tab = [parentTabModel_
2030 insertTabWithLoadParams:params
2031 opener:self
2032 openedByDOM:YES
2033 atIndex:TabModelConstants::kTabPositionAutomatically
2034 inBackground:NO];
2035 return tab.webController;
2036 }
2037
2038 - (CGFloat)headerHeightForWebController:(CRWWebController*)webController { 2005 - (CGFloat)headerHeightForWebController:(CRWWebController*)webController {
2039 return [self.tabHeadersDelegate headerHeightForTab:self]; 2006 return [self.tabHeadersDelegate headerHeightForTab:self];
2040 } 2007 }
2041 2008
2042 - (void)webControllerDidUpdateSSLStatusForCurrentNavigationItem: 2009 - (void)webControllerDidUpdateSSLStatusForCurrentNavigationItem:
2043 (CRWWebController*)webController { 2010 (CRWWebController*)webController {
2044 // Disable fullscreen if SSL cert is invalid. 2011 // Disable fullscreen if SSL cert is invalid.
2045 web::NavigationItem* item = [self navigationManager]->GetTransientItem(); 2012 web::NavigationItem* item = [self navigationManager]->GetTransientItem();
2046 web::SecurityStyle securityStyle = 2013 web::SecurityStyle securityStyle =
2047 item ? item->GetSSL().security_style : web::SECURITY_STYLE_UNKNOWN; 2014 item ? item->GetSSL().security_style : web::SECURITY_STYLE_UNKNOWN;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 2203
2237 - (TabModel*)parentTabModel { 2204 - (TabModel*)parentTabModel {
2238 return parentTabModel_; 2205 return parentTabModel_;
2239 } 2206 }
2240 2207
2241 - (FormInputAccessoryViewController*)inputAccessoryViewController { 2208 - (FormInputAccessoryViewController*)inputAccessoryViewController {
2242 return inputAccessoryViewController_.get(); 2209 return inputAccessoryViewController_.get();
2243 } 2210 }
2244 2211
2245 @end 2212 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/ui/browser_view_controller.mm » ('j') | ios/web/public/test/fakes/test_web_state_delegate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698