| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/clean/chrome/browser/ui/tab_grid/tab_grid_mediator.h" | 5 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_mediator.h" |
| 6 | 6 |
| 7 #import "ios/chrome/browser/web_state_list/web_state_list.h" | |
| 8 #import "ios/chrome/browser/web_state_list/web_state_list_observer_bridge.h" | |
| 9 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_consumer.h" | 7 #import "ios/clean/chrome/browser/ui/tab_grid/tab_grid_consumer.h" |
| 8 #import "ios/shared/chrome/browser/tabs/web_state_list.h" |
| 9 #import "ios/shared/chrome/browser/tabs/web_state_list_observer_bridge.h" |
| 10 #include "ios/web/public/web_state/web_state.h" | 10 #include "ios/web/public/web_state/web_state.h" |
| 11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) | 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." | 13 #error "This file requires ARC support." |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 @implementation TabGridMediator | 16 @implementation TabGridMediator |
| 17 @dynamic consumer; | 17 @dynamic consumer; |
| 18 | 18 |
| 19 #pragma mark - WebStateListObserving | 19 #pragma mark - WebStateListObserving |
| 20 | 20 |
| 21 - (void)webStateList:(WebStateList*)webStateList | 21 - (void)webStateList:(WebStateList*)webStateList |
| 22 didInsertWebState:(web::WebState*)webState | 22 didInsertWebState:(web::WebState*)webState |
| 23 atIndex:(int)index { | 23 atIndex:(int)index { |
| 24 [super webStateList:webStateList didInsertWebState:webState atIndex:index]; | 24 [super webStateList:webStateList didInsertWebState:webState atIndex:index]; |
| 25 [self.consumer removeNoTabsOverlay]; | 25 [self.consumer removeNoTabsOverlay]; |
| 26 } | 26 } |
| 27 | 27 |
| 28 - (void)webStateList:(WebStateList*)webStateList | 28 - (void)webStateList:(WebStateList*)webStateList |
| 29 didDetachWebState:(web::WebState*)webState | 29 didDetachWebState:(web::WebState*)webState |
| 30 atIndex:(int)index { | 30 atIndex:(int)index { |
| 31 [super webStateList:webStateList didDetachWebState:webState atIndex:index]; | 31 [super webStateList:webStateList didDetachWebState:webState atIndex:index]; |
| 32 if (webStateList->empty()) { | 32 if (webStateList->empty()) { |
| 33 [self.consumer addNoTabsOverlay]; | 33 [self.consumer addNoTabsOverlay]; |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 @end | 37 @end |
| OLD | NEW |