| 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_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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 // to WebStateList, this function will return a std::unique_ptr<> and the | 740 // to WebStateList, this function will return a std::unique_ptr<> and the |
| 741 // object destroyed as expected, so it will fine to ignore the result then | 741 // object destroyed as expected, so it will fine to ignore the result then |
| 742 // too. See http://crbug.com/546222 for progress of changing the ownership | 742 // too. See http://crbug.com/546222 for progress of changing the ownership |
| 743 // of the WebStates. | 743 // of the WebStates. |
| 744 ignore_result(_webStateList.DetachWebStateAt(closedTabIndex)); | 744 ignore_result(_webStateList.DetachWebStateAt(closedTabIndex)); |
| 745 | 745 |
| 746 if (needToSaveSession) | 746 if (needToSaveSession) |
| 747 [self saveSessionImmediately:NO]; | 747 [self saveSessionImmediately:NO]; |
| 748 } | 748 } |
| 749 | 749 |
| 750 - (void)navigationCommittedInTab:(Tab*)tab { | 750 - (void)navigationCommittedInTab:(Tab*)tab |
| 751 previousItem:(web::NavigationItem*)previousItem { |
| 751 if (self.offTheRecord) | 752 if (self.offTheRecord) |
| 752 return; | 753 return; |
| 753 if (![tab navigationManager]) | 754 if (![tab navigationManager]) |
| 754 return; | 755 return; |
| 755 | 756 |
| 756 // See if the navigation was within a page; if so ignore it. | 757 // See if the navigation was within a page; if so ignore it. |
| 757 web::NavigationItem* previousItem = | |
| 758 [tab navigationManagerImpl]->GetPreviousItem(); | |
| 759 if (previousItem) { | 758 if (previousItem) { |
| 760 GURL previousURL = previousItem->GetURL(); | 759 GURL previousURL = previousItem->GetURL(); |
| 761 GURL currentURL = [tab navigationManager]->GetVisibleItem()->GetURL(); | 760 GURL currentURL = [tab navigationManager]->GetVisibleItem()->GetURL(); |
| 762 | 761 |
| 763 url::Replacements<char> replacements; | 762 url::Replacements<char> replacements; |
| 764 replacements.ClearRef(); | 763 replacements.ClearRef(); |
| 765 if (previousURL.ReplaceComponents(replacements) == | 764 if (previousURL.ReplaceComponents(replacements) == |
| 766 currentURL.ReplaceComponents(replacements)) { | 765 currentURL.ReplaceComponents(replacements)) { |
| 767 return; | 766 return; |
| 768 } | 767 } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 } | 954 } |
| 956 | 955 |
| 957 // Called when UIApplicationWillEnterForegroundNotification is received. | 956 // Called when UIApplicationWillEnterForegroundNotification is received. |
| 958 - (void)applicationWillEnterForeground:(NSNotification*)notify { | 957 - (void)applicationWillEnterForeground:(NSNotification*)notify { |
| 959 if (_tabUsageRecorder) { | 958 if (_tabUsageRecorder) { |
| 960 _tabUsageRecorder->AppWillEnterForeground(); | 959 _tabUsageRecorder->AppWillEnterForeground(); |
| 961 } | 960 } |
| 962 } | 961 } |
| 963 | 962 |
| 964 @end | 963 @end |
| OLD | NEW |