| 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 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1648 | 1648 |
| 1649 Tab* tab = [parentTabModel_ | 1649 Tab* tab = [parentTabModel_ |
| 1650 insertBlankTabWithTransition:ui::PAGE_TRANSITION_LINK | 1650 insertBlankTabWithTransition:ui::PAGE_TRANSITION_LINK |
| 1651 opener:self | 1651 opener:self |
| 1652 openedByDOM:YES | 1652 openedByDOM:YES |
| 1653 atIndex:TabModelConstants::kTabPositionAutomatically | 1653 atIndex:TabModelConstants::kTabPositionAutomatically |
| 1654 inBackground:NO]; | 1654 inBackground:NO]; |
| 1655 return tab.webController; | 1655 return tab.webController; |
| 1656 } | 1656 } |
| 1657 | 1657 |
| 1658 - (void)webController:(CRWWebController*)webController | |
| 1659 onFormResubmissionForRequest:(NSURLRequest*)request | |
| 1660 continueBlock:(ProceduralBlock)continueBlock | |
| 1661 cancelBlock:(ProceduralBlock)cancelBlock { | |
| 1662 // Display the action sheet with the arrow pointing at the top center of the | |
| 1663 // web contents. | |
| 1664 CGPoint dialogLocation = | |
| 1665 CGPointMake(CGRectGetMidX(webController.view.frame), | |
| 1666 CGRectGetMinY(webController.view.frame) + | |
| 1667 [self.tabHeadersDelegate headerHeightForTab:self]); | |
| 1668 auto helper = FormResubmissionTabHelper::FromWebState(webController.webState); | |
| 1669 helper->PresentFormResubmissionDialog(dialogLocation, | |
| 1670 base::BindBlock(^(bool shouldContinue) { | |
| 1671 if (shouldContinue) | |
| 1672 continueBlock(); | |
| 1673 else | |
| 1674 cancelBlock(); | |
| 1675 })); | |
| 1676 } | |
| 1677 | |
| 1678 // The web page wants to close its own window. | 1658 // The web page wants to close its own window. |
| 1679 - (void)webPageOrderedClose { | 1659 - (void)webPageOrderedClose { |
| 1680 // Only allow a web page to close itself if it was opened by DOM, or if there | 1660 // Only allow a web page to close itself if it was opened by DOM, or if there |
| 1681 // are no navigation items. | 1661 // are no navigation items. |
| 1682 DCHECK([[self navigationManager]->GetSessionController() isOpenedByDOM] || | 1662 DCHECK([[self navigationManager]->GetSessionController() isOpenedByDOM] || |
| 1683 ![self navigationManager]->GetItemCount()); | 1663 ![self navigationManager]->GetItemCount()); |
| 1684 [self closeThisTab]; | 1664 [self closeThisTab]; |
| 1685 } | 1665 } |
| 1686 | 1666 |
| 1687 // This method is invoked whenever the system believes the URL is about to | 1667 // This method is invoked whenever the system believes the URL is about to |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2309 | 2289 |
| 2310 - (TabModel*)parentTabModel { | 2290 - (TabModel*)parentTabModel { |
| 2311 return parentTabModel_; | 2291 return parentTabModel_; |
| 2312 } | 2292 } |
| 2313 | 2293 |
| 2314 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2294 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2315 return inputAccessoryViewController_.get(); | 2295 return inputAccessoryViewController_.get(); |
| 2316 } | 2296 } |
| 2317 | 2297 |
| 2318 @end | 2298 @end |
| OLD | NEW |