Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm

Issue 2971113002: [ios] Plumb SnapshotCache into tab grid. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm
diff --git a/ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm b/ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm
index 71d1c4e7d05d355c986fca03b2684fd49f1deeef..41f56681f9fec075c6be8b31e89d10c8e98239a2 100644
--- a/ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm
+++ b/ios/clean/chrome/browser/ui/tab_grid/tab_grid_coordinator.mm
@@ -76,6 +76,7 @@
self.viewController = [[TabGridViewController alloc] init];
self.viewController.dispatcher = static_cast<id>(self.browser->dispatcher());
+ self.viewController.snapshotCache = [self snapshotCache];
self.mediator.consumer = self.viewController;
@@ -286,12 +287,17 @@
__weak TabGridCoordinator* weakSelf = self;
webState->TakeSnapshot(
base::BindBlockArc(^(const gfx::Image& snapshot) {
- SnapshotCache* snapshotCache = SnapshotCacheFactory::GetForBrowserState(
- weakSelf.browser->browser_state());
- [snapshotCache setImage:snapshot.ToUIImage() withSessionID:tabID];
+ [[weakSelf snapshotCache] setImage:snapshot.ToUIImage()
+ withSessionID:tabID];
[weakSelf.viewController updateSnapshotAtIndex:index];
}),
kTabCollectionTabCellSize);
}
+// Returns the snapshot cache for this browser state.
+- (SnapshotCache*)snapshotCache {
marq (ping after 24h) 2017/07/06 12:44:50 This feels like it should be a readonly property.
edchin 2017/07/07 03:18:11 Done.
+ return SnapshotCacheFactory::GetForBrowserState(
+ self.browser->browser_state());
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698