| 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_panel_cell.h" | 5 #import "ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_cell.h" |
| 6 | 6 |
| 7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #import "ios/chrome/browser/tabs/tab.h" | 8 #import "ios/chrome/browser/tabs/tab.h" |
| 9 #import "ios/chrome/browser/ui/fade_truncated_label.h" | 9 #import "ios/chrome/browser/ui/fade_truncated_label.h" |
| 10 #import "ios/chrome/browser/ui/image_util.h" | 10 #import "ios/chrome/browser/ui/image_util.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 [self contentView].accessibilityLabel = tab.title; | 223 [self contentView].accessibilityLabel = tab.title; |
| 224 if (tab.favicon) { | 224 if (tab.favicon) { |
| 225 [_favicon setImage:tab.favicon]; | 225 [_favicon setImage:tab.favicon]; |
| 226 } else { | 226 } else { |
| 227 [_favicon setImage:NativeImage(IDR_IOS_OMNIBOX_HTTP)]; | 227 [_favicon setImage:NativeImage(IDR_IOS_OMNIBOX_HTTP)]; |
| 228 } | 228 } |
| 229 | 229 |
| 230 CGSize snapshotSize = cellSize; | 230 CGSize snapshotSize = cellSize; |
| 231 snapshotSize.height -= tabSwitcherLocalSessionCellTopBarHeight(); | 231 snapshotSize.height -= tabSwitcherLocalSessionCellTopBarHeight(); |
| 232 base::WeakNSObject<TabSwitcherLocalSessionCell> weakCell(self); | 232 base::WeakNSObject<TabSwitcherLocalSessionCell> weakCell(self); |
| 233 DCHECK(self.delegate); |
| 234 DCHECK([self cache]); |
| 233 _currentPendingSnapshotRequest = | 235 _currentPendingSnapshotRequest = |
| 234 [[self cache] requestSnapshotForTab:tab | 236 [[self cache] requestSnapshotForTab:tab |
| 235 withSize:snapshotSize | 237 withSize:snapshotSize |
| 236 completionBlock:^(UIImage* image) { | 238 completionBlock:^(UIImage* image) { |
| 237 DCHECK([NSThread isMainThread]); | 239 DCHECK([NSThread isMainThread]); |
| 238 [weakCell setSnapshot:image]; | 240 [weakCell setSnapshot:image]; |
| 239 _currentPendingSnapshotRequest = {}; | 241 _currentPendingSnapshotRequest = {}; |
| 240 }]; | 242 }]; |
| 241 } | 243 } |
| 242 | 244 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 - (void)prepareForReuse { | 435 - (void)prepareForReuse { |
| 434 [_newTabIcon setAlpha:0]; | 436 [_newTabIcon setAlpha:0]; |
| 435 [_faviconObtainer cancel]; | 437 [_faviconObtainer cancel]; |
| 436 _faviconObtainer.reset(); | 438 _faviconObtainer.reset(); |
| 437 [_raisedButton setAlpha:0]; | 439 [_raisedButton setAlpha:0]; |
| 438 [_raisedButton resetState]; | 440 [_raisedButton resetState]; |
| 439 [super prepareForReuse]; | 441 [super prepareForReuse]; |
| 440 } | 442 } |
| 441 | 443 |
| 442 @end | 444 @end |
| OLD | NEW |