| 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 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1667 | 1667 |
| 1668 Tab* tab = [parentTabModel_ | 1668 Tab* tab = [parentTabModel_ |
| 1669 insertBlankTabWithTransition:ui::PAGE_TRANSITION_LINK | 1669 insertBlankTabWithTransition:ui::PAGE_TRANSITION_LINK |
| 1670 opener:self | 1670 opener:self |
| 1671 openedByDOM:YES | 1671 openedByDOM:YES |
| 1672 atIndex:TabModelConstants::kTabPositionAutomatically | 1672 atIndex:TabModelConstants::kTabPositionAutomatically |
| 1673 inBackground:NO]; | 1673 inBackground:NO]; |
| 1674 return tab.webController; | 1674 return tab.webController; |
| 1675 } | 1675 } |
| 1676 | 1676 |
| 1677 - (void)webController:(CRWWebController*)webController | |
| 1678 onFormResubmissionForRequest:(NSURLRequest*)request | |
| 1679 continueBlock:(ProceduralBlock)continueBlock | |
| 1680 cancelBlock:(ProceduralBlock)cancelBlock { | |
| 1681 // Display the action sheet with the arrow pointing at the top center of the | |
| 1682 // web contents. | |
| 1683 CGPoint dialogLocation = | |
| 1684 CGPointMake(CGRectGetMidX(webController.view.frame), | |
| 1685 CGRectGetMinY(webController.view.frame) + | |
| 1686 [self.tabHeadersDelegate headerHeightForTab:self]); | |
| 1687 auto helper = FormResubmissionTabHelper::FromWebState(webController.webState); | |
| 1688 helper->PresentFormResubmissionDialog(dialogLocation, | |
| 1689 base::BindBlock(^(bool shouldContinue) { | |
| 1690 if (shouldContinue) | |
| 1691 continueBlock(); | |
| 1692 else | |
| 1693 cancelBlock(); | |
| 1694 })); | |
| 1695 } | |
| 1696 | |
| 1697 // The web page wants to close its own window. | 1677 // The web page wants to close its own window. |
| 1698 - (void)webPageOrderedClose { | 1678 - (void)webPageOrderedClose { |
| 1699 // Only allow a web page to close itself if it was opened by DOM, or if there | 1679 // Only allow a web page to close itself if it was opened by DOM, or if there |
| 1700 // are no navigation items. | 1680 // are no navigation items. |
| 1701 DCHECK([[self navigationManager]->GetSessionController() isOpenedByDOM] || | 1681 DCHECK([[self navigationManager]->GetSessionController() isOpenedByDOM] || |
| 1702 ![self navigationManager]->GetItemCount()); | 1682 ![self navigationManager]->GetItemCount()); |
| 1703 [self closeThisTab]; | 1683 [self closeThisTab]; |
| 1704 } | 1684 } |
| 1705 | 1685 |
| 1706 // This method is invoked whenever the system believes the URL is about to | 1686 // This method is invoked whenever the system believes the URL is about to |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2327 | 2307 |
| 2328 - (TabModel*)parentTabModel { | 2308 - (TabModel*)parentTabModel { |
| 2329 return parentTabModel_; | 2309 return parentTabModel_; |
| 2330 } | 2310 } |
| 2331 | 2311 |
| 2332 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2312 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2333 return inputAccessoryViewController_.get(); | 2313 return inputAccessoryViewController_.get(); |
| 2334 } | 2314 } |
| 2335 | 2315 |
| 2336 @end | 2316 @end |
| OLD | NEW |