| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 #include "ios/chrome/browser/signin/authentication_service_factory.h" | 86 #include "ios/chrome/browser/signin/authentication_service_factory.h" |
| 87 #include "ios/chrome/browser/signin/signin_capability.h" | 87 #include "ios/chrome/browser/signin/signin_capability.h" |
| 88 #import "ios/chrome/browser/snapshots/snapshot_manager.h" | 88 #import "ios/chrome/browser/snapshots/snapshot_manager.h" |
| 89 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" | 89 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" |
| 90 #import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h" | 90 #import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h" |
| 91 #include "ios/chrome/browser/ssl/ios_security_state_tab_helper.h" | 91 #include "ios/chrome/browser/ssl/ios_security_state_tab_helper.h" |
| 92 #import "ios/chrome/browser/storekit_launcher.h" | 92 #import "ios/chrome/browser/storekit_launcher.h" |
| 93 #include "ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h" | 93 #include "ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h" |
| 94 #import "ios/chrome/browser/tabs/tab_delegate.h" | 94 #import "ios/chrome/browser/tabs/tab_delegate.h" |
| 95 #import "ios/chrome/browser/tabs/tab_dialog_delegate.h" | 95 #import "ios/chrome/browser/tabs/tab_dialog_delegate.h" |
| 96 #import "ios/chrome/browser/tabs/tab_headers_delegate.h" |
| 96 #import "ios/chrome/browser/tabs/tab_model.h" | 97 #import "ios/chrome/browser/tabs/tab_model.h" |
| 97 #import "ios/chrome/browser/tabs/tab_private.h" | 98 #import "ios/chrome/browser/tabs/tab_private.h" |
| 98 #import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h" | 99 #import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h" |
| 99 #include "ios/chrome/browser/translate/chrome_ios_translate_client.h" | 100 #include "ios/chrome/browser/translate/chrome_ios_translate_client.h" |
| 100 #import "ios/chrome/browser/u2f/u2f_controller.h" | 101 #import "ios/chrome/browser/u2f/u2f_controller.h" |
| 101 #import "ios/chrome/browser/ui/alert_coordinator/form_resubmission_coordinator.h
" | 102 #import "ios/chrome/browser/ui/alert_coordinator/form_resubmission_coordinator.h
" |
| 102 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 103 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 103 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 104 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| 104 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 105 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 105 #import "ios/chrome/browser/ui/commands/open_url_command.h" | 106 #import "ios/chrome/browser/ui/commands/open_url_command.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 id<TabDelegate> delegate_; // weak | 242 id<TabDelegate> delegate_; // weak |
| 242 base::WeakNSProtocol<id<TabDialogDelegate>> dialogDelegate_; | 243 base::WeakNSProtocol<id<TabDialogDelegate>> dialogDelegate_; |
| 243 base::WeakNSProtocol<id<SnapshotOverlayProvider>> snapshotOverlayProvider_; | 244 base::WeakNSProtocol<id<SnapshotOverlayProvider>> snapshotOverlayProvider_; |
| 244 | 245 |
| 245 // Delegate used for snapshotting geometry. | 246 // Delegate used for snapshotting geometry. |
| 246 id<TabSnapshottingDelegate> tabSnapshottingDelegate_; // weak | 247 id<TabSnapshottingDelegate> tabSnapshottingDelegate_; // weak |
| 247 | 248 |
| 248 // The Full Screen Controller responsible for hiding/showing the toolbar. | 249 // The Full Screen Controller responsible for hiding/showing the toolbar. |
| 249 base::scoped_nsobject<FullScreenController> fullScreenController_; | 250 base::scoped_nsobject<FullScreenController> fullScreenController_; |
| 250 | 251 |
| 252 // The delegate responsible for headers over the tab. |
| 253 id<TabHeadersDelegate> tabHeadersDelegate_; // weak |
| 254 |
| 251 base::WeakNSProtocol<id<FullScreenControllerDelegate>> | 255 base::WeakNSProtocol<id<FullScreenControllerDelegate>> |
| 252 fullScreenControllerDelegate_; | 256 fullScreenControllerDelegate_; |
| 253 | 257 |
| 254 // The Overscroll controller responsible for displaying the | 258 // The Overscroll controller responsible for displaying the |
| 255 // overscrollActionsView above the toolbar. | 259 // overscrollActionsView above the toolbar. |
| 256 base::scoped_nsobject<OverscrollActionsController> | 260 base::scoped_nsobject<OverscrollActionsController> |
| 257 overscrollActionsController_; | 261 overscrollActionsController_; |
| 258 base::WeakNSProtocol<id<OverscrollActionsControllerDelegate>> | 262 base::WeakNSProtocol<id<OverscrollActionsControllerDelegate>> |
| 259 overscrollActionsControllerDelegate_; | 263 overscrollActionsControllerDelegate_; |
| 260 | 264 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 | 520 |
| 517 @implementation Tab | 521 @implementation Tab |
| 518 | 522 |
| 519 @synthesize browserState = browserState_; | 523 @synthesize browserState = browserState_; |
| 520 @synthesize useGreyImageCache = useGreyImageCache_; | 524 @synthesize useGreyImageCache = useGreyImageCache_; |
| 521 @synthesize isPrerenderTab = isPrerenderTab_; | 525 @synthesize isPrerenderTab = isPrerenderTab_; |
| 522 @synthesize isLinkLoadingPrerenderTab = isLinkLoadingPrerenderTab_; | 526 @synthesize isLinkLoadingPrerenderTab = isLinkLoadingPrerenderTab_; |
| 523 @synthesize isVoiceSearchResultsTab = isVoiceSearchResultsTab_; | 527 @synthesize isVoiceSearchResultsTab = isVoiceSearchResultsTab_; |
| 524 @synthesize delegate = delegate_; | 528 @synthesize delegate = delegate_; |
| 525 @synthesize tabSnapshottingDelegate = tabSnapshottingDelegate_; | 529 @synthesize tabSnapshottingDelegate = tabSnapshottingDelegate_; |
| 530 @synthesize tabHeadersDelegate = tabHeadersDelegate_; |
| 526 | 531 |
| 527 - (instancetype)initWithWindowName:(NSString*)windowName | 532 - (instancetype)initWithWindowName:(NSString*)windowName |
| 528 opener:(Tab*)opener | 533 opener:(Tab*)opener |
| 529 openedByDOM:(BOOL)openedByDOM | 534 openedByDOM:(BOOL)openedByDOM |
| 530 model:(TabModel*)parentModel | 535 model:(TabModel*)parentModel |
| 531 browserState:(ios::ChromeBrowserState*)browserState { | 536 browserState:(ios::ChromeBrowserState*)browserState { |
| 532 NSInteger openerIndex = -1; | 537 NSInteger openerIndex = -1; |
| 533 if ([opener navigationManager]) { | 538 if ([opener navigationManager]) { |
| 534 NavigationManagerImpl* openerNavManager = [opener navigationManager]; | 539 NavigationManagerImpl* openerNavManager = [opener navigationManager]; |
| 535 openerIndex = openerNavManager->GetLastCommittedItemIndex(); | 540 openerIndex = openerNavManager->GetLastCommittedItemIndex(); |
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 cancelBlock:(ProceduralBlock)cancelBlock { | 1723 cancelBlock:(ProceduralBlock)cancelBlock { |
| 1719 UIViewController* topController = | 1724 UIViewController* topController = |
| 1720 top_view_controller::TopPresentedViewControllerFrom( | 1725 top_view_controller::TopPresentedViewControllerFrom( |
| 1721 [UIApplication sharedApplication].keyWindow.rootViewController); | 1726 [UIApplication sharedApplication].keyWindow.rootViewController); |
| 1722 | 1727 |
| 1723 // Display the action sheet with the arrow pointing at the top center of the | 1728 // Display the action sheet with the arrow pointing at the top center of the |
| 1724 // web contents. | 1729 // web contents. |
| 1725 CGPoint dialogLocation = | 1730 CGPoint dialogLocation = |
| 1726 CGPointMake(CGRectGetMidX(webController.view.frame), | 1731 CGPointMake(CGRectGetMidX(webController.view.frame), |
| 1727 CGRectGetMinY(webController.view.frame) + | 1732 CGRectGetMinY(webController.view.frame) + |
| 1728 [[self fullScreenControllerDelegate] headerHeight]); | 1733 [self.tabHeadersDelegate headerHeightForTab:self]); |
| 1729 | 1734 |
| 1730 formResubmissionCoordinator_.reset([[FormResubmissionCoordinator alloc] | 1735 formResubmissionCoordinator_.reset([[FormResubmissionCoordinator alloc] |
| 1731 initWithBaseViewController:topController | 1736 initWithBaseViewController:topController |
| 1732 dialogLocation:dialogLocation | 1737 dialogLocation:dialogLocation |
| 1733 webState:webController.webState | 1738 webState:webController.webState |
| 1734 completionHandler:^(BOOL shouldContinue) { | 1739 completionHandler:^(BOOL shouldContinue) { |
| 1735 if (shouldContinue) | 1740 if (shouldContinue) |
| 1736 continueBlock(); | 1741 continueBlock(); |
| 1737 else | 1742 else |
| 1738 cancelBlock(); | 1743 cancelBlock(); |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2129 | 2134 |
| 2130 return setting != CONTENT_SETTING_ALLOW; | 2135 return setting != CONTENT_SETTING_ALLOW; |
| 2131 } | 2136 } |
| 2132 | 2137 |
| 2133 - (void)webController:(CRWWebController*)webController | 2138 - (void)webController:(CRWWebController*)webController |
| 2134 didBlockPopup:(const web::BlockedPopupInfo&)blockedPopupInfo { | 2139 didBlockPopup:(const web::BlockedPopupInfo&)blockedPopupInfo { |
| 2135 [self popupHandler]->HandlePopup(blockedPopupInfo); | 2140 [self popupHandler]->HandlePopup(blockedPopupInfo); |
| 2136 } | 2141 } |
| 2137 | 2142 |
| 2138 - (CGFloat)headerHeightForWebController:(CRWWebController*)webController { | 2143 - (CGFloat)headerHeightForWebController:(CRWWebController*)webController { |
| 2139 return [fullScreenControllerDelegate_ headerHeight]; | 2144 return [self.tabHeadersDelegate headerHeightForTab:self]; |
| 2140 } | 2145 } |
| 2141 | 2146 |
| 2142 - (void)webControllerDidUpdateSSLStatusForCurrentNavigationItem: | 2147 - (void)webControllerDidUpdateSSLStatusForCurrentNavigationItem: |
| 2143 (CRWWebController*)webController { | 2148 (CRWWebController*)webController { |
| 2144 // Disable fullscreen if SSL cert is invalid. | 2149 // Disable fullscreen if SSL cert is invalid. |
| 2145 web::NavigationItem* item = [self navigationManager]->GetTransientItem(); | 2150 web::NavigationItem* item = [self navigationManager]->GetTransientItem(); |
| 2146 web::SecurityStyle securityStyle = | 2151 web::SecurityStyle securityStyle = |
| 2147 item ? item->GetSSL().security_style : web::SECURITY_STYLE_UNKNOWN; | 2152 item ? item->GetSSL().security_style : web::SECURITY_STYLE_UNKNOWN; |
| 2148 if (securityStyle == web::SECURITY_STYLE_AUTHENTICATION_BROKEN) { | 2153 if (securityStyle == web::SECURITY_STYLE_AUTHENTICATION_BROKEN) { |
| 2149 [fullScreenController_ disableFullScreen]; | 2154 [fullScreenController_ disableFullScreen]; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2392 | 2397 |
| 2393 - (TabModel*)parentTabModel { | 2398 - (TabModel*)parentTabModel { |
| 2394 return parentTabModel_; | 2399 return parentTabModel_; |
| 2395 } | 2400 } |
| 2396 | 2401 |
| 2397 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2402 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2398 return inputAccessoryViewController_.get(); | 2403 return inputAccessoryViewController_.get(); |
| 2399 } | 2404 } |
| 2400 | 2405 |
| 2401 @end | 2406 @end |
| OLD | NEW |