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_header_cell.h" | 5 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_header_cell.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_session_cell_data.h" | 9 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_session_cell_data.h" |
10 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 10 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 | 37 |
38 + (NSString*)identifier { | 38 + (NSString*)identifier { |
39 return @"TabSwitcherHeaderCell"; | 39 return @"TabSwitcherHeaderCell"; |
40 } | 40 } |
41 | 41 |
42 - (NSString*)reuseIdentifier { | 42 - (NSString*)reuseIdentifier { |
43 return [[self class] identifier]; | 43 return [[self class] identifier]; |
44 } | 44 } |
45 | 45 |
46 - (void)loadSessionCellData:(SessionCellData*)sessionCellData { | 46 - (void)loadSessionCellData:(TabSwitcherSessionCellData*)sessionCellData { |
47 [_imageView setImage:sessionCellData.image]; | 47 [_imageView setImage:sessionCellData.image]; |
48 [_label setText:sessionCellData.title]; | 48 [_label setText:sessionCellData.title]; |
49 [self setNeedsLayout]; | 49 [self setNeedsLayout]; |
50 } | 50 } |
51 | 51 |
52 - (void)setSelected:(BOOL)selected { | 52 - (void)setSelected:(BOOL)selected { |
53 [super setSelected:selected]; | 53 [super setSelected:selected]; |
54 [_imageView setAlpha:selected ? 1. : kInactiveAlpha]; | 54 [_imageView setAlpha:selected ? 1. : kInactiveAlpha]; |
55 [_label setAlpha:selected ? 1. : kInactiveAlpha]; | 55 [_label setAlpha:selected ? 1. : kInactiveAlpha]; |
56 [self setNeedsLayout]; | 56 [self setNeedsLayout]; |
(...skipping 23 matching lines...) Expand all Loading... |
80 [stackView setTranslatesAutoresizingMaskIntoConstraints:NO]; | 80 [stackView setTranslatesAutoresizingMaskIntoConstraints:NO]; |
81 [NSLayoutConstraint activateConstraints:@[ | 81 [NSLayoutConstraint activateConstraints:@[ |
82 [self.contentView.centerYAnchor | 82 [self.contentView.centerYAnchor |
83 constraintEqualToAnchor:[stackView centerYAnchor]], | 83 constraintEqualToAnchor:[stackView centerYAnchor]], |
84 [self.contentView.centerXAnchor | 84 [self.contentView.centerXAnchor |
85 constraintEqualToAnchor:[stackView centerXAnchor]] | 85 constraintEqualToAnchor:[stackView centerXAnchor]] |
86 ]]; | 86 ]]; |
87 } | 87 } |
88 | 88 |
89 @end | 89 @end |
OLD | NEW |