| 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 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 } | 1487 } |
| 1488 | 1488 |
| 1489 - (void)blockPopupForURL:(const GURL&)popupURL | 1489 - (void)blockPopupForURL:(const GURL&)popupURL |
| 1490 openerURL:(const GURL&)openerURL { | 1490 openerURL:(const GURL&)openerURL { |
| 1491 web::NavigationItem* item = [self navigationManager]->GetLastCommittedItem(); | 1491 web::NavigationItem* item = [self navigationManager]->GetLastCommittedItem(); |
| 1492 web::Referrer referrer(openerURL, item->GetReferrer().policy); | 1492 web::Referrer referrer(openerURL, item->GetReferrer().policy); |
| 1493 GURL localPopupURL(popupURL); | 1493 GURL localPopupURL(popupURL); |
| 1494 base::WeakNSObject<Tab> weakSelf(self); | 1494 base::WeakNSObject<Tab> weakSelf(self); |
| 1495 // TODO(crbug.com/692117): Remove |window_name| from constructor. | 1495 // TODO(crbug.com/692117): Remove |window_name| from constructor. |
| 1496 web::BlockedPopupInfo poupInfo(popupURL, referrer, nil /* window_name */, ^{ | 1496 web::BlockedPopupInfo poupInfo(popupURL, referrer, nil /* window_name */, ^{ |
| 1497 base::scoped_nsobject<Tab> strongSelf([weakSelf retain]); | 1497 web::WebState* webState = [weakSelf webState]; |
| 1498 if (!strongSelf) { | 1498 if (webState) { |
| 1499 return; | 1499 web::WebState::OpenURLParams params( |
| 1500 localPopupURL, referrer, WindowOpenDisposition::NEW_POPUP, |
| 1501 ui::PAGE_TRANSITION_LINK, true /* is_renderer_initiated */); |
| 1502 params.url = localPopupURL; |
| 1503 params.referrer = referrer; |
| 1504 params.transition = ui::PAGE_TRANSITION_LINK; |
| 1505 webState->OpenURL(params); |
| 1500 } | 1506 } |
| 1501 [strongSelf updateSnapshotWithOverlay:YES visibleFrameOnly:YES]; | |
| 1502 [strongSelf.get()->parentTabModel_ | |
| 1503 insertOrUpdateTabWithURL:localPopupURL | |
| 1504 referrer:referrer | |
| 1505 transition:ui::PAGE_TRANSITION_LINK | |
| 1506 windowName:nil | |
| 1507 opener:self | |
| 1508 openedByDOM:YES | |
| 1509 atIndex:TabModelConstants::kTabPositionAutomatically | |
| 1510 inBackground:NO]; | |
| 1511 }); | 1507 }); |
| 1512 BlockedPopupTabHelper::FromWebState(self.webState)->HandlePopup(poupInfo); | 1508 BlockedPopupTabHelper::FromWebState(self.webState)->HandlePopup(poupInfo); |
| 1513 } | 1509 } |
| 1514 | 1510 |
| 1515 #pragma mark - | 1511 #pragma mark - |
| 1516 #pragma mark FindInPageControllerDelegate | 1512 #pragma mark FindInPageControllerDelegate |
| 1517 | 1513 |
| 1518 - (void)willAdjustScrollPosition { | 1514 - (void)willAdjustScrollPosition { |
| 1519 // Skip the next attempt to correct the scroll offset for the toolbar height. | 1515 // Skip the next attempt to correct the scroll offset for the toolbar height. |
| 1520 // Used when programatically scrolling down the y offset. | 1516 // Used when programatically scrolling down the y offset. |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2223 | 2219 |
| 2224 - (TabModel*)parentTabModel { | 2220 - (TabModel*)parentTabModel { |
| 2225 return parentTabModel_; | 2221 return parentTabModel_; |
| 2226 } | 2222 } |
| 2227 | 2223 |
| 2228 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2224 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2229 return inputAccessoryViewController_.get(); | 2225 return inputAccessoryViewController_.get(); |
| 2230 } | 2226 } |
| 2231 | 2227 |
| 2232 @end | 2228 @end |
| OLD | NEW |