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

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

Issue 2823623002: Remove usage of Tab's |url| property from TabModel. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | 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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 if (_tabUsageRecorder) 603 if (_tabUsageRecorder)
604 _tabUsageRecorder->RecordPrimaryTabModelChange(primary, self.currentTab); 604 _tabUsageRecorder->RecordPrimaryTabModelChange(primary, self.currentTab);
605 } 605 }
606 606
607 - (NSSet*)currentlyReferencedExternalFiles { 607 - (NSSet*)currentlyReferencedExternalFiles {
608 NSMutableSet* referencedFiles = [NSMutableSet set]; 608 NSMutableSet* referencedFiles = [NSMutableSet set];
609 if (!_browserState) 609 if (!_browserState)
610 return referencedFiles; 610 return referencedFiles;
611 // Check the currently open tabs for external files. 611 // Check the currently open tabs for external files.
612 for (Tab* tab in self) { 612 for (Tab* tab in self) {
613 if (UrlIsExternalFileReference(tab.url)) { 613 const GURL& URL = tab.lastCommittedURL;
614 NSString* fileName = base::SysUTF8ToNSString(tab.url.ExtractFileName()); 614 if (UrlIsExternalFileReference(URL)) {
615 NSString* fileName = base::SysUTF8ToNSString(URL.ExtractFileName());
kkhorimoto 2017/04/14 20:37:40 A file is currently reference if it's in the conte
Eugene But (OOO till 7-30) 2017/04/14 21:46:10 Should we include both lastCommitted and pending?
kkhorimoto 2017/05/31 22:30:04 Done.
615 [referencedFiles addObject:fileName]; 616 [referencedFiles addObject:fileName];
616 } 617 }
617 } 618 }
618 // Do the same for the recently closed tabs. 619 // Do the same for the recently closed tabs.
619 sessions::TabRestoreService* restoreService = 620 sessions::TabRestoreService* restoreService =
620 IOSChromeTabRestoreServiceFactory::GetForBrowserState(_browserState); 621 IOSChromeTabRestoreServiceFactory::GetForBrowserState(_browserState);
621 DCHECK(restoreService); 622 DCHECK(restoreService);
622 for (const auto& entry : restoreService->entries()) { 623 for (const auto& entry : restoreService->entries()) {
623 sessions::TabRestoreService::Tab* tab = 624 sessions::TabRestoreService::Tab* tab =
624 static_cast<sessions::TabRestoreService::Tab*>(entry.get()); 625 static_cast<sessions::TabRestoreService::Tab*>(entry.get());
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 766
766 if (persistState && self.currentTab) 767 if (persistState && self.currentTab)
767 [self.currentTab recordStateInHistory]; 768 [self.currentTab recordStateInHistory];
768 _webStateList->ActivateWebStateAt(static_cast<int>(selectedIndex)); 769 _webStateList->ActivateWebStateAt(static_cast<int>(selectedIndex));
769 } 770 }
770 771
771 // If there was only one tab and it was the new tab page, clobber it. 772 // If there was only one tab and it was the new tab page, clobber it.
772 BOOL closedNTPTab = NO; 773 BOOL closedNTPTab = NO;
773 if (oldCount == 1) { 774 if (oldCount == 1) {
774 Tab* tab = [self tabAtIndex:0]; 775 Tab* tab = [self tabAtIndex:0];
775 if (tab.url == GURL(kChromeUINewTabURL)) { 776 if (tab.lastCommittedURL == GURL(kChromeUINewTabURL)) {
kkhorimoto 2017/04/14 20:37:40 Loads aren't occurring during session restoration,
sdefresne 2017/04/18 15:54:34 This is also called when restoring a session after
kkhorimoto 2017/05/31 22:30:04 Done.
776 [self closeTab:tab]; 777 [self closeTab:tab];
777 closedNTPTab = YES; 778 closedNTPTab = YES;
778 oldCount = 0; 779 oldCount = 0;
779 } 780 }
780 } 781 }
781 if (_tabUsageRecorder) 782 if (_tabUsageRecorder)
782 _tabUsageRecorder->InitialRestoredTabs(self.currentTab, restoredTabs.get()); 783 _tabUsageRecorder->InitialRestoredTabs(self.currentTab, restoredTabs.get());
783 return closedNTPTab; 784 return closedNTPTab;
784 } 785 }
785 786
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 } 822 }
822 823
823 // Called when UIApplicationWillEnterForegroundNotification is received. 824 // Called when UIApplicationWillEnterForegroundNotification is received.
824 - (void)applicationWillEnterForeground:(NSNotification*)notify { 825 - (void)applicationWillEnterForeground:(NSNotification*)notify {
825 if (_tabUsageRecorder) { 826 if (_tabUsageRecorder) {
826 _tabUsageRecorder->AppWillEnterForeground(); 827 _tabUsageRecorder->AppWillEnterForeground();
827 } 828 }
828 } 829 }
829 830
830 @end 831 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698