| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 #include "ios/chrome/browser/web/network_activity_indicator_tab_helper.h" | 118 #include "ios/chrome/browser/web/network_activity_indicator_tab_helper.h" |
| 119 #import "ios/chrome/browser/web/passkit_dialog_provider.h" | 119 #import "ios/chrome/browser/web/passkit_dialog_provider.h" |
| 120 #include "ios/chrome/browser/web/print_observer.h" | 120 #include "ios/chrome/browser/web/print_observer.h" |
| 121 #import "ios/chrome/browser/web/repost_form_tab_helper.h" | 121 #import "ios/chrome/browser/web/repost_form_tab_helper.h" |
| 122 #import "ios/chrome/browser/xcallback_parameters.h" | 122 #import "ios/chrome/browser/xcallback_parameters.h" |
| 123 #include "ios/chrome/grit/ios_strings.h" | 123 #include "ios/chrome/grit/ios_strings.h" |
| 124 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 124 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 125 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_metad
ata.h" | 125 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_metad
ata.h" |
| 126 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white
list_manager.h" | 126 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_white
list_manager.h" |
| 127 #import "ios/web/navigation/crw_session_controller.h" | 127 #import "ios/web/navigation/crw_session_controller.h" |
| 128 #import "ios/web/navigation/crw_session_entry.h" | |
| 129 #import "ios/web/navigation/navigation_item_impl.h" | 128 #import "ios/web/navigation/navigation_item_impl.h" |
| 130 #import "ios/web/navigation/navigation_manager_impl.h" | 129 #import "ios/web/navigation/navigation_manager_impl.h" |
| 131 #include "ios/web/public/favicon_status.h" | 130 #include "ios/web/public/favicon_status.h" |
| 132 #include "ios/web/public/favicon_url.h" | 131 #include "ios/web/public/favicon_url.h" |
| 133 #include "ios/web/public/interstitials/web_interstitial.h" | 132 #include "ios/web/public/interstitials/web_interstitial.h" |
| 134 #import "ios/web/public/navigation_manager.h" | 133 #import "ios/web/public/navigation_manager.h" |
| 135 #include "ios/web/public/referrer.h" | 134 #include "ios/web/public/referrer.h" |
| 136 #include "ios/web/public/ssl_status.h" | 135 #include "ios/web/public/ssl_status.h" |
| 137 #include "ios/web/public/url_scheme_util.h" | 136 #include "ios/web/public/url_scheme_util.h" |
| 138 #include "ios/web/public/url_util.h" | 137 #include "ios/web/public/url_util.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // C++ bridge that receives notifications from the FaviconDriver. | 308 // C++ bridge that receives notifications from the FaviconDriver. |
| 310 std::unique_ptr<FaviconDriverObserverBridge> faviconDriverObserverBridge_; | 309 std::unique_ptr<FaviconDriverObserverBridge> faviconDriverObserverBridge_; |
| 311 | 310 |
| 312 // U2F call controller object. | 311 // U2F call controller object. |
| 313 base::scoped_nsobject<U2FController> U2FController_; | 312 base::scoped_nsobject<U2FController> U2FController_; |
| 314 | 313 |
| 315 // C++ observer used to trigger snapshots after the removal of InfoBars. | 314 // C++ observer used to trigger snapshots after the removal of InfoBars. |
| 316 std::unique_ptr<TabInfoBarObserver> tabInfoBarObserver_; | 315 std::unique_ptr<TabInfoBarObserver> tabInfoBarObserver_; |
| 317 } | 316 } |
| 318 | 317 |
| 319 // Returns the current sessionEntry for the sesionController associated with | 318 // Returns the current NavigationItem for the sesionController associated with |
| 320 // this tab. Don't use this to get the underlying NavigationItem; instead | 319 // this tab. Don't use this to get the underlying NavigationItem; instead |
| 321 // go through the NavigationManager. | 320 // go through the NavigationManager. |
| 322 // This is nil if there's no NavigationManager. | 321 // This is nil if there's no NavigationManager. |
| 323 @property(nonatomic, readonly) CRWSessionEntry* currentSessionEntry; | 322 @property(nonatomic, readonly) web::NavigationItem* currentNavigationItem; |
| 324 | 323 |
| 325 // Returns the tab's reader mode controller. May contain nil if the feature is | 324 // Returns the tab's reader mode controller. May contain nil if the feature is |
| 326 // disabled. | 325 // disabled. |
| 327 @property(nonatomic, readonly) ReaderModeController* readerModeController; | 326 @property(nonatomic, readonly) ReaderModeController* readerModeController; |
| 328 | 327 |
| 329 // Returns a list of FormSuggestionProviders to be queried for suggestions | 328 // Returns a list of FormSuggestionProviders to be queried for suggestions |
| 330 // in order of priority. | 329 // in order of priority. |
| 331 - (NSArray*)suggestionProviders; | 330 - (NSArray*)suggestionProviders; |
| 332 | 331 |
| 333 // Returns a list of FormInputAccessoryViewProviders to be queried for an input | 332 // Returns a list of FormInputAccessoryViewProviders to be queried for an input |
| (...skipping 14 matching lines...) Expand all Loading... |
| 348 | 347 |
| 349 // Returns the OpenInController for this tab. | 348 // Returns the OpenInController for this tab. |
| 350 - (OpenInController*)openInController; | 349 - (OpenInController*)openInController; |
| 351 | 350 |
| 352 // Calls the model and ask to close this tab. | 351 // Calls the model and ask to close this tab. |
| 353 - (void)closeThisTab; | 352 - (void)closeThisTab; |
| 354 | 353 |
| 355 // Initialize the Native App Launcher controller. | 354 // Initialize the Native App Launcher controller. |
| 356 - (void)initNativeAppNavigationController; | 355 - (void)initNativeAppNavigationController; |
| 357 | 356 |
| 358 // YES if toEntry is behind fromEntry in the current history stack. | |
| 359 - (BOOL)navigationIsBackwards:(const CRWSessionEntry*)fromEntry | |
| 360 toEntry:(const CRWSessionEntry*)toEntry; | |
| 361 | |
| 362 // Opens a link in an external app. Returns YES iff |url| is launched in an | 357 // Opens a link in an external app. Returns YES iff |url| is launched in an |
| 363 // external app. | 358 // external app. |
| 364 - (BOOL)openExternalURL:(const GURL&)url linkClicked:(BOOL)linkClicked; | 359 - (BOOL)openExternalURL:(const GURL&)url linkClicked:(BOOL)linkClicked; |
| 365 | 360 |
| 366 // Handles exportable files if possible. | 361 // Handles exportable files if possible. |
| 367 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers; | 362 - (void)handleExportableFile:(net::HttpResponseHeaders*)headers; |
| 368 | 363 |
| 369 // Called after the session history is replaced, useful for updating members | 364 // Called after the session history is replaced, useful for updating members |
| 370 // with new sessionID. | 365 // with new sessionID. |
| 371 - (void)didReplaceSessionHistory; | 366 - (void)didReplaceSessionHistory; |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 - (void)retrieveSnapshot:(void (^)(UIImage*))callback { | 738 - (void)retrieveSnapshot:(void (^)(UIImage*))callback { |
| 744 [webControllerSnapshotHelper_ | 739 [webControllerSnapshotHelper_ |
| 745 retrieveSnapshotForWebController:self.webController | 740 retrieveSnapshotForWebController:self.webController |
| 746 sessionID:self.tabId | 741 sessionID:self.tabId |
| 747 withOverlays:[self snapshotOverlays] | 742 withOverlays:[self snapshotOverlays] |
| 748 callback:callback]; | 743 callback:callback]; |
| 749 } | 744 } |
| 750 | 745 |
| 751 - (const GURL&)url { | 746 - (const GURL&)url { |
| 752 // See note in header; this method should be removed. | 747 // See note in header; this method should be removed. |
| 753 web::NavigationItem* item = [[self currentSessionEntry] navigationItem]; | 748 web::NavigationItem* item = [self currentNavigationItem]; |
| 754 return item ? item->GetVirtualURL() : GURL::EmptyGURL(); | 749 return item ? item->GetVirtualURL() : GURL::EmptyGURL(); |
| 755 } | 750 } |
| 756 | 751 |
| 757 - (NSString*)title { | 752 - (NSString*)title { |
| 758 base::string16 title = webStateImpl_->GetTitle(); | 753 base::string16 title = webStateImpl_->GetTitle(); |
| 759 if (title.empty()) | 754 if (title.empty()) |
| 760 title = l10n_util::GetStringUTF16(IDS_DEFAULT_TAB_TITLE); | 755 title = l10n_util::GetStringUTF16(IDS_DEFAULT_TAB_TITLE); |
| 761 return base::SysUTF16ToNSString(title); | 756 return base::SysUTF16ToNSString(title); |
| 762 } | 757 } |
| 763 | 758 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 return; | 995 return; |
| 1001 | 996 |
| 1002 history::HistoryService* historyService = | 997 history::HistoryService* historyService = |
| 1003 ios::HistoryServiceFactory::GetForBrowserState( | 998 ios::HistoryServiceFactory::GetForBrowserState( |
| 1004 browserState_, ServiceAccessType::IMPLICIT_ACCESS); | 999 browserState_, ServiceAccessType::IMPLICIT_ACCESS); |
| 1005 DCHECK(historyService); | 1000 DCHECK(historyService); |
| 1006 historyService->SetPageTitle(self.url, base::SysNSStringToUTF16(title)); | 1001 historyService->SetPageTitle(self.url, base::SysNSStringToUTF16(title)); |
| 1007 } | 1002 } |
| 1008 | 1003 |
| 1009 - (void)addCurrentEntryToHistoryDB { | 1004 - (void)addCurrentEntryToHistoryDB { |
| 1010 DCHECK(self.currentSessionEntry); | 1005 DCHECK(self.currentNavigationItem); |
| 1011 // If incognito, don't update history. | 1006 // If incognito, don't update history. |
| 1012 if (browserState_->IsOffTheRecord()) | 1007 if (browserState_->IsOffTheRecord()) |
| 1013 return; | 1008 return; |
| 1014 | 1009 |
| 1015 web::NavigationItem* item = [self navigationManager]->GetVisibleItem(); | 1010 web::NavigationItem* item = [self navigationManager]->GetVisibleItem(); |
| 1016 | 1011 |
| 1017 // Do not update the history db for back/forward navigations. | 1012 // Do not update the history db for back/forward navigations. |
| 1018 // TODO(crbug.com/661667): We do not currently tag the entry with a | 1013 // TODO(crbug.com/661667): We do not currently tag the entry with a |
| 1019 // FORWARD_BACK transition. Fix. | 1014 // FORWARD_BACK transition. Fix. |
| 1020 if (item->GetTransitionType() & ui::PAGE_TRANSITION_FORWARD_BACK) | 1015 if (item->GetTransitionType() & ui::PAGE_TRANSITION_FORWARD_BACK) |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) == 0) { | 1119 (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) == 0) { |
| 1125 base::RecordAction(UserMetricsAction("MobileTabClobbered")); | 1120 base::RecordAction(UserMetricsAction("MobileTabClobbered")); |
| 1126 } | 1121 } |
| 1127 if ([parentTabModel_ tabUsageRecorder]) | 1122 if ([parentTabModel_ tabUsageRecorder]) |
| 1128 [parentTabModel_ tabUsageRecorder]->RecordPageLoadStart(self); | 1123 [parentTabModel_ tabUsageRecorder]->RecordPageLoadStart(self); |
| 1129 | 1124 |
| 1130 // Reset |isVoiceSearchResultsTab| since a new page is being navigated to. | 1125 // Reset |isVoiceSearchResultsTab| since a new page is being navigated to. |
| 1131 self.isVoiceSearchResultsTab = NO; | 1126 self.isVoiceSearchResultsTab = NO; |
| 1132 | 1127 |
| 1133 [[OmniboxGeolocationController sharedInstance] | 1128 [[OmniboxGeolocationController sharedInstance] |
| 1134 addLocationToNavigationItem:self.currentSessionEntry.navigationItem | 1129 addLocationToNavigationItem:self.currentNavigationItem |
| 1135 browserState:browserState_]; | 1130 browserState:browserState_]; |
| 1136 } | 1131 } |
| 1137 | 1132 |
| 1138 - (void)loadSessionTab:(const sessions::SessionTab*)sessionTab { | 1133 - (void)loadSessionTab:(const sessions::SessionTab*)sessionTab { |
| 1139 DCHECK(sessionTab); | 1134 DCHECK(sessionTab); |
| 1140 [self replaceHistoryWithNavigations:sessionTab->navigations | 1135 [self replaceHistoryWithNavigations:sessionTab->navigations |
| 1141 currentIndex:sessionTab->current_navigation_index]; | 1136 currentIndex:sessionTab->current_navigation_index]; |
| 1142 } | 1137 } |
| 1143 | 1138 |
| 1144 - (void)reload { | 1139 - (void)reload { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 | 1225 |
| 1231 LegacyTabHelper::RemoveFromWebState(webStateImpl_.get()); | 1226 LegacyTabHelper::RemoveFromWebState(webStateImpl_.get()); |
| 1232 webStateImpl_.reset(); | 1227 webStateImpl_.reset(); |
| 1233 } | 1228 } |
| 1234 | 1229 |
| 1235 - (void)dismissModals { | 1230 - (void)dismissModals { |
| 1236 [openInController_ disable]; | 1231 [openInController_ disable]; |
| 1237 [self.webController dismissModals]; | 1232 [self.webController dismissModals]; |
| 1238 } | 1233 } |
| 1239 | 1234 |
| 1240 - (CRWSessionEntry*)currentSessionEntry { | 1235 - (web::NavigationItem*)currentNavigationItem { |
| 1241 if (![self navigationManager]) | 1236 if (![self navigationManager]) |
| 1242 return nil; | 1237 return nil; |
| 1243 return [[self navigationManager]->GetSessionController() currentEntry]; | 1238 return [[self navigationManager]->GetSessionController() currentItem]; |
| 1244 } | 1239 } |
| 1245 | 1240 |
| 1246 - (void)setShouldObserveInfoBarManager:(BOOL)shouldObserveInfoBarManager { | 1241 - (void)setShouldObserveInfoBarManager:(BOOL)shouldObserveInfoBarManager { |
| 1247 tabInfoBarObserver_->SetShouldObserveInfoBarManager( | 1242 tabInfoBarObserver_->SetShouldObserveInfoBarManager( |
| 1248 shouldObserveInfoBarManager); | 1243 shouldObserveInfoBarManager); |
| 1249 } | 1244 } |
| 1250 | 1245 |
| 1251 - (void)setShouldObserveFaviconChanges:(BOOL)shouldObserveFaviconChanges { | 1246 - (void)setShouldObserveFaviconChanges:(BOOL)shouldObserveFaviconChanges { |
| 1252 if (shouldObserveFaviconChanges) { | 1247 if (shouldObserveFaviconChanges) { |
| 1253 favicon::FaviconDriver* faviconDriver = | 1248 favicon::FaviconDriver* faviconDriver = |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1279 } | 1274 } |
| 1280 | 1275 |
| 1281 - (BOOL)canGoBack { | 1276 - (BOOL)canGoBack { |
| 1282 return self.navigationManager && self.navigationManager->CanGoBack(); | 1277 return self.navigationManager && self.navigationManager->CanGoBack(); |
| 1283 } | 1278 } |
| 1284 | 1279 |
| 1285 - (BOOL)canGoForward { | 1280 - (BOOL)canGoForward { |
| 1286 return self.navigationManager && self.navigationManager->CanGoForward(); | 1281 return self.navigationManager && self.navigationManager->CanGoForward(); |
| 1287 } | 1282 } |
| 1288 | 1283 |
| 1289 - (void)goToEntry:(CRWSessionEntry*)entry { | 1284 - (void)goToItem:(const web::NavigationItem*)item { |
| 1290 DCHECK(entry); | 1285 DCHECK(item); |
| 1291 | 1286 |
| 1292 if (self.navigationManager) { | 1287 if (self.navigationManager) { |
| 1293 CRWSessionController* sessionController = | 1288 CRWSessionController* sessionController = |
| 1294 self.navigationManager->GetSessionController(); | 1289 self.navigationManager->GetSessionController(); |
| 1295 DCHECK([sessionController.entries containsObject:entry]); | 1290 NSInteger itemIndex = [sessionController indexOfItem:item]; |
| 1296 NSUInteger index = [sessionController.entries indexOfObject:entry]; | 1291 DCHECK_NE(itemIndex, NSNotFound); |
| 1297 self.navigationManager->GoToIndex(index); | 1292 self.navigationManager->GoToIndex(itemIndex); |
| 1298 } | 1293 } |
| 1299 } | 1294 } |
| 1300 | 1295 |
| 1301 - (BOOL)openExternalURL:(const GURL&)url linkClicked:(BOOL)linkClicked { | 1296 - (BOOL)openExternalURL:(const GURL&)url linkClicked:(BOOL)linkClicked { |
| 1302 if (!externalAppLauncher_.get()) | 1297 if (!externalAppLauncher_.get()) |
| 1303 externalAppLauncher_.reset([[ExternalAppLauncher alloc] init]); | 1298 externalAppLauncher_.reset([[ExternalAppLauncher alloc] init]); |
| 1304 | 1299 |
| 1305 // This method may release CRWWebController which may cause a crash | 1300 // This method may release CRWWebController which may cause a crash |
| 1306 // (crbug.com/393949). | 1301 // (crbug.com/393949). |
| 1307 [[self.webController retain] autorelease]; | 1302 [[self.webController retain] autorelease]; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 [self.readerModeController exitReaderMode]; | 1507 [self.readerModeController exitReaderMode]; |
| 1513 } | 1508 } |
| 1514 | 1509 |
| 1515 #pragma mark - | 1510 #pragma mark - |
| 1516 | 1511 |
| 1517 - (void)openAppStore:(NSString*)appId { | 1512 - (void)openAppStore:(NSString*)appId { |
| 1518 [storeKitLauncher_ openAppStore:appId]; | 1513 [storeKitLauncher_ openAppStore:appId]; |
| 1519 } | 1514 } |
| 1520 | 1515 |
| 1521 - (BOOL)useDesktopUserAgent { | 1516 - (BOOL)useDesktopUserAgent { |
| 1522 web::NavigationItem* currentItem = self.currentSessionEntry.navigationItem; | 1517 web::NavigationItem* currentItem = self.currentNavigationItem; |
| 1523 return currentItem && currentItem->IsOverridingUserAgent(); | 1518 return currentItem && currentItem->IsOverridingUserAgent(); |
| 1524 } | 1519 } |
| 1525 | 1520 |
| 1526 - (void)enableDesktopUserAgent { | 1521 - (void)enableDesktopUserAgent { |
| 1527 DCHECK_EQ(self.useDesktopUserAgent, NO); | 1522 DCHECK_EQ(self.useDesktopUserAgent, NO); |
| 1528 DCHECK([self navigationManager]); | 1523 DCHECK([self navigationManager]); |
| 1529 [[self navigationManager]->GetSessionController() | 1524 [[self navigationManager]->GetSessionController() |
| 1530 useDesktopUserAgentForNextPendingItem]; | 1525 useDesktopUserAgentForNextPendingItem]; |
| 1531 } | 1526 } |
| 1532 | 1527 |
| 1533 - (void)reloadForDesktopUserAgent { | 1528 - (void)reloadForDesktopUserAgent { |
| 1534 // |loadWithParams| will recreate the removed UIWebView. | 1529 // |loadWithParams| will recreate the removed UIWebView. |
| 1535 [self.webController requirePageReconstruction]; | 1530 [self.webController requirePageReconstruction]; |
| 1536 | 1531 |
| 1537 // TODO(crbug.com/228171): A hack in session_controller -addPendingItem | 1532 // TODO(crbug.com/228171): A hack in session_controller -addPendingItem |
| 1538 // discusses making tab responsible for distinguishing history stack | 1533 // discusses making tab responsible for distinguishing history stack |
| 1539 // navigation from new navigations. Because we want a new navigation here, we | 1534 // navigation from new navigations. Because we want a new navigation here, we |
| 1540 // use |PAGE_TRANSITION_FORM_SUBMIT|. When session_controller changes, so | 1535 // use |PAGE_TRANSITION_FORM_SUBMIT|. When session_controller changes, so |
| 1541 // should this. | 1536 // should this. |
| 1542 ui::PageTransition transition = | 1537 ui::PageTransition transition = |
| 1543 ui::PageTransitionFromInt(ui::PAGE_TRANSITION_FORM_SUBMIT); | 1538 ui::PageTransitionFromInt(ui::PAGE_TRANSITION_FORM_SUBMIT); |
| 1544 DCHECK([self navigationManager]); | 1539 DCHECK([self navigationManager]); |
| 1545 CRWSessionController* sessionController = | 1540 CRWSessionController* sessionController = |
| 1546 [self navigationManager]->GetSessionController(); | 1541 [self navigationManager]->GetSessionController(); |
| 1547 CRWSessionEntry* lastUserEntry = [sessionController lastUserEntry]; | 1542 web::NavigationItem* lastUserItem = [sessionController lastUserItem]; |
| 1548 if (!lastUserEntry) | 1543 if (!lastUserItem) |
| 1549 return; | 1544 return; |
| 1550 | 1545 |
| 1551 // |originalUrl| will be empty if a page was open by DOM. | 1546 // |originalUrl| will be empty if a page was open by DOM. |
| 1552 GURL reloadURL(lastUserEntry.navigationItem->GetOriginalRequestURL()); | 1547 GURL reloadURL(lastUserItem->GetOriginalRequestURL()); |
| 1553 if (reloadURL.is_empty()) { | 1548 if (reloadURL.is_empty()) { |
| 1554 DCHECK(sessionController.openedByDOM); | 1549 DCHECK(sessionController.openedByDOM); |
| 1555 reloadURL = [lastUserEntry navigationItem]->GetVirtualURL(); | 1550 reloadURL = lastUserItem->GetVirtualURL(); |
| 1556 } | 1551 } |
| 1557 | 1552 |
| 1558 web::NavigationManager::WebLoadParams params(reloadURL); | 1553 web::NavigationManager::WebLoadParams params(reloadURL); |
| 1559 params.referrer = lastUserEntry.navigationItem->GetReferrer(); | 1554 params.referrer = lastUserItem->GetReferrer(); |
| 1560 params.transition_type = transition; | 1555 params.transition_type = transition; |
| 1561 if (self.navigationManager) | 1556 if (self.navigationManager) |
| 1562 self.navigationManager->LoadURLWithParams(params); | 1557 self.navigationManager->LoadURLWithParams(params); |
| 1563 } | 1558 } |
| 1564 | 1559 |
| 1565 - (id<SnapshotOverlayProvider>)snapshotOverlayProvider { | 1560 - (id<SnapshotOverlayProvider>)snapshotOverlayProvider { |
| 1566 return snapshotOverlayProvider_.get(); | 1561 return snapshotOverlayProvider_.get(); |
| 1567 } | 1562 } |
| 1568 | 1563 |
| 1569 - (void)setSnapshotOverlayProvider: | 1564 - (void)setSnapshotOverlayProvider: |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1733 DCHECK(self.webController.loadPhase == web::PAGE_LOADED); | 1728 DCHECK(self.webController.loadPhase == web::PAGE_LOADED); |
| 1734 | 1729 |
| 1735 // Cancel prerendering if response is "application/octet-stream". It can be a | 1730 // Cancel prerendering if response is "application/octet-stream". It can be a |
| 1736 // video file which should not be played from preload tab (crbug.com/436813). | 1731 // video file which should not be played from preload tab (crbug.com/436813). |
| 1737 if (isPrerenderTab_ && | 1732 if (isPrerenderTab_ && |
| 1738 self.webState->GetContentsMimeType() == "application/octet-stream") { | 1733 self.webState->GetContentsMimeType() == "application/octet-stream") { |
| 1739 [delegate_ discardPrerender]; | 1734 [delegate_ discardPrerender]; |
| 1740 } | 1735 } |
| 1741 | 1736 |
| 1742 bool wasPost = false; | 1737 bool wasPost = false; |
| 1743 if (self.currentSessionEntry) | 1738 if (self.currentNavigationItem) |
| 1744 wasPost = self.currentSessionEntry.navigationItem->HasPostData(); | 1739 wasPost = self.currentNavigationItem->HasPostData(); |
| 1745 GURL lastCommittedURL = self.webState->GetLastCommittedURL(); | 1740 GURL lastCommittedURL = self.webState->GetLastCommittedURL(); |
| 1746 if (loadSuccess) | 1741 if (loadSuccess) |
| 1747 [autoReloadBridge_ loadFinishedForURL:lastCommittedURL wasPost:wasPost]; | 1742 [autoReloadBridge_ loadFinishedForURL:lastCommittedURL wasPost:wasPost]; |
| 1748 else | 1743 else |
| 1749 [autoReloadBridge_ loadFailedForURL:lastCommittedURL wasPost:wasPost]; | 1744 [autoReloadBridge_ loadFailedForURL:lastCommittedURL wasPost:wasPost]; |
| 1750 [webControllerSnapshotHelper_ setSnapshotCoalescingEnabled:YES]; | 1745 [webControllerSnapshotHelper_ setSnapshotCoalescingEnabled:YES]; |
| 1751 if (!loadSuccess) { | 1746 if (!loadSuccess) { |
| 1752 [fullScreenController_ disableFullScreen]; | 1747 [fullScreenController_ disableFullScreen]; |
| 1753 } | 1748 } |
| 1754 [self recordInterfaceOrientation]; | 1749 [self recordInterfaceOrientation]; |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2181 [inputAccessoryViewController_ wasShown]; | 2176 [inputAccessoryViewController_ wasShown]; |
| 2182 } | 2177 } |
| 2183 | 2178 |
| 2184 - (void)wasHidden { | 2179 - (void)wasHidden { |
| 2185 visible_ = NO; | 2180 visible_ = NO; |
| 2186 [self updateFullscreenWithToolbarVisible:YES]; | 2181 [self updateFullscreenWithToolbarVisible:YES]; |
| 2187 [self.webController wasHidden]; | 2182 [self.webController wasHidden]; |
| 2188 [inputAccessoryViewController_ wasHidden]; | 2183 [inputAccessoryViewController_ wasHidden]; |
| 2189 } | 2184 } |
| 2190 | 2185 |
| 2191 - (BOOL)navigationIsBackwards:(const CRWSessionEntry*)fromEntry | |
| 2192 toEntry:(const CRWSessionEntry*)toEntry { | |
| 2193 DCHECK([self navigationManager]); | |
| 2194 NSArray* entries = [self navigationManager]->GetSessionController().entries; | |
| 2195 NSInteger fromIndex = [entries indexOfObject:fromEntry]; | |
| 2196 NSInteger toIndex = [entries indexOfObject:toEntry]; | |
| 2197 return (fromIndex != NSNotFound && toIndex != NSNotFound && | |
| 2198 fromIndex > toIndex); | |
| 2199 } | |
| 2200 | |
| 2201 @end | 2186 @end |
| 2202 | 2187 |
| 2203 #pragma mark - TestingSupport | 2188 #pragma mark - TestingSupport |
| 2204 | 2189 |
| 2205 @implementation Tab (TestingSupport) | 2190 @implementation Tab (TestingSupport) |
| 2206 | 2191 |
| 2207 - (void)replaceExternalAppLauncher:(id)externalAppLauncher { | 2192 - (void)replaceExternalAppLauncher:(id)externalAppLauncher { |
| 2208 externalAppLauncher_.reset([externalAppLauncher retain]); | 2193 externalAppLauncher_.reset([externalAppLauncher retain]); |
| 2209 } | 2194 } |
| 2210 | 2195 |
| 2211 - (TabModel*)parentTabModel { | 2196 - (TabModel*)parentTabModel { |
| 2212 return parentTabModel_; | 2197 return parentTabModel_; |
| 2213 } | 2198 } |
| 2214 | 2199 |
| 2215 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2200 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2216 return inputAccessoryViewController_.get(); | 2201 return inputAccessoryViewController_.get(); |
| 2217 } | 2202 } |
| 2218 | 2203 |
| 2219 @end | 2204 @end |
| OLD | NEW |