| 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_view_controller.h" | 5 #import "ios/clean/chrome/browser/ui/tab_strip/tab_strip_view_controller.h" |
| 6 | 6 |
| 7 #import "ios/clean/chrome/browser/ui/commands/tab_strip_commands.h" |
| 8 |
| 7 #if !defined(__has_feature) || !__has_feature(objc_arc) | 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 8 #error "This file requires ARC support." | 10 #error "This file requires ARC support." |
| 9 #endif | 11 #endif |
| 10 | 12 |
| 11 namespace { | 13 namespace { |
| 12 CGFloat kItemLength = 100.0f; | 14 CGFloat kItemLength = 100.0f; |
| 13 CGFloat kSpacing = 10.0f; | 15 CGFloat kSpacing = 10.0f; |
| 14 } | 16 } |
| 15 | 17 |
| 16 @implementation TabStripViewController | 18 @implementation TabStripViewController |
| 19 @synthesize dispatcher = _dispatcher; |
| 17 | 20 |
| 18 - (UICollectionViewLayout*)collectionViewLayout { | 21 - (UICollectionViewLayout*)collectionViewLayout { |
| 19 UICollectionViewFlowLayout* layout = | 22 UICollectionViewFlowLayout* layout = |
| 20 [[UICollectionViewFlowLayout alloc] init]; | 23 [[UICollectionViewFlowLayout alloc] init]; |
| 21 layout.itemSize = CGSizeMake(kItemLength, kItemLength); | 24 layout.itemSize = CGSizeMake(kItemLength, kItemLength); |
| 22 layout.minimumInteritemSpacing = kSpacing; | 25 layout.minimumInteritemSpacing = kSpacing; |
| 23 layout.sectionInset = | 26 layout.sectionInset = |
| 24 UIEdgeInsetsMake(kSpacing, kSpacing, kSpacing, kSpacing); | 27 UIEdgeInsetsMake(kSpacing, kSpacing, kSpacing, kSpacing); |
| 25 layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; | 28 layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; |
| 26 return layout; | 29 return layout; |
| 27 } | 30 } |
| 28 | 31 |
| 32 - (void)showTabAtIndex:(int)index { |
| 33 [self.dispatcher showTabStripTabAtIndex:index]; |
| 34 } |
| 35 |
| 36 - (void)closeTabAtIndex:(int)index { |
| 37 [self.dispatcher closeTabStripTabAtIndex:index]; |
| 38 } |
| 39 |
| 29 @end | 40 @end |
| OLD | NEW |