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

Unified Diff: ios/chrome/browser/ui/browser_view_controller.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/browser_view_controller.mm
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm
index b768c1e4344e0b4008b594cd268242d4ce07cf79..778d97ac440c6e7a28686ea35993d247ec0d80c0 100644
--- a/ios/chrome/browser/ui/browser_view_controller.mm
+++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -83,6 +83,8 @@
#import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h"
#import "ios/chrome/browser/ui/activity_services/share_protocol.h"
#import "ios/chrome/browser/ui/activity_services/share_to_data.h"
+#import "ios/chrome/browser/ui/activity_services/share_to_data_builder.h"
+#import "ios/chrome/browser/ui/activity_services/chrome_activity_item_thumbnail_generator.h"
Olivier 2017/01/20 10:14:00 alphabetical order
jif 2017/01/24 10:29:50 Done.
#import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h"
#import "ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h"
#import "ios/chrome/browser/ui/background_generator.h"
@@ -595,8 +597,6 @@ NSString* const kReadingListSnackbarCategory = @"ReadingListSnackbarCategory";
- (void)installDelegatesForTab:(Tab*)tab;
// Closes the current tab, with animation if applicable.
- (void)closeCurrentTab;
-// Returns an autoreleased share to data for |tab|.
-- (ShareToData*)shareToDataForTab:(Tab*)tab;
// Shows the menu to initiate sharing |data|.
- (void)sharePageWithData:(ShareToData*)data;
// Convenience method to share the current page.
@@ -4135,28 +4135,9 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver {
}
}
-- (ShareToData*)shareToDataForTab:(Tab*)tab {
- // For crash documented in crbug.com/503955, tab.url which is being passed
- // as a reference parameter caused a crash due to invalid address which
- // which suggests that |tab| may be deallocated along the way. Check that
- // tab is still valid by checking webState which would be deallocated if
- // tab is being closed.
- if (!tab.webState)
- return nil;
- DCHECK(tab);
- // If the original page title exists, it is expected to match the tab title.
- // If this ever changes, then a decision has to be made on which one should
- // be used for sharing.
- DCHECK(!tab.originalTitle || [tab.originalTitle isEqualToString:tab.title]);
- BOOL isPagePrintable = [tab viewForPrinting] != nil;
- return [[[ShareToData alloc] initWithURL:tab.url
- title:tab.title
- isOriginalTitle:(tab.originalTitle != nil)
- isPagePrintable:isPagePrintable] autorelease];
-}
-
- (void)sharePage {
- ShareToData* data = [self shareToDataForTab:[_model currentTab]];
+ ShareToData* data =
+ activity_services::ShareToDataFromTab([_model currentTab]);
if (data)
[self sharePageWithData:data];
}

Powered by Google App Engine
This is Rietveld 408576698