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

Side by Side Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm

Issue 2890193003: Open Most Visited items (Closed)
Patch Set: Fix showcase Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont roller.h" 5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont roller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom e.h" 8 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom e.h"
9 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" 9 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
10 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" 10 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 - (void)collectionView:(UICollectionView*)collectionView 135 - (void)collectionView:(UICollectionView*)collectionView
136 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { 136 didSelectItemAtIndexPath:(NSIndexPath*)indexPath {
137 [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; 137 [super collectionView:collectionView didSelectItemAtIndexPath:indexPath];
138 138
139 CollectionViewItem* item = 139 CollectionViewItem* item =
140 [self.collectionViewModel itemAtIndexPath:indexPath]; 140 [self.collectionViewModel itemAtIndexPath:indexPath];
141 switch ([self.collectionUpdater contentSuggestionTypeForItem:item]) { 141 switch ([self.collectionUpdater contentSuggestionTypeForItem:item]) {
142 case ContentSuggestionTypeReadingList: 142 case ContentSuggestionTypeReadingList:
143 case ContentSuggestionTypeArticle: 143 case ContentSuggestionTypeArticle:
144 [self unfocusOmnibox];
144 [self.suggestionCommandHandler openPageForItem:item]; 145 [self.suggestionCommandHandler openPageForItem:item];
145 break; 146 break;
146 case ContentSuggestionTypeMostVisited: 147 case ContentSuggestionTypeMostVisited:
147 // TODO(crbug.com/707754): Open the most visited site. 148 [self unfocusOmnibox];
149 [self.suggestionCommandHandler openMostVisitedItem:item
150 atIndex:indexPath.item];
148 break; 151 break;
149 case ContentSuggestionTypeEmpty: 152 case ContentSuggestionTypeEmpty:
150 break; 153 break;
151 } 154 }
152 } 155 }
153 156
154 #pragma mark - UICollectionViewDelegateFlowLayout 157 #pragma mark - UICollectionViewDelegateFlowLayout
155 158
156 - (CGSize)collectionView:(UICollectionView*)collectionView 159 - (CGSize)collectionView:(UICollectionView*)collectionView
157 layout:(UICollectionViewLayout*)collectionViewLayout 160 layout:(UICollectionViewLayout*)collectionViewLayout
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // Must be called from inside a performBatchUpdates: block. 264 // Must be called from inside a performBatchUpdates: block.
262 - (void)addEmptySectionPlaceholderIfNeeded:(NSInteger)section { 265 - (void)addEmptySectionPlaceholderIfNeeded:(NSInteger)section {
263 if ([self.collectionViewModel numberOfItemsInSection:section] > 0) 266 if ([self.collectionViewModel numberOfItemsInSection:section] > 0)
264 return; 267 return;
265 268
266 NSIndexPath* emptyItem = 269 NSIndexPath* emptyItem =
267 [self.collectionUpdater addEmptyItemForSection:section]; 270 [self.collectionUpdater addEmptyItemForSection:section];
268 [self.collectionView insertItemsAtIndexPaths:@[ emptyItem ]]; 271 [self.collectionView insertItemsAtIndexPaths:@[ emptyItem ]];
269 } 272 }
270 273
274 // Tells WebToolbarController to resign focus to the omnibox.
275 - (void)unfocusOmnibox {
276 // TODO(crbug.com/700375): once the omnibox is part of Content Suggestions,
277 // remove the fake omnibox focus here.
278 }
279
271 @end 280 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h ('k') | ios/chrome/browser/ui/favicon/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698