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/commands/UIKit+ChromeExecuteCommand.h" | 102 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
102 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 103 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
103 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 104 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
104 #import "ios/chrome/browser/ui/commands/open_url_command.h" | 105 #import "ios/chrome/browser/ui/commands/open_url_command.h" |
105 #import "ios/chrome/browser/ui/commands/show_signin_command.h" | 106 #import "ios/chrome/browser/ui/commands/show_signin_command.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 | 242 |
242 // Delegate used for snapshotting geometry. | 243 // Delegate used for snapshotting geometry. |
243 id<TabSnapshottingDelegate> tabSnapshottingDelegate_; // weak | 244 id<TabSnapshottingDelegate> tabSnapshottingDelegate_; // weak |
244 | 245 |
245 // The Full Screen Controller responsible for hiding/showing the toolbar. | 246 // The Full Screen Controller responsible for hiding/showing the toolbar. |
246 base::scoped_nsobject<FullScreenController> fullScreenController_; | 247 base::scoped_nsobject<FullScreenController> fullScreenController_; |
247 | 248 |
248 base::WeakNSProtocol<id<FullScreenControllerDelegate>> | 249 base::WeakNSProtocol<id<FullScreenControllerDelegate>> |
249 fullScreenControllerDelegate_; | 250 fullScreenControllerDelegate_; |
250 | 251 |
252 // The delegate responsible for headers over the tab. | |
253 id<TabHeadersDelegate> tabHeadersDelegate_; // weak | |
254 | |
251 // The Overscroll controller responsible for displaying the | 255 // The Overscroll controller responsible for displaying the |
252 // overscrollActionsView above the toolbar. | 256 // overscrollActionsView above the toolbar. |
253 base::scoped_nsobject<OverscrollActionsController> | 257 base::scoped_nsobject<OverscrollActionsController> |
254 overscrollActionsController_; | 258 overscrollActionsController_; |
255 base::WeakNSProtocol<id<OverscrollActionsControllerDelegate>> | 259 base::WeakNSProtocol<id<OverscrollActionsControllerDelegate>> |
256 overscrollActionsControllerDelegate_; | 260 overscrollActionsControllerDelegate_; |
257 | 261 |
258 // Lightweight object dealing with various different UI behaviours when | 262 // Lightweight object dealing with various different UI behaviours when |
259 // opening a URL in an external application. | 263 // opening a URL in an external application. |
260 base::scoped_nsobject<ExternalAppLauncher> externalAppLauncher_; | 264 base::scoped_nsobject<ExternalAppLauncher> externalAppLauncher_; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
520 | 524 |
521 @implementation Tab | 525 @implementation Tab |
522 | 526 |
523 @synthesize browserState = browserState_; | 527 @synthesize browserState = browserState_; |
524 @synthesize useGreyImageCache = useGreyImageCache_; | 528 @synthesize useGreyImageCache = useGreyImageCache_; |
525 @synthesize isPrerenderTab = isPrerenderTab_; | 529 @synthesize isPrerenderTab = isPrerenderTab_; |
526 @synthesize isLinkLoadingPrerenderTab = isLinkLoadingPrerenderTab_; | 530 @synthesize isLinkLoadingPrerenderTab = isLinkLoadingPrerenderTab_; |
527 @synthesize isVoiceSearchResultsTab = isVoiceSearchResultsTab_; | 531 @synthesize isVoiceSearchResultsTab = isVoiceSearchResultsTab_; |
528 @synthesize delegate = delegate_; | 532 @synthesize delegate = delegate_; |
529 @synthesize tabSnapshottingDelegate = tabSnapshottingDelegate_; | 533 @synthesize tabSnapshottingDelegate = tabSnapshottingDelegate_; |
534 @synthesize tabHeadersDelegate = tabHeadersDelegate_; | |
530 | 535 |
531 - (instancetype)initWithWindowName:(NSString*)windowName | 536 - (instancetype)initWithWindowName:(NSString*)windowName |
532 opener:(Tab*)opener | 537 opener:(Tab*)opener |
533 openedByDOM:(BOOL)openedByDOM | 538 openedByDOM:(BOOL)openedByDOM |
534 model:(TabModel*)parentModel | 539 model:(TabModel*)parentModel |
535 browserState:(ios::ChromeBrowserState*)browserState { | 540 browserState:(ios::ChromeBrowserState*)browserState { |
536 NSInteger openerIndex = -1; | 541 NSInteger openerIndex = -1; |
537 if ([opener navigationManager]) { | 542 if ([opener navigationManager]) { |
538 NavigationManagerImpl* openerNavManager = [opener navigationManager]; | 543 NavigationManagerImpl* openerNavManager = [opener navigationManager]; |
539 openerIndex = openerNavManager->GetLastCommittedItemIndex(); | 544 openerIndex = openerNavManager->GetLastCommittedItemIndex(); |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1757 // Return early if the CRWWebController has been closed or web | 1762 // Return early if the CRWWebController has been closed or web |
1758 // usage is disabled on it. | 1763 // usage is disabled on it. |
1759 if (![self.webController webUsageEnabled]) | 1764 if (![self.webController webUsageEnabled]) |
1760 return; | 1765 return; |
1761 // Check to see if an action sheet can be shown. | 1766 // Check to see if an action sheet can be shown. |
1762 if (self.webState && [self.webState->GetView() window]) { | 1767 if (self.webState && [self.webState->GetView() window]) { |
1763 // Display the action sheet with the arrow pointing at the top center of the | 1768 // Display the action sheet with the arrow pointing at the top center of the |
1764 // web contents. | 1769 // web contents. |
1765 CGFloat xOrigin = CGRectGetMidX(self.webState->GetView().frame); | 1770 CGFloat xOrigin = CGRectGetMidX(self.webState->GetView().frame); |
1766 CGFloat yOrigin = CGRectGetMinY(self.webState->GetView().frame) + | 1771 CGFloat yOrigin = CGRectGetMinY(self.webState->GetView().frame) + |
1767 [[self fullScreenControllerDelegate] headerHeight]; | 1772 [[self tabHeadersDelegate] headerHeightForTab:self]; |
1768 [resubmitDataController_ | 1773 [resubmitDataController_ |
1769 presentActionSheetFromRect:CGRectMake(xOrigin, yOrigin, 1, 1) | 1774 presentActionSheetFromRect:CGRectMake(xOrigin, yOrigin, 1, 1) |
1770 inView:self.webState->GetView()]; | 1775 inView:self.webState->GetView()]; |
1771 showResubmitDataActionSheetAttempt_ = 0; | 1776 showResubmitDataActionSheetAttempt_ = 0; |
1772 return; | 1777 return; |
1773 } | 1778 } |
1774 | 1779 |
1775 // The resubmit data action cannot be presented as the |contentView_| was not | 1780 // The resubmit data action cannot be presented as the |contentView_| was not |
1776 // yet added to the window. Retry after |kDelayBetweenAttemptsNanoSecs|. | 1781 // yet added to the window. Retry after |kDelayBetweenAttemptsNanoSecs|. |
1777 // TODO(crbug.com/227868): The strategy to poll until the resubmit data action | 1782 // TODO(crbug.com/227868): The strategy to poll until the resubmit data action |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2190 | 2195 |
2191 return setting != CONTENT_SETTING_ALLOW; | 2196 return setting != CONTENT_SETTING_ALLOW; |
2192 } | 2197 } |
2193 | 2198 |
2194 - (void)webController:(CRWWebController*)webController | 2199 - (void)webController:(CRWWebController*)webController |
2195 didBlockPopup:(const web::BlockedPopupInfo&)blockedPopupInfo { | 2200 didBlockPopup:(const web::BlockedPopupInfo&)blockedPopupInfo { |
2196 [self popupHandler]->HandlePopup(blockedPopupInfo); | 2201 [self popupHandler]->HandlePopup(blockedPopupInfo); |
2197 } | 2202 } |
2198 | 2203 |
2199 - (CGFloat)headerHeightForWebController:(CRWWebController*)webController { | 2204 - (CGFloat)headerHeightForWebController:(CRWWebController*)webController { |
2200 return [fullScreenControllerDelegate_ headerHeight]; | 2205 DCHECK(webController == [self webController]); |
2206 return [tabHeadersDelegate_ headerHeightForTab:self]; | |
noyau (Ping after 24h)
2017/01/10 13:10:54
Nit: You use [self tabHeadersDelegate] on line 177
Olivier
2017/01/10 18:27:09
Done.
| |
2201 } | 2207 } |
2202 | 2208 |
2203 - (void)webControllerDidUpdateSSLStatusForCurrentNavigationItem: | 2209 - (void)webControllerDidUpdateSSLStatusForCurrentNavigationItem: |
2204 (CRWWebController*)webController { | 2210 (CRWWebController*)webController { |
2205 // Disable fullscreen if SSL cert is invalid. | 2211 // Disable fullscreen if SSL cert is invalid. |
2206 web::NavigationItem* item = [self navigationManager]->GetTransientItem(); | 2212 web::NavigationItem* item = [self navigationManager]->GetTransientItem(); |
2207 web::SecurityStyle securityStyle = | 2213 web::SecurityStyle securityStyle = |
2208 item ? item->GetSSL().security_style : web::SECURITY_STYLE_UNKNOWN; | 2214 item ? item->GetSSL().security_style : web::SECURITY_STYLE_UNKNOWN; |
2209 if (securityStyle == web::SECURITY_STYLE_AUTHENTICATION_BROKEN) { | 2215 if (securityStyle == web::SECURITY_STYLE_AUTHENTICATION_BROKEN) { |
2210 [fullScreenController_ disableFullScreen]; | 2216 [fullScreenController_ disableFullScreen]; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2451 | 2457 |
2452 - (TabModel*)parentTabModel { | 2458 - (TabModel*)parentTabModel { |
2453 return parentTabModel_; | 2459 return parentTabModel_; |
2454 } | 2460 } |
2455 | 2461 |
2456 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2462 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
2457 return inputAccessoryViewController_.get(); | 2463 return inputAccessoryViewController_.get(); |
2458 } | 2464 } |
2459 | 2465 |
2460 @end | 2466 @end |
OLD | NEW |