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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 | 1340 |
1341 if (!finalURL.is_valid()) { | 1341 if (!finalURL.is_valid()) { |
1342 return NO; | 1342 return NO; |
1343 } | 1343 } |
1344 } | 1344 } |
1345 | 1345 |
1346 if ([externalAppLauncher_ openURL:finalURL linkClicked:linkClicked]) { | 1346 if ([externalAppLauncher_ openURL:finalURL linkClicked:linkClicked]) { |
1347 // Clears pending navigation history after successfully launching the | 1347 // Clears pending navigation history after successfully launching the |
1348 // external app. | 1348 // external app. |
1349 DCHECK([self navigationManager]); | 1349 DCHECK([self navigationManager]); |
1350 [[self navigationManager]->GetSessionController() | 1350 [[self navigationManager]->GetSessionController() discardNonCommittedItems]; |
1351 discardNonCommittedEntries]; | |
1352 // Ensure the UI reflects the current entry, not the just-discarded pending | 1351 // Ensure the UI reflects the current entry, not the just-discarded pending |
1353 // entry. | 1352 // entry. |
1354 [parentTabModel_ notifyTabChanged:self]; | 1353 [parentTabModel_ notifyTabChanged:self]; |
1355 return YES; | 1354 return YES; |
1356 } | 1355 } |
1357 return NO; | 1356 return NO; |
1358 } | 1357 } |
1359 | 1358 |
1360 - (void)webWillFinishHistoryNavigationFromEntry:(CRWSessionEntry*)fromEntry { | 1359 - (void)webWillFinishHistoryNavigationFromEntry:(CRWSessionEntry*)fromEntry { |
1361 [parentTabModel_ notifyTabChanged:self]; | 1360 [parentTabModel_ notifyTabChanged:self]; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 | 1526 |
1528 - (BOOL)useDesktopUserAgent { | 1527 - (BOOL)useDesktopUserAgent { |
1529 web::NavigationItem* currentItem = self.currentSessionEntry.navigationItem; | 1528 web::NavigationItem* currentItem = self.currentSessionEntry.navigationItem; |
1530 return currentItem && currentItem->IsOverridingUserAgent(); | 1529 return currentItem && currentItem->IsOverridingUserAgent(); |
1531 } | 1530 } |
1532 | 1531 |
1533 - (void)enableDesktopUserAgent { | 1532 - (void)enableDesktopUserAgent { |
1534 DCHECK_EQ(self.useDesktopUserAgent, NO); | 1533 DCHECK_EQ(self.useDesktopUserAgent, NO); |
1535 DCHECK([self navigationManager]); | 1534 DCHECK([self navigationManager]); |
1536 [[self navigationManager]->GetSessionController() | 1535 [[self navigationManager]->GetSessionController() |
1537 useDesktopUserAgentForNextPendingEntry]; | 1536 useDesktopUserAgentForNextPendingItem]; |
1538 } | 1537 } |
1539 | 1538 |
1540 - (void)reloadForDesktopUserAgent { | 1539 - (void)reloadForDesktopUserAgent { |
1541 // |loadWithParams| will recreate the removed UIWebView. | 1540 // |loadWithParams| will recreate the removed UIWebView. |
1542 [self.webController requirePageReconstruction]; | 1541 [self.webController requirePageReconstruction]; |
1543 | 1542 |
1544 // TODO(crbug.com/228171): A hack in session_controller -addPendingEntry | 1543 // TODO(crbug.com/228171): A hack in session_controller -addPendingItem |
1545 // discusses making tab responsible for distinguishing history stack | 1544 // discusses making tab responsible for distinguishing history stack |
1546 // navigation from new navigations. Because we want a new navigation here, we | 1545 // navigation from new navigations. Because we want a new navigation here, we |
1547 // use |PAGE_TRANSITION_FORM_SUBMIT|. When session_controller changes, so | 1546 // use |PAGE_TRANSITION_FORM_SUBMIT|. When session_controller changes, so |
1548 // should this. | 1547 // should this. |
1549 ui::PageTransition transition = | 1548 ui::PageTransition transition = |
1550 ui::PageTransitionFromInt(ui::PAGE_TRANSITION_FORM_SUBMIT); | 1549 ui::PageTransitionFromInt(ui::PAGE_TRANSITION_FORM_SUBMIT); |
1551 DCHECK([self navigationManager]); | 1550 DCHECK([self navigationManager]); |
1552 CRWSessionController* sessionController = | 1551 CRWSessionController* sessionController = |
1553 [self navigationManager]->GetSessionController(); | 1552 [self navigationManager]->GetSessionController(); |
1554 CRWSessionEntry* lastUserEntry = [sessionController lastUserEntry]; | 1553 CRWSessionEntry* lastUserEntry = [sessionController lastUserEntry]; |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2257 | 2256 |
2258 - (TabModel*)parentTabModel { | 2257 - (TabModel*)parentTabModel { |
2259 return parentTabModel_; | 2258 return parentTabModel_; |
2260 } | 2259 } |
2261 | 2260 |
2262 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2261 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
2263 return inputAccessoryViewController_.get(); | 2262 return inputAccessoryViewController_.get(); |
2264 } | 2263 } |
2265 | 2264 |
2266 @end | 2265 @end |
OLD | NEW |