| OLD | NEW |
| 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 package org.chromium.chrome.browser.ntp.cards; | 5 package org.chromium.chrome.browser.ntp.cards; |
| 6 | 6 |
| 7 import android.support.annotation.CallSuper; | 7 import android.support.annotation.CallSuper; |
| 8 import android.support.annotation.Nullable; | 8 import android.support.annotation.Nullable; |
| 9 | 9 |
| 10 import org.chromium.base.Callback; | 10 import org.chromium.base.Callback; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 notifyItemRemoved(position); | 174 notifyItemRemoved(position); |
| 175 return suggestion; | 175 return suggestion; |
| 176 } | 176 } |
| 177 | 177 |
| 178 @Override | 178 @Override |
| 179 public Iterator<SnippetArticle> iterator() { | 179 public Iterator<SnippetArticle> iterator() { |
| 180 return mSuggestions.iterator(); | 180 return mSuggestions.iterator(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 @Override | 183 @Override |
| 184 public void visitItems(NodeVisitor visitor) { |
| 185 for (SnippetArticle suggestion : mSuggestions) { |
| 186 visitor.visitSuggestion(suggestion); |
| 187 } |
| 188 } |
| 189 |
| 190 @Override |
| 184 public Set<Integer> getItemDismissalGroup(int position) { | 191 public Set<Integer> getItemDismissalGroup(int position) { |
| 185 return Collections.singleton(position); | 192 return Collections.singleton(position); |
| 186 } | 193 } |
| 187 | 194 |
| 188 @Override | 195 @Override |
| 189 public void dismissItem(int position, Callback<String> itemRemovedCallba
ck) { | 196 public void dismissItem(int position, Callback<String> itemRemovedCallba
ck) { |
| 190 checkIndex(position); | 197 checkIndex(position); |
| 191 SuggestionsSource suggestionsSource = mUiDelegate.getSuggestionsSour
ce(); | 198 SuggestionsSource suggestionsSource = mUiDelegate.getSuggestionsSour
ce(); |
| 192 if (suggestionsSource == null) { | 199 if (suggestionsSource == null) { |
| 193 // It is possible for this method to be called after the NewTabP
age has had | 200 // It is possible for this method to be called after the NewTabP
age has had |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 public void onSuggestionOfflineIdChanged(SnippetArticle suggestion, @Nul
lable Long id) { | 541 public void onSuggestionOfflineIdChanged(SnippetArticle suggestion, @Nul
lable Long id) { |
| 535 mSuggestionsList.updateSuggestionOfflineId(suggestion, id); | 542 mSuggestionsList.updateSuggestionOfflineId(suggestion, id); |
| 536 } | 543 } |
| 537 | 544 |
| 538 @Override | 545 @Override |
| 539 public Iterable<SnippetArticle> getOfflinableSuggestions() { | 546 public Iterable<SnippetArticle> getOfflinableSuggestions() { |
| 540 return mSuggestionsList; | 547 return mSuggestionsList; |
| 541 } | 548 } |
| 542 } | 549 } |
| 543 } | 550 } |
| OLD | NEW |