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

Side by Side Diff: ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm

Issue 2891363002: Add long press actions for Most Visited tiles (Closed)
Patch Set: Address comments 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/content_suggestions/content_suggestions_mediator.h" 5 #import "ios/chrome/browser/content_suggestions/content_suggestions_mediator.h"
6 6
7 #include "base/mac/bind_objc_block.h" 7 #include "base/mac/bind_objc_block.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/optional.h" 10 #include "base/optional.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 - (void)dismissSuggestion:(ContentSuggestionIdentifier*)suggestionIdentifier { 118 - (void)dismissSuggestion:(ContentSuggestionIdentifier*)suggestionIdentifier {
119 ContentSuggestionsCategoryWrapper* categoryWrapper = 119 ContentSuggestionsCategoryWrapper* categoryWrapper =
120 [self categoryWrapperForSectionInfo:suggestionIdentifier.sectionInfo]; 120 [self categoryWrapperForSectionInfo:suggestionIdentifier.sectionInfo];
121 ntp_snippets::ContentSuggestion::ID suggestion_id = 121 ntp_snippets::ContentSuggestion::ID suggestion_id =
122 ntp_snippets::ContentSuggestion::ID([categoryWrapper category], 122 ntp_snippets::ContentSuggestion::ID([categoryWrapper category],
123 suggestionIdentifier.IDInSection); 123 suggestionIdentifier.IDInSection);
124 124
125 self.contentService->DismissSuggestion(suggestion_id); 125 self.contentService->DismissSuggestion(suggestion_id);
126 } 126 }
127 127
128 - (void)blacklistMostVisitedURL:(GURL)URL {
129 _mostVisitedSites->AddOrRemoveBlacklistedUrl(URL, true);
130 }
131
132 - (void)whitelistMostVisitedURL:(GURL)URL {
133 _mostVisitedSites->AddOrRemoveBlacklistedUrl(URL, false);
134 }
135
128 #pragma mark - ContentSuggestionsDataSource 136 #pragma mark - ContentSuggestionsDataSource
129 137
130 - (NSArray<ContentSuggestionsSectionInformation*>*)sectionsInfo { 138 - (NSArray<ContentSuggestionsSectionInformation*>*)sectionsInfo {
131 NSMutableArray<ContentSuggestionsSectionInformation*>* sectionsInfo = 139 NSMutableArray<ContentSuggestionsSectionInformation*>* sectionsInfo =
132 [NSMutableArray array]; 140 [NSMutableArray array];
133 141
134 if (self.mostVisitedItems.count > 0) { 142 if (self.mostVisitedItems.count > 0) {
135 [sectionsInfo addObject:self.mostVisitedSectionInfo]; 143 [sectionsInfo addObject:self.mostVisitedSectionInfo];
136 } 144 }
137 145
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 } 458 }
451 459
452 // Returns whether the |sectionInfo| is associated with a category from the 460 // Returns whether the |sectionInfo| is associated with a category from the
453 // content suggestions service. 461 // content suggestions service.
454 - (BOOL)isRelatedToContentSuggestionsService: 462 - (BOOL)isRelatedToContentSuggestionsService:
455 (ContentSuggestionsSectionInformation*)sectionInfo { 463 (ContentSuggestionsSectionInformation*)sectionInfo {
456 return sectionInfo != self.mostVisitedSectionInfo; 464 return sectionInfo != self.mostVisitedSectionInfo;
457 } 465 }
458 466
459 @end 467 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698