Chromium Code Reviews| 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/ui/browser_view_controller.h" | 5 #import "ios/chrome/browser/ui/browser_view_controller.h" |
| 6 | 6 |
| 7 #import <AssetsLibrary/AssetsLibrary.h> | 7 #import <AssetsLibrary/AssetsLibrary.h> |
| 8 #import <MobileCoreServices/MobileCoreServices.h> | 8 #import <MobileCoreServices/MobileCoreServices.h> |
| 9 #import <PassKit/PassKit.h> | 9 #import <PassKit/PassKit.h> |
| 10 #import <Photos/Photos.h> | 10 #import <Photos/Photos.h> |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 #import "ios/chrome/browser/ui/dialogs/java_script_dialog_presenter_impl.h" | 108 #import "ios/chrome/browser/ui/dialogs/java_script_dialog_presenter_impl.h" |
| 109 #import "ios/chrome/browser/ui/elements/activity_overlay_coordinator.h" | 109 #import "ios/chrome/browser/ui/elements/activity_overlay_coordinator.h" |
| 110 #import "ios/chrome/browser/ui/external_file_controller.h" | 110 #import "ios/chrome/browser/ui/external_file_controller.h" |
| 111 #import "ios/chrome/browser/ui/external_file_remover.h" | 111 #import "ios/chrome/browser/ui/external_file_remover.h" |
| 112 #include "ios/chrome/browser/ui/file_locations.h" | 112 #include "ios/chrome/browser/ui/file_locations.h" |
| 113 #import "ios/chrome/browser/ui/find_bar/find_bar_controller_ios.h" | 113 #import "ios/chrome/browser/ui/find_bar/find_bar_controller_ios.h" |
| 114 #import "ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.h" | 114 #import "ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.h" |
| 115 #import "ios/chrome/browser/ui/fullscreen_controller.h" | 115 #import "ios/chrome/browser/ui/fullscreen_controller.h" |
| 116 #import "ios/chrome/browser/ui/history/tab_history_cell.h" | 116 #import "ios/chrome/browser/ui/history/tab_history_cell.h" |
| 117 #import "ios/chrome/browser/ui/key_commands_provider.h" | 117 #import "ios/chrome/browser/ui/key_commands_provider.h" |
| 118 #import "ios/chrome/browser/ui/no_tabs/no_tabs_controller.h" | |
| 119 #import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h" | 118 #import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h" |
| 120 #import "ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_panel_view_controller .h" | 119 #import "ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_panel_view_controller .h" |
| 121 #include "ios/chrome/browser/ui/omnibox/page_info_model.h" | 120 #include "ios/chrome/browser/ui/omnibox/page_info_model.h" |
| 122 #import "ios/chrome/browser/ui/omnibox/page_info_view_controller.h" | 121 #import "ios/chrome/browser/ui/omnibox/page_info_view_controller.h" |
| 123 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller. h" | 122 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller. h" |
| 124 #import "ios/chrome/browser/ui/page_not_available_controller.h" | 123 #import "ios/chrome/browser/ui/page_not_available_controller.h" |
| 125 #import "ios/chrome/browser/ui/preload_controller.h" | 124 #import "ios/chrome/browser/ui/preload_controller.h" |
| 126 #import "ios/chrome/browser/ui/preload_controller_delegate.h" | 125 #import "ios/chrome/browser/ui/preload_controller_delegate.h" |
| 127 #import "ios/chrome/browser/ui/print/print_controller.h" | 126 #import "ios/chrome/browser/ui/print/print_controller.h" |
| 128 #import "ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.h" | 127 #import "ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 } else { | 231 } else { |
| 233 UMA_HISTOGRAM_ENUMERATION("ContextMenu.SelectedOption.Image", action, | 232 UMA_HISTOGRAM_ENUMERATION("ContextMenu.SelectedOption.Image", action, |
| 234 NUM_ACTIONS); | 233 NUM_ACTIONS); |
| 235 } | 234 } |
| 236 } else { | 235 } else { |
| 237 UMA_HISTOGRAM_ENUMERATION("ContextMenu.SelectedOption.Link", action, | 236 UMA_HISTOGRAM_ENUMERATION("ContextMenu.SelectedOption.Link", action, |
| 238 NUM_ACTIONS); | 237 NUM_ACTIONS); |
| 239 } | 238 } |
| 240 } | 239 } |
| 241 | 240 |
| 242 // Duration to show or hide the No-Tabs UI. | |
| 243 const NSTimeInterval kNoTabsAnimationDuration = 0.25; | |
| 244 | |
| 245 const CGFloat kVoiceSearchBarHeight = 59.0; | 241 const CGFloat kVoiceSearchBarHeight = 59.0; |
| 246 | 242 |
| 247 // Dimensions to use when downsizing an image for search-by-image. | 243 // Dimensions to use when downsizing an image for search-by-image. |
| 248 const CGFloat kSearchByImageMaxImageArea = 90000.0; | 244 const CGFloat kSearchByImageMaxImageArea = 90000.0; |
| 249 const CGFloat kSearchByImageMaxImageWidth = 600.0; | 245 const CGFloat kSearchByImageMaxImageWidth = 600.0; |
| 250 const CGFloat kSearchByImageMaxImageHeight = 400.0; | 246 const CGFloat kSearchByImageMaxImageHeight = 400.0; |
| 251 | 247 |
| 252 // The delay, in seconds, after startup before cleaning up the files received | 248 // The delay, in seconds, after startup before cleaning up the files received |
| 253 // from other applications that are not bookmarked nor referenced by an open or | 249 // from other applications that are not bookmarked nor referenced by an open or |
| 254 // recently closed tab. | 250 // recently closed tab. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 386 // Used to display the QR Scanner UI. Nil if not visible. | 382 // Used to display the QR Scanner UI. Nil if not visible. |
| 387 base::scoped_nsobject<QRScannerViewController> _qrScannerViewController; | 383 base::scoped_nsobject<QRScannerViewController> _qrScannerViewController; |
| 388 | 384 |
| 389 // Used to display the Suggestions. | 385 // Used to display the Suggestions. |
| 390 base::scoped_nsobject<ContentSuggestionsCoordinator> | 386 base::scoped_nsobject<ContentSuggestionsCoordinator> |
| 391 _contentSuggestionsCoordinator; | 387 _contentSuggestionsCoordinator; |
| 392 | 388 |
| 393 // Used to display the Find In Page UI. Nil if not visible. | 389 // Used to display the Find In Page UI. Nil if not visible. |
| 394 base::scoped_nsobject<FindBarControllerIOS> _findBarController; | 390 base::scoped_nsobject<FindBarControllerIOS> _findBarController; |
| 395 | 391 |
| 396 // Used to display the No-Tabs UI for iPads. Nil if not visible. | |
| 397 base::scoped_nsobject<NoTabsController> _noTabsController; | |
| 398 | |
| 399 // Used to display the Print UI. Nil if not visible. | 392 // Used to display the Print UI. Nil if not visible. |
| 400 base::scoped_nsobject<PrintController> _printController; | 393 base::scoped_nsobject<PrintController> _printController; |
| 401 | 394 |
| 402 // Records the set of domains for which full screen alert has already been | 395 // Records the set of domains for which full screen alert has already been |
| 403 // shown. | 396 // shown. |
| 404 base::scoped_nsobject<NSMutableSet> _fullScreenAlertShown; | 397 base::scoped_nsobject<NSMutableSet> _fullScreenAlertShown; |
| 405 | 398 |
| 406 // Adapter to let BVC be the delegate for WebState. | 399 // Adapter to let BVC be the delegate for WebState. |
| 407 std::unique_ptr<web::WebStateDelegateBridge> _webStateDelegate; | 400 std::unique_ptr<web::WebStateDelegateBridge> _webStateDelegate; |
| 408 | 401 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 // Voice search bar at the bottom of the view overlayed on |_contentArea| | 436 // Voice search bar at the bottom of the view overlayed on |_contentArea| |
| 444 // when displaying voice search results. | 437 // when displaying voice search results. |
| 445 base::scoped_nsprotocol<UIView<VoiceSearchBar>*> _voiceSearchBar; | 438 base::scoped_nsprotocol<UIView<VoiceSearchBar>*> _voiceSearchBar; |
| 446 | 439 |
| 447 // The image fetcher used to save images and perform image-based searches. | 440 // The image fetcher used to save images and perform image-based searches. |
| 448 std::unique_ptr<web::ImageDataFetcher> _imageFetcher; | 441 std::unique_ptr<web::ImageDataFetcher> _imageFetcher; |
| 449 | 442 |
| 450 // Card side swipe view. | 443 // Card side swipe view. |
| 451 base::scoped_nsobject<CardSideSwipeView> _sideSwipeView; | 444 base::scoped_nsobject<CardSideSwipeView> _sideSwipeView; |
| 452 | 445 |
| 453 // Used to cache value of |hasModeToggleSwitch| if set before the tab strip | |
| 454 // controller has been created. | |
| 455 BOOL _modeToggleNeedsSetting; | |
| 456 | |
| 457 // Dominant color cache. Key: (NSString*)url, val: (UIColor*)dominantColor. | 446 // Dominant color cache. Key: (NSString*)url, val: (UIColor*)dominantColor. |
| 458 base::scoped_nsobject<NSMutableDictionary> _dominantColorCache; | 447 base::scoped_nsobject<NSMutableDictionary> _dominantColorCache; |
| 459 | 448 |
| 460 // Bridge to register for bookmark changes. | 449 // Bridge to register for bookmark changes. |
| 461 std::unique_ptr<BrowserBookmarkModelBridge> _bookmarkModelBridge; | 450 std::unique_ptr<BrowserBookmarkModelBridge> _bookmarkModelBridge; |
| 462 | 451 |
| 463 // Cached pointer to the bookmarks model. | 452 // Cached pointer to the bookmarks model. |
| 464 bookmarks::BookmarkModel* _bookmarkModel; // weak | 453 bookmarks::BookmarkModel* _bookmarkModel; // weak |
| 465 | 454 |
| 466 // The controller that shows the bookmarking UI after the user taps the star | 455 // The controller that shows the bookmarking UI after the user taps the star |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 579 // Sets the correct frame and heirarchy for subviews and helper views. | 568 // Sets the correct frame and heirarchy for subviews and helper views. |
| 580 - (void)setUpViewLayout; | 569 - (void)setUpViewLayout; |
| 581 // Sets the correct frame for the tab strip based on the given maximum width. | 570 // Sets the correct frame for the tab strip based on the given maximum width. |
| 582 - (void)layoutTabStripForWidth:(CGFloat)maxWidth; | 571 - (void)layoutTabStripForWidth:(CGFloat)maxWidth; |
| 583 // Makes |tab| the currently visible tab, displaying its view. Calls | 572 // Makes |tab| the currently visible tab, displaying its view. Calls |
| 584 // -selectedTabChanged on the toolbar only if |newSelection| is YES. | 573 // -selectedTabChanged on the toolbar only if |newSelection| is YES. |
| 585 - (void)displayTab:(Tab*)tab isNewSelection:(BOOL)newSelection; | 574 - (void)displayTab:(Tab*)tab isNewSelection:(BOOL)newSelection; |
| 586 // Initializes the bookmark interaction controller if not already initialized. | 575 // Initializes the bookmark interaction controller if not already initialized. |
| 587 - (void)initializeBookmarkInteractionController; | 576 - (void)initializeBookmarkInteractionController; |
| 588 | 577 |
| 589 // Shows the No-Tabs UI with animation. | |
| 590 - (void)showNoTabsUI; | |
| 591 // Dismisses the No-Tabs UI with animation. | |
| 592 - (void)dismissNoTabsUI; | |
| 593 | |
| 594 // Shows the tools menu popup. | 578 // Shows the tools menu popup. |
| 595 - (void)showToolsMenuPopup; | 579 - (void)showToolsMenuPopup; |
| 596 // Add all delegates to the provided |tab|. | 580 // Add all delegates to the provided |tab|. |
| 597 - (void)installDelegatesForTab:(Tab*)tab; | 581 - (void)installDelegatesForTab:(Tab*)tab; |
| 598 // Closes the current tab, with animation if applicable. | 582 // Closes the current tab, with animation if applicable. |
| 599 - (void)closeCurrentTab; | 583 - (void)closeCurrentTab; |
| 600 // Returns an autoreleased share to data for |tab|. | 584 // Returns an autoreleased share to data for |tab|. |
| 601 - (ShareToData*)shareToDataForTab:(Tab*)tab; | 585 - (ShareToData*)shareToDataForTab:(Tab*)tab; |
| 602 // Shows the menu to initiate sharing |data|. | 586 // Shows the menu to initiate sharing |data|. |
| 603 - (void)sharePageWithData:(ShareToData*)data; | 587 - (void)sharePageWithData:(ShareToData*)data; |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 958 | 942 |
| 959 #pragma mark - Accessibility | 943 #pragma mark - Accessibility |
| 960 | 944 |
| 961 - (BOOL)accessibilityPerformEscape { | 945 - (BOOL)accessibilityPerformEscape { |
| 962 [self dismissPopups]; | 946 [self dismissPopups]; |
| 963 return YES; | 947 return YES; |
| 964 } | 948 } |
| 965 | 949 |
| 966 #pragma mark - Properties | 950 #pragma mark - Properties |
| 967 | 951 |
| 968 // Implements |hasModeToggleSwitch| property as pass-throughs to tab strip | |
| 969 // controller and no-tabs controller. If set before the controller has been | |
| 970 // created, cache it. | |
| 971 - (void)setHasModeToggleSwitch:(BOOL)hasModeToggleSwitch { | |
| 972 if (!experimental_flags::IsTabSwitcherEnabled()) { | |
| 973 if (_tabStripController) | |
| 974 _tabStripController.get().hasModeToggleSwitch = hasModeToggleSwitch; | |
| 975 else | |
| 976 _modeToggleNeedsSetting = hasModeToggleSwitch; | |
| 977 } | |
| 978 [_noTabsController setHasModeToggleSwitch:hasModeToggleSwitch]; | |
| 979 } | |
| 980 | |
| 981 // Implements |hasModeToggleSwitch| property as pass-throughs to tab strip | |
| 982 // controller, unless it hasn't been created in which return the cached version. | |
| 983 - (BOOL)hasModeToggleSwitch { | |
| 984 if (_tabStripController) | |
| 985 return _tabStripController.get().hasModeToggleSwitch; | |
| 986 return _modeToggleNeedsSetting; | |
| 987 } | |
| 988 | |
| 989 - (void)setActive:(BOOL)active { | 952 - (void)setActive:(BOOL)active { |
| 990 if (_active == active) { | 953 if (_active == active) { |
| 991 return; | 954 return; |
| 992 } | 955 } |
| 993 _active = active; | 956 _active = active; |
| 994 | 957 |
| 995 // If not active, display an activity indicator overlay over the view to | 958 // If not active, display an activity indicator overlay over the view to |
| 996 // prevent interaction with the web page. | 959 // prevent interaction with the web page. |
| 997 // TODO(crbug.com/637093): This coordinator should be managed by the | 960 // TODO(crbug.com/637093): This coordinator should be managed by the |
| 998 // coordinator used to present BrowserViewController, when implemented. | 961 // coordinator used to present BrowserViewController, when implemented. |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1158 [_toolbarController cancelOmniboxEdit]; | 1121 [_toolbarController cancelOmniboxEdit]; |
| 1159 } | 1122 } |
| 1160 | 1123 |
| 1161 - (void)newTab:(id)sender { | 1124 - (void)newTab:(id)sender { |
| 1162 [self setLastTapPoint:sender]; | 1125 [self setLastTapPoint:sender]; |
| 1163 DCHECK(self.visible || self.dismissingModal); | 1126 DCHECK(self.visible || self.dismissingModal); |
| 1164 Tab* currentTab = [_model currentTab]; | 1127 Tab* currentTab = [_model currentTab]; |
| 1165 if (currentTab) { | 1128 if (currentTab) { |
| 1166 BOOL isChromeScheme = | 1129 BOOL isChromeScheme = |
| 1167 web::GetWebClient()->IsAppSpecificURL([currentTab url]); | 1130 web::GetWebClient()->IsAppSpecificURL([currentTab url]); |
| 1168 BOOL snapshotOnIpad = | 1131 if (!IsIPadIdiom() || !isChromeScheme) { |
|
rohitrao (ping after 24h)
2017/02/01 18:34:34
I believe under the old logic this was always true
jif
2017/02/03 12:55:51
Done.
| |
| 1169 (!IsIPadIdiom() || experimental_flags::IsTabSwitcherEnabled()); | |
| 1170 if (snapshotOnIpad || !isChromeScheme) { | |
| 1171 [currentTab updateSnapshotWithOverlay:YES visibleFrameOnly:YES]; | 1132 [currentTab updateSnapshotWithOverlay:YES visibleFrameOnly:YES]; |
| 1172 } | 1133 } |
| 1173 } | 1134 } |
| 1174 [self addSelectedTabWithURL:GURL(kChromeUINewTabURL) | 1135 [self addSelectedTabWithURL:GURL(kChromeUINewTabURL) |
| 1175 transition:ui::PAGE_TRANSITION_TYPED]; | 1136 transition:ui::PAGE_TRANSITION_TYPED]; |
| 1176 } | 1137 } |
| 1177 | 1138 |
| 1178 #pragma mark - UIViewController methods | 1139 #pragma mark - UIViewController methods |
| 1179 | 1140 |
| 1180 // Perform additional set up after loading the view, typically from a nib. | 1141 // Perform additional set up after loading the view, typically from a nib. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1228 - (void)viewWillAppear:(BOOL)animated { | 1189 - (void)viewWillAppear:(BOOL)animated { |
| 1229 [super viewWillAppear:animated]; | 1190 [super viewWillAppear:animated]; |
| 1230 | 1191 |
| 1231 // Reparent the toolbar if it's been relinquished. | 1192 // Reparent the toolbar if it's been relinquished. |
| 1232 if (_isToolbarControllerRelinquished) | 1193 if (_isToolbarControllerRelinquished) |
| 1233 [self reparentToolbarController]; | 1194 [self reparentToolbarController]; |
| 1234 | 1195 |
| 1235 self.visible = YES; | 1196 self.visible = YES; |
| 1236 | 1197 |
| 1237 // Restore hidden infobars. | 1198 // Restore hidden infobars. |
| 1238 if (IsIPadIdiom() && experimental_flags::IsTabSwitcherEnabled()) { | 1199 if (IsIPadIdiom()) { |
| 1239 _infoBarContainer->RestoreInfobars(); | 1200 _infoBarContainer->RestoreInfobars(); |
| 1240 } | 1201 } |
| 1241 | 1202 |
| 1242 // If the controller is suspended, or has been paged out due to low memory, | 1203 // If the controller is suspended, or has been paged out due to low memory, |
| 1243 // updating the view will be handled when it's displayed again. | 1204 // updating the view will be handled when it's displayed again. |
| 1244 if (![_model webUsageEnabled] || !self.contentArea) | 1205 if (![_model webUsageEnabled] || !self.contentArea) |
| 1245 return; | 1206 return; |
| 1246 // Update the displayed tab (if any; the switcher may not have created one | 1207 // Update the displayed tab (if any; the switcher may not have created one |
| 1247 // yet) in case it changed while showing the switcher. | 1208 // yet) in case it changed while showing the switcher. |
| 1248 Tab* currentTab = [_model currentTab]; | 1209 Tab* currentTab = [_model currentTab]; |
| 1249 if (currentTab) | 1210 if (currentTab) |
| 1250 [self displayTab:currentTab isNewSelection:YES]; | 1211 [self displayTab:currentTab isNewSelection:YES]; |
| 1251 } | 1212 } |
| 1252 | 1213 |
| 1253 - (void)viewWillDisappear:(BOOL)animated { | 1214 - (void)viewWillDisappear:(BOOL)animated { |
| 1254 self.viewVisible = NO; | 1215 self.viewVisible = NO; |
| 1255 [self updateDialogPresenterActiveState]; | 1216 [self updateDialogPresenterActiveState]; |
| 1256 [[_model currentTab] updateFullscreenWithToolbarVisible:YES]; | 1217 [[_model currentTab] updateFullscreenWithToolbarVisible:YES]; |
| 1257 [[_model currentTab] wasHidden]; | 1218 [[_model currentTab] wasHidden]; |
| 1258 [_bookmarkInteractionController dismissSnackbar]; | 1219 [_bookmarkInteractionController dismissSnackbar]; |
| 1259 if (IsIPadIdiom() && experimental_flags::IsTabSwitcherEnabled()) { | 1220 if (IsIPadIdiom()) { |
| 1260 _infoBarContainer->SuspendInfobars(); | 1221 _infoBarContainer->SuspendInfobars(); |
| 1261 } | 1222 } |
| 1262 [super viewWillDisappear:animated]; | 1223 [super viewWillDisappear:animated]; |
| 1263 } | 1224 } |
| 1264 | 1225 |
| 1265 - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orient | 1226 - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orient |
| 1266 duration:(NSTimeInterval)duration { | 1227 duration:(NSTimeInterval)duration { |
| 1267 [super willRotateToInterfaceOrientation:orient duration:duration]; | 1228 [super willRotateToInterfaceOrientation:orient duration:duration]; |
| 1268 [self dismissPopups]; | 1229 [self dismissPopups]; |
| 1269 [self reshowFindBarIfNeededWithCoordinator:nil]; | 1230 [self reshowFindBarIfNeededWithCoordinator:nil]; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1305 // as the BrowserViewController. | 1266 // as the BrowserViewController. |
| 1306 self.contentArea = nil; | 1267 self.contentArea = nil; |
| 1307 self.typingShield = nil; | 1268 self.typingShield = nil; |
| 1308 if (_voiceSearchController.get()) | 1269 if (_voiceSearchController.get()) |
| 1309 _voiceSearchController->SetDelegate(nil); | 1270 _voiceSearchController->SetDelegate(nil); |
| 1310 _qrScannerViewController.reset(); | 1271 _qrScannerViewController.reset(); |
| 1311 _toolbarController.reset(); | 1272 _toolbarController.reset(); |
| 1312 _toolbarModelDelegate.reset(); | 1273 _toolbarModelDelegate.reset(); |
| 1313 _toolbarModelIOS.reset(); | 1274 _toolbarModelIOS.reset(); |
| 1314 _tabStripController.reset(); | 1275 _tabStripController.reset(); |
| 1315 _noTabsController.reset(); | |
| 1316 _sideSwipeController.reset(); | 1276 _sideSwipeController.reset(); |
| 1317 } | 1277 } |
| 1318 } | 1278 } |
| 1319 | 1279 |
| 1320 - (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { | 1280 - (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { |
| 1321 [super traitCollectionDidChange:previousTraitCollection]; | 1281 [super traitCollectionDidChange:previousTraitCollection]; |
| 1322 // TODO(crbug.com/527092): - traitCollectionDidChange: is not always forwarded | 1282 // TODO(crbug.com/527092): - traitCollectionDidChange: is not always forwarded |
| 1323 // because in some cases the presented view controller isn't a child of the | 1283 // because in some cases the presented view controller isn't a child of the |
| 1324 // BVC in the view controller hierarchy (some intervening object isn't a | 1284 // BVC in the view controller hierarchy (some intervening object isn't a |
| 1325 // view controller). | 1285 // view controller). |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1738 _toolbarController.reset([_dependencyFactory | 1698 _toolbarController.reset([_dependencyFactory |
| 1739 newWebToolbarControllerWithDelegate:self | 1699 newWebToolbarControllerWithDelegate:self |
| 1740 urlLoader:self | 1700 urlLoader:self |
| 1741 preloadProvider:_preloadController.get()]); | 1701 preloadProvider:_preloadController.get()]); |
| 1742 [_toolbarController setTabCount:[_model count]]; | 1702 [_toolbarController setTabCount:[_model count]]; |
| 1743 if (_voiceSearchController.get()) | 1703 if (_voiceSearchController.get()) |
| 1744 _voiceSearchController->SetDelegate(_toolbarController); | 1704 _voiceSearchController->SetDelegate(_toolbarController); |
| 1745 | 1705 |
| 1746 // If needed, create the tabstrip. | 1706 // If needed, create the tabstrip. |
| 1747 if (IsIPadIdiom()) { | 1707 if (IsIPadIdiom()) { |
| 1748 // Determine if it's incognito. Whether or not the toggle button is | |
| 1749 // visible is consolidated in logic elsewhere so it doesn't need to be set | |
| 1750 // here. | |
| 1751 _tabStripController.reset( | 1708 _tabStripController.reset( |
| 1752 [_dependencyFactory newTabStripControllerWithTabModel:_model]); | 1709 [_dependencyFactory newTabStripControllerWithTabModel:_model]); |
| 1753 _tabStripController.get().fullscreenDelegate = self; | 1710 _tabStripController.get().fullscreenDelegate = self; |
| 1754 [_tabStripController setHasTabSwitcherToggleSwitch: | |
| 1755 experimental_flags::IsTabSwitcherEnabled()]; | |
| 1756 | |
| 1757 // If set before the views are loaded, pass the mode toggle to the | |
| 1758 // toolbar controller (only needed if YES, defaults to NO). | |
| 1759 if (_modeToggleNeedsSetting) { | |
| 1760 _tabStripController.get().hasModeToggleSwitch = _modeToggleNeedsSetting; | |
| 1761 } | |
| 1762 } | 1711 } |
| 1763 | 1712 |
| 1764 // Create infobar container. | 1713 // Create infobar container. |
| 1765 if (!_infoBarContainerDelegate) { | 1714 if (!_infoBarContainerDelegate) { |
| 1766 _infoBarContainerDelegate.reset(new InfoBarContainerDelegateIOS(self)); | 1715 _infoBarContainerDelegate.reset(new InfoBarContainerDelegateIOS(self)); |
| 1767 _infoBarContainer.reset( | 1716 _infoBarContainer.reset( |
| 1768 new InfoBarContainerIOS(_infoBarContainerDelegate.get())); | 1717 new InfoBarContainerIOS(_infoBarContainerDelegate.get())); |
| 1769 } | 1718 } |
| 1770 } | 1719 } |
| 1771 | 1720 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1955 } | 1904 } |
| 1956 [[_toolbarController view] setHidden:hideToolbar]; | 1905 [[_toolbarController view] setHidden:hideToolbar]; |
| 1957 } | 1906 } |
| 1958 } | 1907 } |
| 1959 | 1908 |
| 1960 - (void)updateDialogPresenterActiveState { | 1909 - (void)updateDialogPresenterActiveState { |
| 1961 self.dialogPresenter.active = self.active && self.viewVisible; | 1910 self.dialogPresenter.active = self.active && self.viewVisible; |
| 1962 } | 1911 } |
| 1963 | 1912 |
| 1964 - (void)dismissPopups { | 1913 - (void)dismissPopups { |
| 1965 if (_noTabsController.get()) | 1914 [_toolbarController dismissToolsMenuPopup]; |
| 1966 [_noTabsController dismissToolsMenuPopup]; | |
| 1967 else | |
| 1968 [_toolbarController dismissToolsMenuPopup]; | |
| 1969 [self hidePageInfoPopupForView:nil]; | 1915 [self hidePageInfoPopupForView:nil]; |
| 1970 [_toolbarController dismissTabHistoryPopup]; | 1916 [_toolbarController dismissTabHistoryPopup]; |
| 1971 [[_model currentTab].webController recordStateInHistory]; | 1917 [[_model currentTab].webController recordStateInHistory]; |
| 1972 } | 1918 } |
| 1973 | 1919 |
| 1974 #pragma mark - Tap handling | 1920 #pragma mark - Tap handling |
| 1975 | 1921 |
| 1976 - (void)setLastTapPoint:(id)sender { | 1922 - (void)setLastTapPoint:(id)sender { |
| 1977 CGPoint center; | 1923 CGPoint center; |
| 1978 UIView* parentView = nil; | 1924 UIView* parentView = nil; |
| (...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3261 // the error on the main thread. | 3207 // the error on the main thread. |
| 3262 [self displayPrivacyErrorAlertOnMainQueue:errorMessage]; | 3208 [self displayPrivacyErrorAlertOnMainQueue:errorMessage]; |
| 3263 } else { | 3209 } else { |
| 3264 // TODO(noyau): Ideally I'd like to show an infobar with a link to switch to | 3210 // TODO(noyau): Ideally I'd like to show an infobar with a link to switch to |
| 3265 // the photo application. The current behaviour is to create the photo there | 3211 // the photo application. The current behaviour is to create the photo there |
| 3266 // but not providing any link to it is suboptimal. That's what Safari is | 3212 // but not providing any link to it is suboptimal. That's what Safari is |
| 3267 // doing, and what the PM want, but it doesn't make it right. | 3213 // doing, and what the PM want, but it doesn't make it right. |
| 3268 } | 3214 } |
| 3269 } | 3215 } |
| 3270 | 3216 |
| 3271 #pragma mark - No-tabs UI methods | |
| 3272 | |
| 3273 // Show the No-Tabs UI (hiding normal tab/web ui). | |
| 3274 - (void)showNoTabsUI { | |
| 3275 // The No-Tabs UI is only shown on tablet for non-incognito BVCs. (Incognito | |
| 3276 // mode does not have a No-Tabs UI; the user is simply shown the non-incognito | |
| 3277 // BVC when the last incognito tab is closed.) | |
| 3278 DCHECK(IsIPadIdiom()); | |
| 3279 DCHECK(!_isOffTheRecord); | |
| 3280 | |
| 3281 // The method showNoTabsUI is called asynchronously when the number of tabs | |
| 3282 // reaches zero. Do not show the no tabs UI if a tab was added in the mean | |
| 3283 // time. | |
| 3284 if ([_model count]) | |
| 3285 return; | |
| 3286 | |
| 3287 DCHECK([_model currentTab] == nil); | |
| 3288 DCHECK([_contentArea subviews].count == 0 || | |
| 3289 experimental_flags::IsTabSwitcherEnabled()); | |
| 3290 _noTabsController.reset([[NoTabsController alloc] initWithView:self.view]); | |
| 3291 | |
| 3292 // Close the tools popup menu if it is open, as its contents/location were | |
| 3293 // specific to being in the tabs UI. | |
| 3294 [_toolbarController dismissToolsMenuPopup]; | |
| 3295 | |
| 3296 // Immediately hide the web, toolbar, and tabstrip. | |
| 3297 [[_toolbarController view] setHidden:YES]; | |
| 3298 [[_tabStripController view] setHidden:YES]; | |
| 3299 | |
| 3300 // Set up the toggle switch animation, if needed. | |
| 3301 if ([self hasModeToggleSwitch]) { | |
| 3302 UIButton* animationStartButton = [_tabStripController modeToggleButton]; | |
| 3303 [_noTabsController installAnimationImageForButton:animationStartButton | |
| 3304 inView:self.view | |
| 3305 show:YES]; | |
| 3306 } | |
| 3307 | |
| 3308 [_noTabsController prepareForShowAnimation]; | |
| 3309 [UIView animateWithDuration:kNoTabsAnimationDuration | |
| 3310 animations:^{ | |
| 3311 [_noTabsController showNoTabsUI]; | |
| 3312 } | |
| 3313 completion:^(BOOL finished) { | |
| 3314 [_noTabsController showAnimationDidFinish]; | |
| 3315 [_noTabsController setHasModeToggleSwitch:[self hasModeToggleSwitch]]; | |
| 3316 }]; | |
| 3317 } | |
| 3318 | |
| 3319 // Hide the No-Tabs UI (restoring normal tab/web ui). | |
| 3320 - (void)dismissNoTabsUI { | |
| 3321 // The No-Tabs UI is only shown on tablet for non-incognito BVCs, so there is | |
| 3322 // no need to dismiss it for an incognito BVC. | |
| 3323 DCHECK(IsIPadIdiom()); | |
| 3324 if (_isOffTheRecord) | |
| 3325 return; | |
| 3326 | |
| 3327 // Set up the toggle switch animation, if needed. | |
| 3328 if ([self hasModeToggleSwitch]) { | |
| 3329 UIButton* animationEndButton = [_tabStripController modeToggleButton]; | |
| 3330 [_noTabsController installAnimationImageForButton:animationEndButton | |
| 3331 inView:self.view | |
| 3332 show:NO]; | |
| 3333 } | |
| 3334 | |
| 3335 [_noTabsController prepareForDismissAnimation]; | |
| 3336 | |
| 3337 // Pull the controller out of the scoped_nsobject so the animation blocks can | |
| 3338 // retain it. | |
| 3339 NoTabsController* noTabsController = _noTabsController.get(); | |
| 3340 [UIView animateWithDuration:kNoTabsAnimationDuration | |
| 3341 animations:^{ | |
| 3342 [noTabsController dismissNoTabsUI]; | |
| 3343 } | |
| 3344 completion:^(BOOL finished) { | |
| 3345 // When the animation is finished, remove all of the No-Tabs UI and | |
| 3346 // reshow the tabstrip, web toolbar, and web. | |
| 3347 [noTabsController dismissAnimationDidFinish]; | |
| 3348 [[_toolbarController view] setHidden:NO]; | |
| 3349 [[_tabStripController view] setHidden:NO]; | |
| 3350 }]; | |
| 3351 // Nullify the instance variable. The controller is retained by the animation. | |
| 3352 // Nullifying this variable prevents button press performed during the | |
| 3353 // animation to be routed to the noTabController. | |
| 3354 _noTabsController.reset(); | |
| 3355 } | |
| 3356 | |
| 3357 #pragma mark - Showing popups | 3217 #pragma mark - Showing popups |
| 3358 | 3218 |
| 3359 - (void)showToolsMenuPopup { | 3219 - (void)showToolsMenuPopup { |
| 3360 DCHECK(_browserState); | 3220 DCHECK(_browserState); |
| 3361 DCHECK(self.visible || self.dismissingModal); | 3221 DCHECK(self.visible || self.dismissingModal); |
| 3362 DCHECK(!_noTabsController); | |
| 3363 | 3222 |
| 3364 // Dismiss the omnibox (if open). | 3223 // Dismiss the omnibox (if open). |
| 3365 [_toolbarController cancelOmniboxEdit]; | 3224 [_toolbarController cancelOmniboxEdit]; |
| 3366 // Dismiss the soft keyboard (if open). | 3225 // Dismiss the soft keyboard (if open). |
| 3367 [[_model currentTab].webController dismissKeyboard]; | 3226 [[_model currentTab].webController dismissKeyboard]; |
| 3368 // Dismiss Find in Page focus. | 3227 // Dismiss Find in Page focus. |
| 3369 [self updateFindBar:NO shouldFocus:NO]; | 3228 [self updateFindBar:NO shouldFocus:NO]; |
| 3370 | 3229 |
| 3371 base::scoped_nsobject<ToolsMenuContext> context( | 3230 base::scoped_nsobject<ToolsMenuContext> context( |
| 3372 [[ToolsMenuContext alloc] initWithDisplayView:[self view]]); | 3231 [[ToolsMenuContext alloc] initWithDisplayView:[self view]]); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3449 [self webPageOrderedOpen:GURL(kPageInfoHelpCenterURL) | 3308 [self webPageOrderedOpen:GURL(kPageInfoHelpCenterURL) |
| 3450 referrer:web::Referrer() | 3309 referrer:web::Referrer() |
| 3451 windowName:nil | 3310 windowName:nil |
| 3452 inBackground:NO | 3311 inBackground:NO |
| 3453 appendTo:kCurrentTab]; | 3312 appendTo:kCurrentTab]; |
| 3454 [self hidePageInfoPopupForView:nil]; | 3313 [self hidePageInfoPopupForView:nil]; |
| 3455 } | 3314 } |
| 3456 | 3315 |
| 3457 - (void)showTabHistoryPopupForBackwardHistory { | 3316 - (void)showTabHistoryPopupForBackwardHistory { |
| 3458 DCHECK(self.visible || self.dismissingModal); | 3317 DCHECK(self.visible || self.dismissingModal); |
| 3459 DCHECK(!_noTabsController); | |
| 3460 | 3318 |
| 3461 // Dismiss the omnibox (if open). | 3319 // Dismiss the omnibox (if open). |
| 3462 [_toolbarController cancelOmniboxEdit]; | 3320 [_toolbarController cancelOmniboxEdit]; |
| 3463 // Dismiss the soft keyboard (if open). | 3321 // Dismiss the soft keyboard (if open). |
| 3464 Tab* tab = [_model currentTab]; | 3322 Tab* tab = [_model currentTab]; |
| 3465 [tab.webController dismissKeyboard]; | 3323 [tab.webController dismissKeyboard]; |
| 3466 | 3324 |
| 3467 DCHECK([tab navigationManager]); | 3325 DCHECK([tab navigationManager]); |
| 3468 CRWSessionController* sc = [tab navigationManager]->GetSessionController(); | 3326 CRWSessionController* sc = [tab navigationManager]->GetSessionController(); |
| 3469 [_toolbarController showTabHistoryPopupInView:[self view] | 3327 [_toolbarController showTabHistoryPopupInView:[self view] |
| 3470 withSessionEntries:[sc backwardEntries] | 3328 withSessionEntries:[sc backwardEntries] |
| 3471 forBackHistory:YES]; | 3329 forBackHistory:YES]; |
| 3472 } | 3330 } |
| 3473 | 3331 |
| 3474 - (void)showTabHistoryPopupForForwardHistory { | 3332 - (void)showTabHistoryPopupForForwardHistory { |
| 3475 DCHECK(self.visible || self.dismissingModal); | 3333 DCHECK(self.visible || self.dismissingModal); |
| 3476 DCHECK(!_noTabsController); | |
| 3477 | 3334 |
| 3478 // Dismiss the omnibox (if open). | 3335 // Dismiss the omnibox (if open). |
| 3479 [_toolbarController cancelOmniboxEdit]; | 3336 [_toolbarController cancelOmniboxEdit]; |
| 3480 // Dismiss the soft keyboard (if open). | 3337 // Dismiss the soft keyboard (if open). |
| 3481 Tab* tab = [_model currentTab]; | 3338 Tab* tab = [_model currentTab]; |
| 3482 [tab.webController dismissKeyboard]; | 3339 [tab.webController dismissKeyboard]; |
| 3483 | 3340 |
| 3484 DCHECK([tab navigationManager]); | 3341 DCHECK([tab navigationManager]); |
| 3485 CRWSessionController* sc = [tab navigationManager]->GetSessionController(); | 3342 CRWSessionController* sc = [tab navigationManager]->GetSessionController(); |
| 3486 [_toolbarController showTabHistoryPopupInView:[self view] | 3343 [_toolbarController showTabHistoryPopupInView:[self view] |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4023 case IDC_SHOW_MAIL_COMPOSER: | 3880 case IDC_SHOW_MAIL_COMPOSER: |
| 4024 [self showMailComposer:sender]; | 3881 [self showMailComposer:sender]; |
| 4025 break; | 3882 break; |
| 4026 case IDC_READER_MODE: | 3883 case IDC_READER_MODE: |
| 4027 [[_model currentTab] switchToReaderMode]; | 3884 [[_model currentTab] switchToReaderMode]; |
| 4028 break; | 3885 break; |
| 4029 case IDC_REQUEST_DESKTOP_SITE: | 3886 case IDC_REQUEST_DESKTOP_SITE: |
| 4030 [self enableDesktopUserAgent]; | 3887 [self enableDesktopUserAgent]; |
| 4031 break; | 3888 break; |
| 4032 case IDC_SHOW_TOOLS_MENU: { | 3889 case IDC_SHOW_TOOLS_MENU: { |
| 4033 // TODO(blundell): Change this if/else to | 3890 [self showToolsMenuPopup]; |
| 4034 // |DCHECK(!_noTabsController)| if/when the no tabs controller | |
| 4035 // becomes part of the responder chain. | |
| 4036 // The no tabs controller's toolbar should open the menu when in the | |
| 4037 // no-tabs UI. | |
| 4038 if (_noTabsController.get()) | |
| 4039 [_noTabsController showToolsMenuPopup]; | |
| 4040 else | |
| 4041 [self showToolsMenuPopup]; | |
| 4042 break; | 3891 break; |
| 4043 } | 3892 } |
| 4044 case IDC_SHOW_BOOKMARK_MANAGER: { | 3893 case IDC_SHOW_BOOKMARK_MANAGER: { |
| 4045 if (IsIPadIdiom()) { | 3894 if (IsIPadIdiom()) { |
| 4046 [self showAllBookmarks]; | 3895 [self showAllBookmarks]; |
| 4047 } else { | 3896 } else { |
| 4048 [self initializeBookmarkInteractionController]; | 3897 [self initializeBookmarkInteractionController]; |
| 4049 [_bookmarkInteractionController presentBookmarks]; | 3898 [_bookmarkInteractionController presentBookmarks]; |
| 4050 } | 3899 } |
| 4051 break; | 3900 break; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4134 break; | 3983 break; |
| 4135 } | 3984 } |
| 4136 } | 3985 } |
| 4137 | 3986 |
| 4138 - (void)closeCurrentTab { | 3987 - (void)closeCurrentTab { |
| 4139 Tab* currentTab = [_model currentTab]; | 3988 Tab* currentTab = [_model currentTab]; |
| 4140 NSUInteger tabIndex = [_model indexOfTab:currentTab]; | 3989 NSUInteger tabIndex = [_model indexOfTab:currentTab]; |
| 4141 if (tabIndex == NSNotFound) | 3990 if (tabIndex == NSNotFound) |
| 4142 return; | 3991 return; |
| 4143 | 3992 |
| 4144 // Take snapshot on iPad only if Tab switcher is enabled, if not just close | 3993 // TODO(xxx): Evaluate if a screenshot of the tab is needed on iPad. |
|
rohitrao (ping after 24h)
2017/02/01 18:34:34
Is there a bug for this?
jif
2017/02/03 12:55:51
Done.
| |
| 4145 // the tab. | |
| 4146 if (IsIPadIdiom() && !experimental_flags::IsTabSwitcherEnabled()) { | |
| 4147 [_model closeTabAtIndex:tabIndex]; | |
| 4148 return; | |
| 4149 } | |
| 4150 | |
| 4151 // Create image of tab for close animation. | 3994 // Create image of tab for close animation. |
| 4152 UIImageView* exitingPage = [self pageOpenCloseAnimationView]; | 3995 UIImageView* exitingPage = [self pageOpenCloseAnimationView]; |
| 4153 exitingPage.image = | 3996 exitingPage.image = |
| 4154 [currentTab updateSnapshotWithOverlay:YES visibleFrameOnly:YES]; | 3997 [currentTab updateSnapshotWithOverlay:YES visibleFrameOnly:YES]; |
| 4155 | 3998 |
| 4156 // Close the actual tab, and add its image as a subview. | 3999 // Close the actual tab, and add its image as a subview. |
| 4157 [_model closeTabAtIndex:tabIndex]; | 4000 [_model closeTabAtIndex:tabIndex]; |
| 4158 | 4001 |
| 4159 // Do not animate close in iPad. | 4002 // Do not animate close in iPad. |
| 4160 if (!IsIPadIdiom()) { | 4003 if (!IsIPadIdiom()) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4219 [[_model currentTab].findInPageController | 4062 [[_model currentTab].findInPageController |
| 4220 disableFindInPageWithCompletionHandler:^{ | 4063 disableFindInPageWithCompletionHandler:^{ |
| 4221 [self updateFindBar:NO shouldFocus:NO]; | 4064 [self updateFindBar:NO shouldFocus:NO]; |
| 4222 }]; | 4065 }]; |
| 4223 [_contextualSearchController movePanelOffscreen]; | 4066 [_contextualSearchController movePanelOffscreen]; |
| 4224 | 4067 |
| 4225 [_paymentRequestManager cancelRequest]; | 4068 [_paymentRequestManager cancelRequest]; |
| 4226 | 4069 |
| 4227 [_printController dismissAnimated:YES]; | 4070 [_printController dismissAnimated:YES]; |
| 4228 _printController.reset(); | 4071 _printController.reset(); |
| 4229 if (_noTabsController.get()) | 4072 [_toolbarController dismissToolsMenuPopup]; |
| 4230 [_noTabsController dismissToolsMenuPopup]; | |
| 4231 else | |
| 4232 [_toolbarController dismissToolsMenuPopup]; | |
| 4233 [_contextMenuCoordinator stop]; | 4073 [_contextMenuCoordinator stop]; |
| 4234 [self dismissRateThisAppDialog]; | 4074 [self dismissRateThisAppDialog]; |
| 4235 | 4075 |
| 4236 [_contentSuggestionsCoordinator stop]; | 4076 [_contentSuggestionsCoordinator stop]; |
| 4237 | 4077 |
| 4238 if (self.presentedViewController) { | 4078 if (self.presentedViewController) { |
| 4239 // Dismisses any other modal controllers that may be present, e.g. Recent | 4079 // Dismisses any other modal controllers that may be present, e.g. Recent |
| 4240 // Tabs. | 4080 // Tabs. |
| 4241 // Note that currently, some controllers like the bookmark ones were already | 4081 // Note that currently, some controllers like the bookmark ones were already |
| 4242 // dismissed (in this example in -dismissBookmarkModalControllerAnimated:), | 4082 // dismissed (in this example in -dismissBookmarkModalControllerAnimated:), |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4623 [[UpgradeCenter sharedInstance] tabWillClose:tab.tabId]; | 4463 [[UpgradeCenter sharedInstance] tabWillClose:tab.tabId]; |
| 4624 if ([model count] == 1) { // About to remove the last tab. | 4464 if ([model count] == 1) { // About to remove the last tab. |
| 4625 [_contextualSearchController setTab:nil]; | 4465 [_contextualSearchController setTab:nil]; |
| 4626 [_paymentRequestManager setWebState:nil]; | 4466 [_paymentRequestManager setWebState:nil]; |
| 4627 } | 4467 } |
| 4628 } | 4468 } |
| 4629 | 4469 |
| 4630 // Called when the number of tabs changes. Update the toolbar accordingly. | 4470 // Called when the number of tabs changes. Update the toolbar accordingly. |
| 4631 - (void)tabModelDidChangeTabCount:(TabModel*)model { | 4471 - (void)tabModelDidChangeTabCount:(TabModel*)model { |
| 4632 DCHECK(model == _model); | 4472 DCHECK(model == _model); |
| 4633 if ([_model count] == 1 && _noTabsController.get()) { | |
| 4634 [self dismissNoTabsUI]; | |
| 4635 } | |
| 4636 | |
| 4637 [_toolbarController setTabCount:[_model count]]; | 4473 [_toolbarController setTabCount:[_model count]]; |
| 4638 // If the iPad tab switcher feature is enabled, the tab switcher is shown | |
| 4639 // instead of the no tabs UI. Showing the tab switcher in that case is | |
| 4640 // done from the main controller. | |
| 4641 // If the iPad tab switcher feature is disabled and the number of tabs is | |
| 4642 // zero, ensure the no-tabs UI is visible (such as if the last tab was closed | |
| 4643 // programmatically from JS). This is done on a delay because the | |
| 4644 // notification happens while the tab is going away and trying to trigger a | |
| 4645 // change during teardown causes problems. | |
| 4646 BOOL showNoTabsUIOnIPad = | |
| 4647 IsIPadIdiom() && !experimental_flags::IsTabSwitcherEnabled(); | |
| 4648 if (![_model count] && showNoTabsUIOnIPad && !_isOffTheRecord) { | |
| 4649 [self performSelector:@selector(showNoTabsUI) | |
| 4650 withObject:nil | |
| 4651 afterDelay:0.01]; | |
| 4652 } | |
| 4653 } | 4474 } |
| 4654 | 4475 |
| 4655 #pragma mark - Upgrade Detection | 4476 #pragma mark - Upgrade Detection |
| 4656 | 4477 |
| 4657 - (void)showUpgrade:(UpgradeCenter*)center { | 4478 - (void)showUpgrade:(UpgradeCenter*)center { |
| 4658 // Add an infobar on all the open tabs. | 4479 // Add an infobar on all the open tabs. |
| 4659 for (Tab* tab in _model.get()) { | 4480 for (Tab* tab in _model.get()) { |
| 4660 NSString* tabId = tab.tabId; | 4481 NSString* tabId = tab.tabId; |
| 4661 DCHECK([tab infoBarManager]); | 4482 DCHECK([tab infoBarManager]); |
| 4662 [center addInfoBarToManager:[tab infoBarManager] forTabId:tabId]; | 4483 [center addInfoBarToManager:[tab infoBarManager] forTabId:tabId]; |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5168 | 4989 |
| 5169 - (UIView*)voiceSearchButton { | 4990 - (UIView*)voiceSearchButton { |
| 5170 return _voiceSearchButton; | 4991 return _voiceSearchButton; |
| 5171 } | 4992 } |
| 5172 | 4993 |
| 5173 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 4994 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
| 5174 return [self currentLogoAnimationControllerOwner]; | 4995 return [self currentLogoAnimationControllerOwner]; |
| 5175 } | 4996 } |
| 5176 | 4997 |
| 5177 @end | 4998 @end |
| OLD | NEW |