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

Unified Diff: ios/chrome/browser/ui/reading_list/reading_list_coordinator.mm

Issue 2721313002: Notify ReadingListCollectionViewController during dismissal (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/reading_list/reading_list_coordinator.mm
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_coordinator.mm b/ios/chrome/browser/ui/reading_list/reading_list_coordinator.mm
index 1dd51585360c21ac96540ce2d608818228064fc9..1dcd04a162d44cac272f0236b9cf1ee77b2fc6f4 100644
--- a/ios/chrome/browser/ui/reading_list/reading_list_coordinator.mm
+++ b/ios/chrome/browser/ui/reading_list/reading_list_coordinator.mm
@@ -58,7 +58,11 @@ enum UMAContextMenuAction {
@property(nonatomic, strong) AlertCoordinator* alertCoordinator;
// Opens |URL| in a new tab |incognito| or not.
-- (void)openNewTabWithURL:(const GURL&)URL incognito:(BOOL)incognito;
+- (void)openNewTabWithURL:(const GURL&)URL
+ incognito:(BOOL)incognito
+ fromReadingListCollectionViewController:
+ (ReadingListCollectionViewController*)
+ readingListCollectionViewController;
// Opens the offline url |offlineURL| of the entry saved in the reading list
// model with the |entryURL| url.
@@ -159,6 +163,8 @@ enum UMAContextMenuAction {
const GURL entryURL = entry->URL();
__weak ReadingListCoordinator* weakSelf = self;
+ __weak ReadingListCollectionViewController* weakCollection =
+ readingListCollectionViewController;
_alertCoordinator = [[ActionSheetCoordinator alloc]
initWithBaseViewController:self.containerViewController
@@ -174,7 +180,9 @@ enum UMAContextMenuAction {
[_alertCoordinator
addItemWithTitle:openInNewTabTitle
action:^{
- [weakSelf openNewTabWithURL:entryURL incognito:NO];
+ [weakSelf openNewTabWithURL:entryURL
+ incognito:NO
+ fromReadingListCollectionViewController:weakCollection];
UMA_HISTOGRAM_ENUMERATION("ReadingList.ContextMenu", NEW_TAB,
ENUM_MAX);
@@ -186,9 +194,11 @@ enum UMAContextMenuAction {
[_alertCoordinator
addItemWithTitle:openInNewTabIncognitoTitle
action:^{
+ [weakSelf openNewTabWithURL:entryURL
+ incognito:YES
+ fromReadingListCollectionViewController:weakCollection];
UMA_HISTOGRAM_ENUMERATION("ReadingList.ContextMenu",
NEW_INCOGNITO_TAB, ENUM_MAX);
- [weakSelf openNewTabWithURL:entryURL incognito:YES];
}
style:UIAlertActionStyleDefault];
@@ -215,8 +225,7 @@ enum UMAContextMenuAction {
VIEW_OFFLINE, ENUM_MAX);
[weakSelf openOfflineURL:offlineURL
correspondingEntryURL:entryURL
- fromReadingListCollectionViewController:
- readingListCollectionViewController];
+ fromReadingListCollectionViewController:weakCollection];
}
style:UIAlertActionStyleDefault];
}
@@ -248,6 +257,8 @@ readingListCollectionViewController:
base::RecordAction(base::UserMetricsAction("MobileReadingListOpen"));
+ [readingListCollectionViewController willBeDismissed];
+
[self.URLLoader loadURL:entry->URL()
referrer:web::Referrer()
transition:ui::PAGE_TRANSITION_AUTO_BOOKMARK
@@ -263,9 +274,10 @@ readingListCollectionViewController:
fromReadingListCollectionViewController:
(ReadingListCollectionViewController*)
readingListCollectionViewController {
- [readingListCollectionViewController willBeDismissed];
-
- [self openNewTabWithURL:offlineURL incognito:NO];
+ [self openNewTabWithURL:offlineURL
+ incognito:NO
+ fromReadingListCollectionViewController:
+ readingListCollectionViewController];
UMA_HISTOGRAM_BOOLEAN("ReadingList.OfflineVersionDisplayed", true);
const GURL updateURL = entryURL;
@@ -273,9 +285,14 @@ readingListCollectionViewController:
true);
}
-- (void)openNewTabWithURL:(const GURL&)URL incognito:(BOOL)incognito {
+- (void)openNewTabWithURL:(const GURL&)URL
+ incognito:(BOOL)incognito
+ fromReadingListCollectionViewController:
+ (ReadingListCollectionViewController*)
+ readingListCollectionViewController {
base::RecordAction(base::UserMetricsAction("MobileReadingListOpen"));
+ [readingListCollectionViewController willBeDismissed];
Olivier 2017/03/01 09:42:16 nit question: should this not be on line 301 (just
gambard 2017/03/01 11:59:38 It could be.
[self.URLLoader webPageOrderedOpen:URL
referrer:web::Referrer()
inIncognito:incognito
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698