OLD | NEW |
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 package org.chromium.chrome.browser.suggestions; | 5 package org.chromium.chrome.browser.suggestions; |
6 | 6 |
7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.os.Build; | 9 import android.os.Build; |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 if (mTileRemovedSnackbarController != null) { | 112 if (mTileRemovedSnackbarController != null) { |
113 mSnackbarManager.dismissSnackbars(mTileRemovedSnackbarController); | 113 mSnackbarManager.dismissSnackbars(mTileRemovedSnackbarController); |
114 } | 114 } |
115 mMostVisitedSites.destroy(); | 115 mMostVisitedSites.destroy(); |
116 } | 116 } |
117 | 117 |
118 private static MostVisitedSites buildMostVisitedSites(Profile profile) { | 118 private static MostVisitedSites buildMostVisitedSites(Profile profile) { |
119 if (sMostVisitedSitesForTests != null) { | 119 if (sMostVisitedSitesForTests != null) { |
120 return sMostVisitedSitesForTests; | 120 return sMostVisitedSitesForTests; |
121 } else { | 121 } else { |
122 return new MostVisitedSites(profile); | 122 return new MostVisitedSitesBridge(profile); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 @VisibleForTesting | 126 @VisibleForTesting |
127 public static void setMostVisitedSitesForTests(MostVisitedSites mostVisitedS
itesForTests) { | 127 public static void setMostVisitedSitesForTests(MostVisitedSites mostVisitedS
itesForTests) { |
128 sMostVisitedSitesForTests = mostVisitedSitesForTests; | 128 sMostVisitedSitesForTests = mostVisitedSitesForTests; |
129 } | 129 } |
130 | 130 |
131 private void showTileRemovedSnackbar(String url, final Callback<String> remo
valUndoneCallback) { | 131 private void showTileRemovedSnackbar(String url, final Callback<String> remo
valUndoneCallback) { |
132 if (mTileRemovedSnackbarController == null) { | 132 if (mTileRemovedSnackbarController == null) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 } | 183 } |
184 return false; | 184 return false; |
185 } | 185 } |
186 | 186 |
187 private static boolean matchURLs(String url1, String url2, boolean matchByHo
st) { | 187 private static boolean matchURLs(String url1, String url2, boolean matchByHo
st) { |
188 if (url1 == null || url2 == null) return false; | 188 if (url1 == null || url2 == null) return false; |
189 return matchByHost ? UrlUtilities.sameHost(url1, url2) : url1.equals(url
2); | 189 return matchByHost ? UrlUtilities.sameHost(url1, url2) : url1.equals(url
2); |
190 } | 190 } |
191 } | 191 } |
OLD | NEW |