Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Side by Side Diff: ios/chrome/browser/tabs/tab_model.mm

Issue 2724073005: Remove NavigationManager::GetPreviousItem(). (Closed)
Patch Set: Address comments. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/tabs/tab_model.h ('k') | ios/web/navigation/crw_session_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_model.h" 5 #import "ios/chrome/browser/tabs/tab_model.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 // to WebStateList, this function will return a std::unique_ptr<> and the 750 // to WebStateList, this function will return a std::unique_ptr<> and the
751 // object destroyed as expected, so it will fine to ignore the result then 751 // object destroyed as expected, so it will fine to ignore the result then
752 // too. See http://crbug.com/546222 for progress of changing the ownership 752 // too. See http://crbug.com/546222 for progress of changing the ownership
753 // of the WebStates. 753 // of the WebStates.
754 ignore_result(_webStateList.DetachWebStateAt(closedTabIndex)); 754 ignore_result(_webStateList.DetachWebStateAt(closedTabIndex));
755 755
756 if (needToSaveSession) 756 if (needToSaveSession)
757 [self saveSessionImmediately:NO]; 757 [self saveSessionImmediately:NO];
758 } 758 }
759 759
760 - (void)navigationCommittedInTab:(Tab*)tab { 760 - (void)navigationCommittedInTab:(Tab*)tab
761 previousItem:(web::NavigationItem*)previousItem {
761 if (self.offTheRecord) 762 if (self.offTheRecord)
762 return; 763 return;
763 if (![tab navigationManager]) 764 if (![tab navigationManager])
764 return; 765 return;
765 766
766 // See if the navigation was within a page; if so ignore it. 767 // See if the navigation was within a page; if so ignore it.
767 web::NavigationItem* previousItem =
768 [tab navigationManagerImpl]->GetPreviousItem();
769 if (previousItem) { 768 if (previousItem) {
770 GURL previousURL = previousItem->GetURL(); 769 GURL previousURL = previousItem->GetURL();
771 GURL currentURL = [tab navigationManager]->GetVisibleItem()->GetURL(); 770 GURL currentURL = [tab navigationManager]->GetVisibleItem()->GetURL();
772 771
773 url::Replacements<char> replacements; 772 url::Replacements<char> replacements;
774 replacements.ClearRef(); 773 replacements.ClearRef();
775 if (previousURL.ReplaceComponents(replacements) == 774 if (previousURL.ReplaceComponents(replacements) ==
776 currentURL.ReplaceComponents(replacements)) { 775 currentURL.ReplaceComponents(replacements)) {
777 return; 776 return;
778 } 777 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 } 964 }
966 965
967 // Called when UIApplicationWillEnterForegroundNotification is received. 966 // Called when UIApplicationWillEnterForegroundNotification is received.
968 - (void)applicationWillEnterForeground:(NSNotification*)notify { 967 - (void)applicationWillEnterForeground:(NSNotification*)notify {
969 if (_tabUsageRecorder) { 968 if (_tabUsageRecorder) {
970 _tabUsageRecorder->AppWillEnterForeground(); 969 _tabUsageRecorder->AppWillEnterForeground();
971 } 970 }
972 } 971 }
973 972
974 @end 973 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab_model.h ('k') | ios/web/navigation/crw_session_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698