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

Unified Diff: ios/chrome/browser/ui/activity_services/chrome_activity_item_thumbnail_generator.mm

Issue 2645653003: Expose thumbnails of pages to iOS share extensions. (Closed)
Patch Set: Created 3 years, 11 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/chrome/browser/ui/activity_services/chrome_activity_item_thumbnail_generator.mm
diff --git a/ios/chrome/browser/ui/activity_services/chrome_activity_item_thumbnail_generator.mm b/ios/chrome/browser/ui/activity_services/chrome_activity_item_thumbnail_generator.mm
new file mode 100644
index 0000000000000000000000000000000000000000..15cf53164e005d94fe0c2fcb8b75809f5f8c37c2
--- /dev/null
+++ b/ios/chrome/browser/ui/activity_services/chrome_activity_item_thumbnail_generator.mm
@@ -0,0 +1,26 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/ui/activity_services/chrome_activity_item_thumbnail_generator.h"
+
+#import "ios/chrome/browser/tabs/tab.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+namespace activity_services {
+
+ThumbnailGenerator thumbNailGeneratorForTab(Tab* tab) {
+ __weak Tab* weakTab = tab;
Olivier 2017/01/20 10:14:00 This is C++. Use weak_tab
jif 2017/01/24 10:29:50 But this is Obj-C++.
+ ThumbnailGenerator generator = ^UIImage*(CGSize size) {
+ Tab* strongTab = weakTab;
Olivier 2017/01/20 10:14:00 nit: Is weaktab needed? Will self not be retained
jif 2017/01/24 10:29:50 I don't understand, there is no self here.
+ UIImage* pagePreview =
+ [strongTab generateSnapshotWithOverlay:NO visibleFrameOnly:YES];
Olivier 2017/01/20 20:41:59 Is the size used?
jif 2017/01/24 10:29:50 Done.
+ return pagePreview;
+ };
+ return generator;
+}
+
+} // namespace activity_services

Powered by Google App Engine
This is Rietveld 408576698