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

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

Issue 2645653003: Expose thumbnails of pages to iOS share extensions. (Closed)
Patch Set: Addressed comments. Created 3 years, 10 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/share_to_data.mm
diff --git a/ios/chrome/browser/ui/activity_services/share_to_data.mm b/ios/chrome/browser/ui/activity_services/share_to_data.mm
index 40018418250c8ae64248d14381fe36cf3005777c..5d9992a51430ef2c9200cb414000f3ce92dc08b6 100644
--- a/ios/chrome/browser/ui/activity_services/share_to_data.mm
+++ b/ios/chrome/browser/ui/activity_services/share_to_data.mm
@@ -38,6 +38,7 @@
@synthesize title = title_;
@synthesize image = image_;
+@synthesize thumbnailGenerator = thumbnailGenerator_;
@synthesize isOriginalTitle = isOriginalTitle_;
@synthesize isPagePrintable = isPagePrintable_;
@@ -47,17 +48,19 @@
}
- (id)initWithURL:(const GURL&)url
- title:(NSString*)title
- isOriginalTitle:(BOOL)isOriginalTitle
- isPagePrintable:(BOOL)isPagePrintable {
+ title:(NSString*)title
+ isOriginalTitle:(BOOL)isOriginalTitle
+ isPagePrintable:(BOOL)isPagePrintable
+ thumbnailGenerator:(ThumbnailGeneratorBlock)thumbnailGenerator {
DCHECK(url.is_valid());
DCHECK(title);
self = [super init];
if (self) {
url_ = url;
- self.title = title;
- self.isOriginalTitle = isOriginalTitle;
- self.isPagePrintable = isPagePrintable;
+ title_ = title;
+ isOriginalTitle_ = isOriginalTitle;
+ isPagePrintable_ = isPagePrintable;
+ thumbnailGenerator_ = thumbnailGenerator;
}
return self;
}
@@ -70,25 +73,4 @@
return net::NSURLWithGURL(url_);
}
-- (BOOL)isEqual:(id)object {
- if (![object isMemberOfClass:self.class])
- return NO;
- DCHECK(self.url.is_valid());
- DCHECK(self.title);
- ShareToData* other = (ShareToData*)object;
- return self.url == other.url && [self.title isEqual:other.title] &&
- self.image == other.image &&
- self.isOriginalTitle == other.isOriginalTitle;
-}
-
-- (NSUInteger)hash {
- DCHECK(self.url.is_valid());
- DCHECK(self.title);
- const NSUInteger kPrime = 31;
- NSString* urlString = base::SysUTF8ToNSString(self.url.spec());
- return kPrime * kPrime * kPrime * urlString.hash +
- kPrime * kPrime * self.title.hash + kPrime * self.image.hash +
- (self.isOriginalTitle ? 0 : 1);
-}
-
@end

Powered by Google App Engine
This is Rietveld 408576698