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_session_cell_data.h" | 5 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_session_cell_data.h" |
6 #include "ios/chrome/grit/ios_strings.h" | 6 #include "ios/chrome/grit/ios_strings.h" |
7 #include "ui/base/l10n/l10n_util.h" | 7 #include "ui/base/l10n/l10n_util.h" |
8 | 8 |
9 @implementation SessionCellData | 9 @implementation TabSwitcherSessionCellData |
10 | 10 |
11 @synthesize type = _type; | 11 @synthesize type = _type; |
12 @synthesize title = _title; | 12 @synthesize title = _title; |
13 @synthesize image = _image; | 13 @synthesize image = _image; |
14 | 14 |
15 + (instancetype)incognitoSessionCellData { | 15 + (instancetype)incognitoSessionCellData { |
16 static SessionCellData* incognitoSessionCellData = nil; | 16 static TabSwitcherSessionCellData* incognitoSessionCellData = nil; |
17 static dispatch_once_t onceToken; | 17 static dispatch_once_t onceToken; |
18 dispatch_once(&onceToken, ^{ | 18 dispatch_once(&onceToken, ^{ |
19 incognitoSessionCellData = | 19 incognitoSessionCellData = |
20 [[self alloc] initWithSessionCellType:kIncognitoSessionCell]; | 20 [[self alloc] initWithSessionCellType:kIncognitoSessionCell]; |
21 }); | 21 }); |
22 return incognitoSessionCellData; | 22 return incognitoSessionCellData; |
23 } | 23 } |
24 | 24 |
25 + (instancetype)openTabSessionCellData { | 25 + (instancetype)openTabSessionCellData { |
26 static SessionCellData* openTabSessionCellData = nil; | 26 static TabSwitcherSessionCellData* openTabSessionCellData = nil; |
27 static dispatch_once_t onceToken; | 27 static dispatch_once_t onceToken; |
28 dispatch_once(&onceToken, ^{ | 28 dispatch_once(&onceToken, ^{ |
29 openTabSessionCellData = | 29 openTabSessionCellData = |
30 [[self alloc] initWithSessionCellType:kOpenTabSessionCell]; | 30 [[self alloc] initWithSessionCellType:kOpenTabSessionCell]; |
31 }); | 31 }); |
32 return openTabSessionCellData; | 32 return openTabSessionCellData; |
33 } | 33 } |
34 | 34 |
35 + (instancetype)otherDevicesSessionCellData { | 35 + (instancetype)otherDevicesSessionCellData { |
36 static SessionCellData* otherDevicesSessionCellData = nil; | 36 static TabSwitcherSessionCellData* otherDevicesSessionCellData = nil; |
37 static dispatch_once_t onceToken; | 37 static dispatch_once_t onceToken; |
38 dispatch_once(&onceToken, ^{ | 38 dispatch_once(&onceToken, ^{ |
39 otherDevicesSessionCellData = | 39 otherDevicesSessionCellData = |
40 [[self alloc] initWithSessionCellType:kGenericRemoteSessionCell]; | 40 [[self alloc] initWithSessionCellType:kGenericRemoteSessionCell]; |
41 }); | 41 }); |
42 return otherDevicesSessionCellData; | 42 return otherDevicesSessionCellData; |
43 } | 43 } |
44 | 44 |
45 - (instancetype)initWithSessionCellType:(TabSwitcherSessionCellType)type { | 45 - (instancetype)initWithSessionCellType:(TabSwitcherSessionCellType)type { |
46 self = [super init]; | 46 self = [super init]; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 messageId = IDS_IOS_TAB_SWITCHER_HEADER_OTHER_DEVICES_TABS; | 82 messageId = IDS_IOS_TAB_SWITCHER_HEADER_OTHER_DEVICES_TABS; |
83 break; | 83 break; |
84 } | 84 } |
85 [self setTitle:l10n_util::GetNSString(messageId)]; | 85 [self setTitle:l10n_util::GetNSString(messageId)]; |
86 UIImage* image = [UIImage imageNamed:imageName]; | 86 UIImage* image = [UIImage imageNamed:imageName]; |
87 image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; | 87 image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; |
88 [self setImage:image]; | 88 [self setImage:image]; |
89 } | 89 } |
90 | 90 |
91 @end | 91 @end |
OLD | NEW |