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

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

Issue 2677263002: Remove unused parameter for -replaceTab:withTab:keepOldTabOpen:. (Closed)
Patch Set: Fix comment. Created 3 years, 10 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/chrome/browser/ui/browser_view_controller.mm » ('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 <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 return; 553 return;
554 } 554 }
555 555
556 base::scoped_nsobject<Tab> tabSaver([tab retain]); 556 base::scoped_nsobject<Tab> tabSaver([tab retain]);
557 [_tabs removeObject:tab]; 557 [_tabs removeObject:tab];
558 [_tabs insertObject:tab atIndex:toIndex]; 558 [_tabs insertObject:tab atIndex:toIndex];
559 559
560 [_observers tabModel:self didMoveTab:tab fromIndex:fromIndex toIndex:toIndex]; 560 [_observers tabModel:self didMoveTab:tab fromIndex:fromIndex toIndex:toIndex];
561 } 561 }
562 562
563 - (void)replaceTab:(Tab*)oldTab 563 - (void)replaceTab:(Tab*)oldTab withTab:(Tab*)newTab {
564 withTab:(Tab*)newTab
565 keepOldTabOpen:(BOOL)keepOldTabOpen {
566 NSUInteger index = [self indexOfTab:oldTab]; 564 NSUInteger index = [self indexOfTab:oldTab];
567 DCHECK_NE(NSNotFound, static_cast<NSInteger>(index)); 565 DCHECK_NE(NSNotFound, static_cast<NSInteger>(index));
568 566
569 base::scoped_nsobject<Tab> tabSaver([oldTab retain]); 567 base::scoped_nsobject<Tab> tabSaver([oldTab retain]);
570 [newTab fetchFavicon]; 568 [newTab fetchFavicon];
571 [_tabs replaceObjectAtIndex:index withObject:newTab]; 569 [_tabs replaceObjectAtIndex:index withObject:newTab];
572 [newTab setParentTabModel:self]; 570 [newTab setParentTabModel:self];
573 571
574 TabParentingGlobalObserver::GetInstance()->OnTabParented(newTab.webState); 572 TabParentingGlobalObserver::GetInstance()->OnTabParented(newTab.webState);
575 [_observers tabModel:self didReplaceTab:oldTab withTab:newTab atIndex:index]; 573 [_observers tabModel:self didReplaceTab:oldTab withTab:newTab atIndex:index];
576 574
577 if (self.currentTab == oldTab) 575 if (self.currentTab == oldTab)
578 [self changeSelectedTabFrom:nil to:newTab persistState:NO]; 576 [self changeSelectedTabFrom:nil to:newTab persistState:NO];
579 577
580 [oldTab setParentTabModel:nil]; 578 [oldTab setParentTabModel:nil];
581 if (!keepOldTabOpen) 579 [oldTab close];
582 [oldTab close];
583 580
584 // Record a tab clobber, since swapping tabs bypasses the tab code that would 581 // Record a tab clobber, since swapping tabs bypasses the tab code that would
585 // normally log clobbers. 582 // normally log clobbers.
586 base::RecordAction(base::UserMetricsAction("MobileTabClobbered")); 583 base::RecordAction(base::UserMetricsAction("MobileTabClobbered"));
587 } 584 }
588 585
589 - (void)closeTabAtIndex:(NSUInteger)index { 586 - (void)closeTabAtIndex:(NSUInteger)index {
590 DCHECK(index < [_tabs count]); 587 DCHECK(index < [_tabs count]);
591 [self closeTab:[_tabs objectAtIndex:index]]; 588 [self closeTab:[_tabs objectAtIndex:index]];
592 } 589 }
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 web::NavigationManager::WebLoadParams params(URL); 1078 web::NavigationManager::WebLoadParams params(URL);
1082 params.referrer = referrer; 1079 params.referrer = referrer;
1083 params.transition_type = ui::PAGE_TRANSITION_TYPED; 1080 params.transition_type = ui::PAGE_TRANSITION_TYPED;
1084 [[tab webController] loadWithParams:params]; 1081 [[tab webController] loadWithParams:params];
1085 [tab webController].webUsageEnabled = webUsageEnabled_; 1082 [tab webController].webUsageEnabled = webUsageEnabled_;
1086 [self insertTab:tab atIndex:index]; 1083 [self insertTab:tab atIndex:index];
1087 return tab; 1084 return tab;
1088 } 1085 }
1089 1086
1090 @end 1087 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab_model.h ('k') | ios/chrome/browser/ui/browser_view_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698