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

Side by Side Diff: ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.mm

Issue 2720983002: Remove windowName from CRWSessionController. (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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ui/tab_switcher/tab_switcher_controller.h" 5 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_controller.h"
6 6
7 #include "base/ios/block_types.h" 7 #include "base/ios/block_types.h"
8 #include "base/ios/weak_nsobject.h" 8 #include "base/ios/weak_nsobject.h"
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #include "base/metrics/user_metrics.h" 10 #include "base/metrics/user_metrics.h"
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 atIndex:(NSUInteger)position 828 atIndex:(NSUInteger)position
829 transition:(ui::PageTransition)transition 829 transition:(ui::PageTransition)transition
830 tabModel:(TabModel*)tabModel { 830 tabModel:(TabModel*)tabModel {
831 web::NavigationManager::WebLoadParams params(URL); 831 web::NavigationManager::WebLoadParams params(URL);
832 params.referrer = web::Referrer(); 832 params.referrer = web::Referrer();
833 params.transition_type = transition; 833 params.transition_type = transition;
834 834
835 DCHECK(tabModel.browserState); 835 DCHECK(tabModel.browserState);
836 836
837 base::scoped_nsobject<Tab> tab([[Tab alloc] 837 base::scoped_nsobject<Tab> tab([[Tab alloc]
838 initWithWindowName:nil 838 initWithBrowserState:tabModel.browserState
839 opener:nil 839 opener:nil
840 openedByDOM:NO 840 openedByDOM:NO
841 model:tabModel 841 model:tabModel]);
842 browserState:tabModel.browserState]);
843 [tab webController].webUsageEnabled = tabModel.webUsageEnabled; 842 [tab webController].webUsageEnabled = tabModel.webUsageEnabled;
844 843
845 ProceduralBlock dismissWithNewTab = ^{ 844 ProceduralBlock dismissWithNewTab = ^{
846 NSUInteger tabIndex = position; 845 NSUInteger tabIndex = position;
847 if (position > tabModel.count) 846 if (position > tabModel.count)
848 tabIndex = tabModel.count; 847 tabIndex = tabModel.count;
849 [tabModel insertTab:tab atIndex:tabIndex]; 848 [tabModel insertTab:tab atIndex:tabIndex];
850 849
851 if (tabModel.tabUsageRecorder) 850 if (tabModel.tabUsageRecorder)
852 tabModel.tabUsageRecorder->TabCreatedForSelection(tab); 851 tabModel.tabUsageRecorder->TabCreatedForSelection(tab);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 sync_sessions::OpenTabsUIDelegate* openTabs = 891 sync_sessions::OpenTabsUIDelegate* openTabs =
893 IOSChromeProfileSyncServiceFactory::GetForBrowserState(_browserState) 892 IOSChromeProfileSyncServiceFactory::GetForBrowserState(_browserState)
894 ->GetOpenTabsUIDelegate(); 893 ->GetOpenTabsUIDelegate();
895 const sessions::SessionTab* toLoad = nullptr; 894 const sessions::SessionTab* toLoad = nullptr;
896 if (openTabs->GetForeignTab(distantTab->session_tag, distantTab->tab_id, 895 if (openTabs->GetForeignTab(distantTab->session_tag, distantTab->tab_id,
897 &toLoad)) { 896 &toLoad)) {
898 TabModel* mainModel = [_tabSwitcherModel mainTabModel]; 897 TabModel* mainModel = [_tabSwitcherModel mainTabModel];
899 // Disable user interactions until the tab is inserted to prevent multiple 898 // Disable user interactions until the tab is inserted to prevent multiple
900 // concurrent tab model updates. 899 // concurrent tab model updates.
901 [_tabSwitcherView setUserInteractionEnabled:NO]; 900 [_tabSwitcherView setUserInteractionEnabled:NO];
902 Tab* tab = [mainModel insertOrUpdateTabWithURL:GURL() 901 Tab* tab = [mainModel insertTabWithURL:GURL()
903 referrer:web::Referrer() 902 referrer:web::Referrer()
904 transition:ui::PAGE_TRANSITION_TYPED 903 transition:ui::PAGE_TRANSITION_TYPED
905 windowName:nil 904 opener:nil
906 opener:nil 905 openedByDOM:NO
907 openedByDOM:NO 906 atIndex:NSNotFound
908 atIndex:NSNotFound 907 inBackground:NO];
909 inBackground:NO];
910 [tab loadSessionTab:toLoad]; 908 [tab loadSessionTab:toLoad];
911 [mainModel setCurrentTab:tab]; 909 [mainModel setCurrentTab:tab];
912 910
913 // Reenable touch events. 911 // Reenable touch events.
914 [_tabSwitcherView setUserInteractionEnabled:YES]; 912 [_tabSwitcherView setUserInteractionEnabled:YES];
915 [self 913 [self
916 tabSwitcherDismissWithModel:mainModel 914 tabSwitcherDismissWithModel:mainModel
917 animated:YES 915 animated:YES
918 withCompletion:^{ 916 withCompletion:^{
919 [self.delegate tabSwitcherDismissTransitionDidEnd:self]; 917 [self.delegate tabSwitcherDismissTransitionDidEnd:self];
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 base::UserMetricsAction("MobileTabSwitcherCloseNonIncognitoTab")); 1236 base::UserMetricsAction("MobileTabSwitcherCloseNonIncognitoTab"));
1239 } 1237 }
1240 } 1238 }
1241 1239
1242 - (void)tabSwitcherPanelControllerDidUpdateOverlayViewVisibility: 1240 - (void)tabSwitcherPanelControllerDidUpdateOverlayViewVisibility:
1243 (TabSwitcherPanelController*)tabSwitcherPanelController { 1241 (TabSwitcherPanelController*)tabSwitcherPanelController {
1244 [_tabSwitcherView updateOverlayButtonState]; 1242 [_tabSwitcherView updateOverlayButtonState];
1245 } 1243 }
1246 1244
1247 @end 1245 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/stack_view/stack_view_controller.mm ('k') | ios/chrome/browser/ui/url_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698