| 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 27 matching lines...) Expand all Loading... |
| 38 private final Context mContext; | 38 private final Context mContext; |
| 39 private final SnackbarManager mSnackbarManager; | 39 private final SnackbarManager mSnackbarManager; |
| 40 private final TabModelSelector mTabModelSelector; | 40 private final TabModelSelector mTabModelSelector; |
| 41 private final SuggestionsNavigationDelegate mNavigationDelegate; | 41 private final SuggestionsNavigationDelegate mNavigationDelegate; |
| 42 private final MostVisitedSites mMostVisitedSites; | 42 private final MostVisitedSites mMostVisitedSites; |
| 43 | 43 |
| 44 private boolean mIsDestroyed; | 44 private boolean mIsDestroyed; |
| 45 private SnackbarController mTileRemovedSnackbarController; | 45 private SnackbarController mTileRemovedSnackbarController; |
| 46 | 46 |
| 47 public TileGroupDelegateImpl(ChromeActivity activity, Profile profile, | 47 public TileGroupDelegateImpl(ChromeActivity activity, Profile profile, |
| 48 TabModelSelector tabModelSelector, SuggestionsNavigationDelegate nav
igationDelegate) { | 48 TabModelSelector tabModelSelector, SuggestionsNavigationDelegate nav
igationDelegate, |
| 49 SnackbarManager snackbarManager) { |
| 49 mContext = activity; | 50 mContext = activity; |
| 50 mSnackbarManager = activity.getSnackbarManager(); | 51 mSnackbarManager = snackbarManager; |
| 51 mTabModelSelector = tabModelSelector; | 52 mTabModelSelector = tabModelSelector; |
| 52 mNavigationDelegate = navigationDelegate; | 53 mNavigationDelegate = navigationDelegate; |
| 53 mMostVisitedSites = buildMostVisitedSites(profile); | 54 mMostVisitedSites = buildMostVisitedSites(profile); |
| 54 } | 55 } |
| 55 | 56 |
| 56 @Override | 57 @Override |
| 57 public void removeMostVisitedItem(Tile item, Callback<String> removalUndoneC
allback) { | 58 public void removeMostVisitedItem(Tile item, Callback<String> removalUndoneC
allback) { |
| 58 assert !mIsDestroyed; | 59 assert !mIsDestroyed; |
| 59 | 60 |
| 60 mMostVisitedSites.addBlacklistedUrl(item.getUrl()); | 61 mMostVisitedSites.addBlacklistedUrl(item.getUrl()); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 183 } |
| 183 } | 184 } |
| 184 return false; | 185 return false; |
| 185 } | 186 } |
| 186 | 187 |
| 187 private static boolean matchURLs(String url1, String url2, boolean matchByHo
st) { | 188 private static boolean matchURLs(String url1, String url2, boolean matchByHo
st) { |
| 188 if (url1 == null || url2 == null) return false; | 189 if (url1 == null || url2 == null) return false; |
| 189 return matchByHost ? UrlUtilities.sameHost(url1, url2) : url1.equals(url
2); | 190 return matchByHost ? UrlUtilities.sameHost(url1, url2) : url1.equals(url
2); |
| 190 } | 191 } |
| 191 } | 192 } |
| OLD | NEW |