| 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_strip/tab_strip_coordinator.h" | 5 #import "ios/clean/chrome/browser/ui/tab_strip/tab_strip_coordinator.h" |
| 6 | 6 |
| 7 #import "ios/chrome/browser/web_state_list/web_state_list.h" | 7 #import "ios/chrome/browser/web_state_list/web_state_list.h" |
| 8 #import "ios/clean/chrome/browser/ui/commands/tab_strip_commands.h" | 8 #import "ios/clean/chrome/browser/ui/commands/tab_strip_commands.h" |
| 9 #import "ios/clean/chrome/browser/ui/tab_collection/tab_collection_mediator.h" | 9 #import "ios/clean/chrome/browser/ui/tab_collection/tab_collection_mediator.h" |
| 10 #import "ios/clean/chrome/browser/ui/tab_strip/tab_strip_view_controller.h" | 10 #import "ios/clean/chrome/browser/ui/tab_strip/tab_strip_view_controller.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 CommandDispatcher* dispatcher = self.browser->dispatcher(); | 38 CommandDispatcher* dispatcher = self.browser->dispatcher(); |
| 39 [dispatcher startDispatchingToTarget:self | 39 [dispatcher startDispatchingToTarget:self |
| 40 forSelector:@selector(showTabStripTabAtIndex:)]; | 40 forSelector:@selector(showTabStripTabAtIndex:)]; |
| 41 [dispatcher startDispatchingToTarget:self | 41 [dispatcher startDispatchingToTarget:self |
| 42 forSelector:@selector(closeTabStripTabAtIndex:)]; | 42 forSelector:@selector(closeTabStripTabAtIndex:)]; |
| 43 | 43 |
| 44 self.viewController = [[TabStripViewController alloc] init]; | 44 self.viewController = [[TabStripViewController alloc] init]; |
| 45 self.mediator = [[TabCollectionMediator alloc] init]; | 45 self.mediator = [[TabCollectionMediator alloc] init]; |
| 46 self.mediator.webStateList = &self.webStateList; | 46 self.mediator.webStateList = &self.webStateList; |
| 47 self.mediator.consumer = self.viewController; | 47 self.mediator.consumer = self.viewController; |
| 48 self.viewController.dataSource = self.mediator; | |
| 49 self.viewController.dispatcher = static_cast<id>(self.browser->dispatcher()); | 48 self.viewController.dispatcher = static_cast<id>(self.browser->dispatcher()); |
| 50 | 49 |
| 51 [super start]; | 50 [super start]; |
| 52 } | 51 } |
| 53 | 52 |
| 54 - (void)stop { | 53 - (void)stop { |
| 55 [super stop]; | 54 [super stop]; |
| 56 [self.mediator disconnect]; | 55 [self.mediator disconnect]; |
| 57 [self.browser->dispatcher() stopDispatchingToTarget:self]; | 56 [self.browser->dispatcher() stopDispatchingToTarget:self]; |
| 58 } | 57 } |
| 59 | 58 |
| 60 #pragma mark - TabStripCommands | 59 #pragma mark - TabStripCommands |
| 61 | 60 |
| 62 - (void)showTabStripTabAtIndex:(int)index { | 61 - (void)showTabStripTabAtIndex:(int)index { |
| 63 self.webStateList.ActivateWebStateAt(index); | 62 self.webStateList.ActivateWebStateAt(index); |
| 64 } | 63 } |
| 65 | 64 |
| 66 - (void)closeTabStripTabAtIndex:(int)index { | 65 - (void)closeTabStripTabAtIndex:(int)index { |
| 67 self.webStateList.CloseWebStateAt(index); | 66 self.webStateList.CloseWebStateAt(index); |
| 68 } | 67 } |
| 69 | 68 |
| 70 @end | 69 @end |
| OLD | NEW |