Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 // not be nil. | 129 // not be nil. |
| 130 - (void)performTabSwitcherTransition:(TransitionType)transitionType | 130 - (void)performTabSwitcherTransition:(TransitionType)transitionType |
| 131 withModel:(TabModel*)tabModel | 131 withModel:(TabModel*)tabModel |
| 132 animated:(BOOL)animated | 132 animated:(BOOL)animated |
| 133 withCompletion:(ProceduralBlock)completion; | 133 withCompletion:(ProceduralBlock)completion; |
| 134 | 134 |
| 135 // Returns the index of the currently selected panel. | 135 // Returns the index of the currently selected panel. |
| 136 - (NSInteger)currentPanelIndex; | 136 - (NSInteger)currentPanelIndex; |
| 137 | 137 |
| 138 // Returns the session type of the panel and the given index. | 138 // Returns the session type of the panel and the given index. |
| 139 - (ios_internal::SessionType)sessionTypeForPanelIndex:(NSInteger)panelIndex; | 139 - (SessionType)sessionTypeForPanelIndex:(NSInteger)panelIndex; |
| 140 | 140 |
| 141 // Returns the tab model corresponding to the given session type. | 141 // Returns the tab model corresponding to the given session type. |
| 142 // There is no tab model for distant sessions so it returns nil for distant | 142 // There is no tab model for distant sessions so it returns nil for distant |
| 143 // sessions type. | 143 // sessions type. |
| 144 - (TabModel*)tabModelForSessionType:(ios_internal::SessionType)sessionType; | 144 - (TabModel*)tabModelForSessionType:(SessionType)sessionType; |
| 145 | 145 |
| 146 // Returns the tab model of the currently selected tab. | 146 // Returns the tab model of the currently selected tab. |
| 147 - (TabModel*)currentSelectedModel; | 147 - (TabModel*)currentSelectedModel; |
| 148 | 148 |
| 149 // Calls tabSwitcherDismissWithModel:animated: with the |animated| parameter | 149 // Calls tabSwitcherDismissWithModel:animated: with the |animated| parameter |
| 150 // set to YES. | 150 // set to YES. |
| 151 - (void)tabSwitcherDismissWithModel:(TabModel*)model; | 151 - (void)tabSwitcherDismissWithModel:(TabModel*)model; |
| 152 | 152 |
| 153 // Dismisses the tab switcher using the given tab model. The completion block is | 153 // Dismisses the tab switcher using the given tab model. The completion block is |
| 154 // called at the end of the animation. The tab switcher delegate method | 154 // called at the end of the animation. The tab switcher delegate method |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 _tabSwitcherModel.reset([[TabSwitcherModel alloc] | 200 _tabSwitcherModel.reset([[TabSwitcherModel alloc] |
| 201 initWithBrowserState:browserState | 201 initWithBrowserState:browserState |
| 202 delegate:self | 202 delegate:self |
| 203 mainTabModel:mainTabModel | 203 mainTabModel:mainTabModel |
| 204 otrTabModel:otrTabModel | 204 otrTabModel:otrTabModel |
| 205 withCache:_cache]); | 205 withCache:_cache]); |
| 206 _controllersOfDistantSessions.reset([[NSMutableArray alloc] init]); | 206 _controllersOfDistantSessions.reset([[NSMutableArray alloc] init]); |
| 207 [self loadTabSwitcherView]; | 207 [self loadTabSwitcherView]; |
| 208 _onTheRecordSession.reset([[TabSwitcherPanelController alloc] | 208 _onTheRecordSession.reset([[TabSwitcherPanelController alloc] |
| 209 initWithModel:_tabSwitcherModel | 209 initWithModel:_tabSwitcherModel |
| 210 forLocalSessionOfType:ios_internal::SessionType::REGULAR_SESSION | 210 forLocalSessionOfType:SessionType::REGULAR_SESSION |
| 211 withCache:_cache | 211 withCache:_cache |
| 212 browserState:_browserState]); | 212 browserState:_browserState]); |
| 213 [_onTheRecordSession setDelegate:self]; | 213 [_onTheRecordSession setDelegate:self]; |
| 214 _offTheRecordSession.reset([[TabSwitcherPanelController alloc] | 214 _offTheRecordSession.reset([[TabSwitcherPanelController alloc] |
| 215 initWithModel:_tabSwitcherModel | 215 initWithModel:_tabSwitcherModel |
| 216 forLocalSessionOfType:ios_internal::SessionType::OFF_THE_RECORD_SESSION | 216 forLocalSessionOfType:SessionType::OFF_THE_RECORD_SESSION |
| 217 withCache:_cache | 217 withCache:_cache |
| 218 browserState:_browserState]); | 218 browserState:_browserState]); |
| 219 [_offTheRecordSession setDelegate:self]; | 219 [_offTheRecordSession setDelegate:self]; |
| 220 [_tabSwitcherView addPanelView:[_offTheRecordSession view] | 220 [_tabSwitcherView addPanelView:[_offTheRecordSession view] |
| 221 atIndex:kLocalTabsOffTheRecordPanelIndex]; | 221 atIndex:kLocalTabsOffTheRecordPanelIndex]; |
| 222 [_tabSwitcherView addPanelView:[_onTheRecordSession view] | 222 [_tabSwitcherView addPanelView:[_onTheRecordSession view] |
| 223 atIndex:kLocalTabsOnTheRecordPanelIndex]; | 223 atIndex:kLocalTabsOnTheRecordPanelIndex]; |
| 224 [self addPromoPanelForSignInPanelType:[_tabSwitcherModel signInPanelType]]; | 224 [self addPromoPanelForSignInPanelType:[_tabSwitcherModel signInPanelType]]; |
| 225 [[_tabSwitcherView headerView] reloadData]; | 225 [[_tabSwitcherView headerView] reloadData]; |
| 226 [_tabSwitcherModel syncedSessionsChanged]; | 226 [_tabSwitcherModel syncedSessionsChanged]; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 | 385 |
| 386 switch (command) { | 386 switch (command) { |
| 387 case IDC_NEW_INCOGNITO_TAB: // fallthrough | 387 case IDC_NEW_INCOGNITO_TAB: // fallthrough |
| 388 case IDC_NEW_TAB: { | 388 case IDC_NEW_TAB: { |
| 389 // Ensure that the right mode is showing. | 389 // Ensure that the right mode is showing. |
| 390 NSInteger panelIndex = (command == IDC_NEW_TAB) | 390 NSInteger panelIndex = (command == IDC_NEW_TAB) |
| 391 ? kLocalTabsOnTheRecordPanelIndex | 391 ? kLocalTabsOnTheRecordPanelIndex |
| 392 : kLocalTabsOffTheRecordPanelIndex; | 392 : kLocalTabsOffTheRecordPanelIndex; |
| 393 [_tabSwitcherView selectPanelAtIndex:panelIndex]; | 393 [_tabSwitcherView selectPanelAtIndex:panelIndex]; |
| 394 | 394 |
| 395 const ios_internal::SessionType panelSessionType = | 395 const SessionType panelSessionType = |
| 396 (command == IDC_NEW_TAB) | 396 (command == IDC_NEW_TAB) ? SessionType::REGULAR_SESSION |
| 397 ? ios_internal::SessionType::REGULAR_SESSION | 397 : SessionType::OFF_THE_RECORD_SESSION; |
| 398 : ios_internal::SessionType::OFF_THE_RECORD_SESSION; | |
| 399 | 398 |
| 400 TabModel* model = [self tabModelForSessionType:panelSessionType]; | 399 TabModel* model = [self tabModelForSessionType:panelSessionType]; |
| 401 [self dismissWithNewTabAnimation:GURL(kChromeUINewTabURL) | 400 [self dismissWithNewTabAnimation:GURL(kChromeUINewTabURL) |
| 402 atIndex:NSNotFound | 401 atIndex:NSNotFound |
| 403 transition:ui::PAGE_TRANSITION_TYPED | 402 transition:ui::PAGE_TRANSITION_TYPED |
| 404 tabModel:model]; | 403 tabModel:model]; |
| 405 } break; | 404 } break; |
| 406 case IDC_TOGGLE_TAB_SWITCHER: | 405 case IDC_TOGGLE_TAB_SWITCHER: |
| 407 [self tabSwitcherDismissWithCurrentSelectedModel]; | 406 [self tabSwitcherDismissWithCurrentSelectedModel]; |
| 408 break; | 407 break; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 return [_tabSwitcherView currentPanelIndex]; | 729 return [_tabSwitcherView currentPanelIndex]; |
| 731 } | 730 } |
| 732 | 731 |
| 733 - (int)offsetToDistantSessionPanels { | 732 - (int)offsetToDistantSessionPanels { |
| 734 if (_signInPanelType == TabSwitcherSignInPanelsType::NO_PANEL) { | 733 if (_signInPanelType == TabSwitcherSignInPanelsType::NO_PANEL) { |
| 735 return kSignInPromoPanelIndex; | 734 return kSignInPromoPanelIndex; |
| 736 } | 735 } |
| 737 return kSignInPromoPanelIndex + 1; | 736 return kSignInPromoPanelIndex + 1; |
| 738 } | 737 } |
| 739 | 738 |
| 740 - (ios_internal::SessionType)sessionTypeForPanelIndex:(NSInteger)panelIndex { | 739 - (SessionType)sessionTypeForPanelIndex:(NSInteger)panelIndex { |
| 741 if (panelIndex == kLocalTabsOffTheRecordPanelIndex) | 740 if (panelIndex == kLocalTabsOffTheRecordPanelIndex) |
| 742 return ios_internal::SessionType::OFF_THE_RECORD_SESSION; | 741 return SessionType::OFF_THE_RECORD_SESSION; |
| 743 if (panelIndex == kLocalTabsOnTheRecordPanelIndex) | 742 if (panelIndex == kLocalTabsOnTheRecordPanelIndex) |
| 744 return ios_internal::SessionType::REGULAR_SESSION; | 743 return SessionType::REGULAR_SESSION; |
| 745 return ios_internal::SessionType::DISTANT_SESSION; | 744 return SessionType::DISTANT_SESSION; |
| 746 } | 745 } |
| 747 | 746 |
| 748 - (TabModel*)tabModelForSessionType:(ios_internal::SessionType)sessionType { | 747 - (TabModel*)tabModelForSessionType:(SessionType)sessionType { |
| 749 switch (sessionType) { | 748 switch (sessionType) { |
| 750 case ios_internal::SessionType::REGULAR_SESSION: | 749 case SessionType::REGULAR_SESSION: |
| 751 return [_tabSwitcherModel mainTabModel]; | 750 return [_tabSwitcherModel mainTabModel]; |
| 752 break; | 751 break; |
| 753 case ios_internal::SessionType::OFF_THE_RECORD_SESSION: | 752 case SessionType::OFF_THE_RECORD_SESSION: |
| 754 return [_tabSwitcherModel otrTabModel]; | 753 return [_tabSwitcherModel otrTabModel]; |
| 755 break; | 754 break; |
| 756 case ios_internal::SessionType::DISTANT_SESSION: | 755 case SessionType::DISTANT_SESSION: |
| 757 return nil; | 756 return nil; |
| 758 break; | 757 break; |
| 759 } | 758 } |
| 760 } | 759 } |
| 761 | 760 |
| 762 - (TabModel*)currentSelectedModel { | 761 - (TabModel*)currentSelectedModel { |
| 763 const NSInteger currentPanelIndex = [self currentPanelIndex]; | 762 const NSInteger currentPanelIndex = [self currentPanelIndex]; |
| 764 const ios_internal::SessionType sessionType = | 763 const SessionType sessionType = |
| 765 [self sessionTypeForPanelIndex:currentPanelIndex]; | 764 [self sessionTypeForPanelIndex:currentPanelIndex]; |
| 766 TabModel* model = [self tabModelForSessionType:sessionType]; | 765 TabModel* model = [self tabModelForSessionType:sessionType]; |
| 767 if (!model) | 766 if (!model) |
| 768 model = _onLoadActiveModel; | 767 model = _onLoadActiveModel; |
| 769 return model; | 768 return model; |
| 770 } | 769 } |
| 771 | 770 |
| 772 - (void)selectPanelForTabModel:(TabModel*)selectedTabModel { | 771 - (void)selectPanelForTabModel:(TabModel*)selectedTabModel { |
| 773 DCHECK(selectedTabModel == [_tabSwitcherModel otrTabModel] || | 772 DCHECK(selectedTabModel == [_tabSwitcherModel otrTabModel] || |
| 774 selectedTabModel == [_tabSwitcherModel mainTabModel]); | 773 selectedTabModel == [_tabSwitcherModel mainTabModel]); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 996 for (TabSwitcherPanelController* panel in _controllersOfDistantSessions | 995 for (TabSwitcherPanelController* panel in _controllersOfDistantSessions |
| 997 .get()) { | 996 .get()) { |
| 998 DCHECK([panel isKindOfClass:[TabSwitcherPanelController class]]); | 997 DCHECK([panel isKindOfClass:[TabSwitcherPanelController class]]); |
| 999 if ([panel sessionTag] == tag) { | 998 if ([panel sessionTag] == tag) { |
| 1000 [panel updateCollectionViewIfNeeded]; | 999 [panel updateCollectionViewIfNeeded]; |
| 1001 return; | 1000 return; |
| 1002 } | 1001 } |
| 1003 } | 1002 } |
| 1004 } | 1003 } |
| 1005 | 1004 |
| 1006 - (void)localSessionMayNeedUpdate:(ios_internal::SessionType)type { | 1005 - (void)localSessionMayNeedUpdate:(SessionType)type { |
| 1007 if (type == ios_internal::SessionType::REGULAR_SESSION) { | 1006 if (type == SessionType::REGULAR_SESSION) { |
|
sdefresne
2017/01/03 16:04:30
nit: it would be better to use a switch statement
rohitrao (ping after 24h)
2017/01/04 13:36:37
Acknowledged.
| |
| 1008 [_onTheRecordSession updateCollectionViewIfNeeded]; | 1007 [_onTheRecordSession updateCollectionViewIfNeeded]; |
| 1009 } else { | 1008 } else { |
| 1010 DCHECK(type == ios_internal::SessionType::OFF_THE_RECORD_SESSION); | 1009 DCHECK(type == SessionType::OFF_THE_RECORD_SESSION); |
| 1011 [_offTheRecordSession updateCollectionViewIfNeeded]; | 1010 [_offTheRecordSession updateCollectionViewIfNeeded]; |
| 1012 } | 1011 } |
| 1013 } | 1012 } |
| 1014 | 1013 |
| 1015 - (void)signInPanelChangedTo:(TabSwitcherSignInPanelsType)newPanelType { | 1014 - (void)signInPanelChangedTo:(TabSwitcherSignInPanelsType)newPanelType { |
| 1016 if (_signInPanelType == newPanelType) | 1015 if (_signInPanelType == newPanelType) |
| 1017 return; | 1016 return; |
| 1018 | 1017 |
| 1019 // Remove promo panel that is no longer relevant, if any. | 1018 // Remove promo panel that is no longer relevant, if any. |
| 1020 if (_signInPanelType != TabSwitcherSignInPanelsType::NO_PANEL) { | 1019 if (_signInPanelType != TabSwitcherSignInPanelsType::NO_PANEL) { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1034 if (panelType != TabSwitcherSignInPanelsType::NO_PANEL) { | 1033 if (panelType != TabSwitcherSignInPanelsType::NO_PANEL) { |
| 1035 TabSwitcherPanelOverlayView* panelView = | 1034 TabSwitcherPanelOverlayView* panelView = |
| 1036 [[[TabSwitcherPanelOverlayView alloc] initWithFrame:CGRectZero | 1035 [[[TabSwitcherPanelOverlayView alloc] initWithFrame:CGRectZero |
| 1037 browserState:_browserState] | 1036 browserState:_browserState] |
| 1038 autorelease]; | 1037 autorelease]; |
| 1039 [panelView setOverlayType:PanelOverlayTypeFromSignInPanelsType(panelType)]; | 1038 [panelView setOverlayType:PanelOverlayTypeFromSignInPanelsType(panelType)]; |
| 1040 [_tabSwitcherView addPanelView:panelView atIndex:kSignInPromoPanelIndex]; | 1039 [_tabSwitcherView addPanelView:panelView atIndex:kSignInPromoPanelIndex]; |
| 1041 } | 1040 } |
| 1042 } | 1041 } |
| 1043 | 1042 |
| 1044 - (CGSize)sizeForItemAtIndex:(NSUInteger)index | 1043 - (CGSize)sizeForItemAtIndex:(NSUInteger)index inSession:(SessionType)session { |
| 1045 inSession:(ios_internal::SessionType)session { | |
| 1046 switch (session) { | 1044 switch (session) { |
| 1047 case ios_internal::SessionType::OFF_THE_RECORD_SESSION: | 1045 case SessionType::OFF_THE_RECORD_SESSION: |
| 1048 return [[_offTheRecordSession view] cellSize]; | 1046 return [[_offTheRecordSession view] cellSize]; |
| 1049 case ios_internal::SessionType::REGULAR_SESSION: | 1047 case SessionType::REGULAR_SESSION: |
| 1050 return [[_onTheRecordSession view] cellSize]; | 1048 return [[_onTheRecordSession view] cellSize]; |
| 1051 case ios_internal::SessionType::DISTANT_SESSION: | 1049 case SessionType::DISTANT_SESSION: |
| 1052 NOTREACHED(); | 1050 NOTREACHED(); |
| 1053 return {}; | 1051 return {}; |
| 1054 } | 1052 } |
| 1055 } | 1053 } |
| 1056 | 1054 |
| 1057 #pragma mark - TabSwitcherHeaderViewDelegate | 1055 #pragma mark - TabSwitcherHeaderViewDelegate |
| 1058 | 1056 |
| 1059 - (void)tabSwitcherHeaderViewDismiss:(TabSwitcherHeaderView*)view { | 1057 - (void)tabSwitcherHeaderViewDismiss:(TabSwitcherHeaderView*)view { |
| 1060 [self tabSwitcherDismissWithCurrentSelectedModel]; | 1058 [self tabSwitcherDismissWithCurrentSelectedModel]; |
| 1061 } | 1059 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1103 NSString* cellTitle = nil; | 1101 NSString* cellTitle = nil; |
| 1104 | 1102 |
| 1105 if (index < _controllersOfDistantSessions.get().count) { | 1103 if (index < _controllersOfDistantSessions.get().count) { |
| 1106 TabSwitcherPanelController* panel = | 1104 TabSwitcherPanelController* panel = |
| 1107 [_controllersOfDistantSessions objectAtIndex:index]; | 1105 [_controllersOfDistantSessions objectAtIndex:index]; |
| 1108 const synced_sessions::DistantSession* distantSession = | 1106 const synced_sessions::DistantSession* distantSession = |
| 1109 [panel distantSession]; | 1107 [panel distantSession]; |
| 1110 deviceType = distantSession->device_type; | 1108 deviceType = distantSession->device_type; |
| 1111 cellTitle = base::SysUTF8ToNSString(distantSession->name); | 1109 cellTitle = base::SysUTF8ToNSString(distantSession->name); |
| 1112 } | 1110 } |
| 1113 ios_internal::SessionCellType cellType; | 1111 SessionCellType cellType; |
| 1114 switch (deviceType) { | 1112 switch (deviceType) { |
| 1115 case sync_sessions::SyncedSession::TYPE_PHONE: | 1113 case sync_sessions::SyncedSession::TYPE_PHONE: |
| 1116 cellType = ios_internal::kPhoneRemoteSessionCell; | 1114 cellType = kPhoneRemoteSessionCell; |
| 1117 break; | 1115 break; |
| 1118 case sync_sessions::SyncedSession::TYPE_TABLET: | 1116 case sync_sessions::SyncedSession::TYPE_TABLET: |
| 1119 cellType = ios_internal::kTabletRemoteSessionCell; | 1117 cellType = kTabletRemoteSessionCell; |
| 1120 break; | 1118 break; |
| 1121 default: | 1119 default: |
| 1122 cellType = ios_internal::kLaptopRemoteSessionCell; | 1120 cellType = kLaptopRemoteSessionCell; |
| 1123 break; | 1121 break; |
| 1124 } | 1122 } |
| 1125 SessionCellData* sessionData = [[[SessionCellData alloc] | 1123 SessionCellData* sessionData = [[[SessionCellData alloc] |
| 1126 initWithSessionCellType:cellType] autorelease]; | 1124 initWithSessionCellType:cellType] autorelease]; |
| 1127 sessionData.title = cellTitle; | 1125 sessionData.title = cellTitle; |
| 1128 return sessionData; | 1126 return sessionData; |
| 1129 } | 1127 } |
| 1130 } | 1128 } |
| 1131 } | 1129 } |
| 1132 | 1130 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1200 DCHECK(tab); | 1198 DCHECK(tab); |
| 1201 [self openTabWithContentOfDistantTab:tab]; | 1199 [self openTabWithContentOfDistantTab:tab]; |
| 1202 base::RecordAction( | 1200 base::RecordAction( |
| 1203 base::UserMetricsAction("MobileTabSwitcherOpenDistantTab")); | 1201 base::UserMetricsAction("MobileTabSwitcherOpenDistantTab")); |
| 1204 } | 1202 } |
| 1205 | 1203 |
| 1206 - (void)tabSwitcherPanelController: | 1204 - (void)tabSwitcherPanelController: |
| 1207 (TabSwitcherPanelController*)tabSwitcherPanelController | 1205 (TabSwitcherPanelController*)tabSwitcherPanelController |
| 1208 didSelectLocalTab:(Tab*)tab { | 1206 didSelectLocalTab:(Tab*)tab { |
| 1209 DCHECK(tab); | 1207 DCHECK(tab); |
| 1210 const ios_internal::SessionType panelSessionType = | 1208 const SessionType panelSessionType = tabSwitcherPanelController.sessionType; |
| 1211 tabSwitcherPanelController.sessionType; | |
| 1212 TabModel* tabModel = [self tabModelForSessionType:panelSessionType]; | 1209 TabModel* tabModel = [self tabModelForSessionType:panelSessionType]; |
| 1213 [tabModel setCurrentTab:tab]; | 1210 [tabModel setCurrentTab:tab]; |
| 1214 [self.delegate tabSwitcher:self | 1211 [self.delegate tabSwitcher:self |
| 1215 dismissTransitionWillStartWithActiveModel:tabModel]; | 1212 dismissTransitionWillStartWithActiveModel:tabModel]; |
| 1216 [self tabSwitcherDismissWithModel:tabModel]; | 1213 [self tabSwitcherDismissWithModel:tabModel]; |
| 1217 if (panelSessionType == ios_internal::SessionType::OFF_THE_RECORD_SESSION) { | 1214 if (panelSessionType == SessionType::OFF_THE_RECORD_SESSION) { |
| 1218 base::RecordAction( | 1215 base::RecordAction( |
| 1219 base::UserMetricsAction("MobileTabSwitcherOpenIncognitoTab")); | 1216 base::UserMetricsAction("MobileTabSwitcherOpenIncognitoTab")); |
| 1220 } else { | 1217 } else { |
| 1221 base::RecordAction( | 1218 base::RecordAction( |
| 1222 base::UserMetricsAction("MobileTabSwitcherOpenNonIncognitoTab")); | 1219 base::UserMetricsAction("MobileTabSwitcherOpenNonIncognitoTab")); |
| 1223 } | 1220 } |
| 1224 } | 1221 } |
| 1225 | 1222 |
| 1226 - (void)tabSwitcherPanelController: | 1223 - (void)tabSwitcherPanelController: |
| 1227 (TabSwitcherPanelController*)tabSwitcherPanelController | 1224 (TabSwitcherPanelController*)tabSwitcherPanelController |
| 1228 didCloseLocalTab:(Tab*)tab { | 1225 didCloseLocalTab:(Tab*)tab { |
| 1229 DCHECK(tab); | 1226 DCHECK(tab); |
| 1230 const ios_internal::SessionType panelSessionType = | 1227 const SessionType panelSessionType = tabSwitcherPanelController.sessionType; |
| 1231 tabSwitcherPanelController.sessionType; | |
| 1232 [tab close]; | 1228 [tab close]; |
| 1233 if (panelSessionType == ios_internal::SessionType::OFF_THE_RECORD_SESSION) { | 1229 if (panelSessionType == SessionType::OFF_THE_RECORD_SESSION) { |
| 1234 base::RecordAction( | 1230 base::RecordAction( |
| 1235 base::UserMetricsAction("MobileTabSwitcherCloseIncognitoTab")); | 1231 base::UserMetricsAction("MobileTabSwitcherCloseIncognitoTab")); |
| 1236 } else { | 1232 } else { |
| 1237 base::RecordAction( | 1233 base::RecordAction( |
| 1238 base::UserMetricsAction("MobileTabSwitcherCloseNonIncognitoTab")); | 1234 base::UserMetricsAction("MobileTabSwitcherCloseNonIncognitoTab")); |
| 1239 } | 1235 } |
| 1240 } | 1236 } |
| 1241 | 1237 |
| 1242 - (void)tabSwitcherPanelControllerDidUpdateOverlayViewVisibility: | 1238 - (void)tabSwitcherPanelControllerDidUpdateOverlayViewVisibility: |
| 1243 (TabSwitcherPanelController*)tabSwitcherPanelController { | 1239 (TabSwitcherPanelController*)tabSwitcherPanelController { |
| 1244 [_tabSwitcherView updateOverlayButtonState]; | 1240 [_tabSwitcherView updateOverlayButtonState]; |
| 1245 } | 1241 } |
| 1246 | 1242 |
| 1247 @end | 1243 @end |
| OLD | NEW |