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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/ntp/FakeMostVisitedSites.java

Issue 1772363002: Start using the whitelist icon on the NTP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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; 5 package org.chromium.chrome.browser.ntp;
6 6
7 import org.chromium.base.ThreadUtils; 7 import org.chromium.base.ThreadUtils;
8 import org.chromium.chrome.browser.profiles.MostVisitedSites; 8 import org.chromium.chrome.browser.profiles.MostVisitedSites;
9 import org.chromium.chrome.browser.profiles.Profile; 9 import org.chromium.chrome.browser.profiles.Profile;
10 10
11 import java.util.ArrayList; 11 import java.util.ArrayList;
12 import java.util.List; 12 import java.util.List;
13 13
14 /** 14 /**
15 * A fake implementation of MostVisitedSites that returns a fixed list of most v isited sites. 15 * A fake implementation of MostVisitedSites that returns a fixed list of most v isited sites.
16 */ 16 */
17 public class FakeMostVisitedSites extends MostVisitedSites { 17 public class FakeMostVisitedSites extends MostVisitedSites {
18 18
19 private final String[] mMostVisitedTitles; 19 private final String[] mMostVisitedTitles;
20 private final String[] mMostVisitedUrls; 20 private final String[] mMostVisitedUrls;
21 private final String[] mMostVisitedWhitelistIconPaths;
21 22
22 private final List<String> mBlacklistedUrls = new ArrayList<String>(); 23 private final List<String> mBlacklistedUrls = new ArrayList<String>();
23 24
24 /** 25 /**
25 * @param p The profile to associated most visited with. 26 * @param p The profile to associated most visited with.
26 * @param mostVisitedTitles The titles of the fixed list of most visited sit es. 27 * @param mostVisitedTitles The titles of the fixed list of most visited sit es.
27 * @param mostVisitedUrls The URLs of the fixed list of most visited sites. 28 * @param mostVisitedUrls The URLs of the fixed list of most visited sites.
28 */ 29 */
29 public FakeMostVisitedSites(Profile p, String[] mostVisitedTitles, String[] mostVisitedUrls) { 30 public FakeMostVisitedSites(Profile p, String[] mostVisitedTitles, String[] mostVisitedUrls,
31 String[] mostVisitedWhitelistIconPaths) {
30 super(p); 32 super(p);
31 assert mostVisitedTitles.length == mostVisitedUrls.length; 33 assert mostVisitedTitles.length == mostVisitedUrls.length;
32 mMostVisitedTitles = mostVisitedTitles.clone(); 34 mMostVisitedTitles = mostVisitedTitles.clone();
33 mMostVisitedUrls = mostVisitedUrls.clone(); 35 mMostVisitedUrls = mostVisitedUrls.clone();
36 mMostVisitedWhitelistIconPaths = mostVisitedWhitelistIconPaths.clone();
34 } 37 }
35 38
36 @Override 39 @Override
37 public void setMostVisitedURLsObserver(final MostVisitedURLsObserver observe r, int numResults) { 40 public void setMostVisitedURLsObserver(final MostVisitedURLsObserver observe r, int numResults) {
38 ThreadUtils.postOnUiThread(new Runnable() { 41 ThreadUtils.postOnUiThread(new Runnable() {
39 @Override 42 @Override
40 public void run() { 43 public void run() {
41 observer.onMostVisitedURLsAvailable(mMostVisitedTitles.clone(), 44 observer.onMostVisitedURLsAvailable(mMostVisitedTitles.clone(),
42 mMostVisitedUrls.clone()); 45 mMostVisitedUrls.clone(), mMostVisitedWhitelistIconPaths .clone());
43 } 46 }
44 }); 47 });
45 } 48 }
46 49
47 @Override 50 @Override
48 public void getURLThumbnail(String url, final ThumbnailCallback callback) { 51 public void getURLThumbnail(String url, final ThumbnailCallback callback) {
49 ThreadUtils.postOnUiThread(new Runnable() { 52 ThreadUtils.postOnUiThread(new Runnable() {
50 @Override 53 @Override
51 public void run() { 54 public void run() {
52 callback.onMostVisitedURLsThumbnailAvailable(null, true); 55 callback.onMostVisitedURLsThumbnailAvailable(null, true);
(...skipping 21 matching lines...) Expand all
74 @Override 77 @Override
75 public void recordTileTypeMetrics(int[] tileTypes) { 78 public void recordTileTypeMetrics(int[] tileTypes) {
76 // Metrics are stubbed out. 79 // Metrics are stubbed out.
77 } 80 }
78 81
79 @Override 82 @Override
80 public void recordOpenedMostVisitedItem(int index, int tileType) { 83 public void recordOpenedMostVisitedItem(int index, int tileType) {
81 // Metrics are stubbed out. 84 // Metrics are stubbed out.
82 } 85 }
83 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698